[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Randomizing weighted newtorks
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] Randomizing weighted newtorks |
Date: |
Sat, 1 Jun 2013 16:01:26 +0200 |
> I have a rather naive question to ask. How do you randomize a
> weighted network(edges are weighted)?
Well, what do you want to achieve with randomization? Do you have any specific
properties of the network that you wish to preserve during randomization? When
you randomize an unweighted network, you typically wish to preserve the degree
distribution -- is this the case here as well? Or do you want to preserve the
*strength* of each node (i.e. the sum of weights of edges incident on each
node)? Either way, igraph has no built-in support for weighted network
randomization whatsoever, so you first have to decide what exactly you want to
achieve and then code it yourself.
Two dead simple cases of randomization come to my mind that can be implemented
relatively easily using the existing tools in igraph:
1. Keep the edges exactly as they are, but shuffle the weights around. This can
be achieved by retrieving the weight vector of the edges, shuffling the weight
vector, and re-assigning the shuffled copy to the edges. T
2. Shuffle the edges while preserving the degree distribution, and shuffle the
weights as well. This is almost the same as case 1, but before re-assigning the
shuffled copy, you also call the rewire() method of the graph (or call
igraph_rewire if you are using the C core directly).
--
T.