[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] rewire till assortivity.degree reaches certain value.
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] rewire till assortivity.degree reaches certain value. |
Date: |
Tue, 23 Apr 2013 00:22:15 +0200 |
> How to i make it to move in one direction(either towards more positive or
> more negative) of values?
Well, you write your own rewiring function that strives to increase or decrease
assortativity explicitly ;) The degree-preserving rewiring implemented in
igraph does not care about assortativity at all.
A (probably) slow way of doing what you want would be as follows:
1. Calculate the assortativity of your current graph.
2. Rewire your original graph using a small value for the "niter" parameter of
rewire(); maybe try with niter=10 first.
3. Calculate the assortativity of the rewired graph. If it went in the desired
direction, keep the rewired graph and go back to the previous step to keep on
rewiring. Otherwise, keep the original graph before the last rewiring step and
try again from step 2.
The reason why I'm saying that it's probably slow is because there is a
constant overhead associated with the rewire() call since it makes a copy of
your graph (this is the standard way of doing things in R). If your graph is
large, the cost of copying will dominate the cost of making a single rewiring
step.
--
T.