Dear Robin,

`Assuming that your square matrix of probabilities is given in a
``matrix p,
`you can do this:

`p <- matrix(c(0,0.5,0.5,0.5, 0.5,0,0.5,0.5, 0,0,0,0, 1,0,1,0),
``nrow=4)
`r <- matrix(runif(nrow(p)*ncol(p)), nrow=nrow(p))
g <- graph.adjacency(r < p, mode="undirected")

--
T.
On 02/23/2012 11:40 AM, Robin Cowan wrote:

Dear List,
Is there a simple way of taking a square (symmetric) matrix of reals
and generating a random graph of fixed density using that matrix as
the (relative) probability of a particular link forming.
I am using igraph inside R.
It seems one way to do that would be with a two-dimensional version
of the sample() statement, to create an adjacency matrix, but I can't
find documentation on that.
It also seems related to igraph's preference.game() but I can't see a
way there to control density
Thanks for your help.
Robin Cowan
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help