Thanks much Tamas, this is an useful workaround. Regarding the NA
values, I can file a bug report somewhere for igraph.
-sal
On 4/1/2014 11:36 AM, Tamás Nepusz wrote:
Not sure why the NA values appear in your graphs -- we would need a
reproducible example to be able to investigate this. However, one trick that
you could use is to “save” your original weights vector in a variable, and then
for every generated graph, shuffle the weights vector and assign it to the
edges of the generated graph. E.g.:
weights <- E(g)$weight
g2 <- degree.sequence.game(degree(g), method=“vl”)
E(g2)$weight <- scramble(weights)
where scramble() is a function that takes a vector and shuffles it; something
like:
scramble <- function(x, k=3L) {
x.s <- seq_along(x)
y.s <- sample(x.s)
x[unlist(split(x.s[y.s], (y.s-1) %/% k), use.names = FALSE)]
}
(scramble function copied shamelessly from here:
http://stackoverflow.com/a/17640731/156771)
--
T.
------------------------------------------------------
From: Salvatore Loguercio [email protected]
Reply: Help for igraph users [email protected]
Date: 1 April 2014 at 19:45:01
To: [email protected] [email protected]
Subject: Re: [igraph] Degree-preserving rewiring of a large graph
Okay, to answer my own question I went on and used niter=10000 (my graph
is 14736 nodes and 153834 edges, weighted, self loops and double edges
removed) - I generated 1000 simulated graphs this way. Only, the rewired
graphs have some NA in the adjacency matrix - also reported in
http://stackoverflow.com/questions/21179746/how-do-you-rewire-a-weighted-network-using-igraph-in-r.
Is this expected somehow? I used "simple" option in rewire.
Best,
Sal
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help