igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Problem with edge weights after rewire()


From: Tamás Nepusz
Subject: Re: [igraph] Problem with edge weights after rewire()
Date: Thu, 7 Feb 2013 19:44:44 +0100

Dear Matthias,

> After applying ``rewire()`` the edge values are replaced by 'None'. Does the 
> rewire function allow for randomization of weighted networks at all?
Well, yes, with a little trick. The ``rewire()`` function does not preserve 
edge attributes yet, but you can "back them up" in a variable and re-apply them 
after rewiring:

weights = g.es["weight"]
g.rewire()
g.es["weight"] = weights

You can also shuffle the weights only while keeping the structure intact:

from random import shuffle
weights = g.es["weight"]
shuffle(weights)
g.es["weight"] = weights

> Is there a function in igraph that allows to preserve the strength/weighted 
> degree distribution instead of 'just' the degree distribution?
No, that is not implemented yet. If you happen to know an algorithm that allows 
one to shuffle the strength distribution, let us know.

> I am new to the analysis of weighted graphs and I am geting the impression 
> that people tend to randomize weighted networks in a way that preserves the 
> degree distribution and globally shuffle the weights (e.g. seen in [1]). Is 
> that correct?
Yes, I think it is. This can be achieved in igraph using the first code snippet 
I included above.

Best,
Tamas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]