Raffael
Raffael

Reputation: 20045

How to Transform Voronoi Mosaic into a Graph in R?

I would like to convert a Voronoi mosaic into an undirected graph using R. How?

library(mvtnorm)
library(tripack)
set <- rmvnorm(100,c(0,0),diag(2))
voronoi <- (voronoi.mosaic(set[,1],set[,2]))
plot(voronoi)

enter image description here

1,2
2,3
3,4
1,4
...

I would prefer to use R but in case you have a nifty solution in another language I'd like to hear about it.

Upvotes: 0

Views: 311

Answers (1)

shadowtalker
shadowtalker

Reputation: 13883

The igraph package is a fairly complete graph analysis package. It has a variety of functions for creating graphs out of different data structures. In your case I think you'll want the function graph.edgelist.

Upvotes: 1

Related Questions