[Top][All Lists]

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

Re: [igraph] rewire till assortivity.degree reaches certain value.

From: suvirbhargav
Subject: Re: [igraph] rewire till assortivity.degree reaches certain value.
Date: Tue, 23 Apr 2013 16:29:05 +0200

thanks for your reply.
your solution for 1,2,3 step worked for me and it reaches desired value for assortivity.degree in few seconds.
Thanks & Regards

On Tue, Apr 23, 2013 at 12:22 AM, Tamás Nepusz <address@hidden> wrote:
> 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.

igraph-help mailing list

reply via email to

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