igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Translate code from r to python


From: simone gabbriellini
Subject: Re: [igraph] Translate code from r to python
Date: Sat, 27 Jun 2009 11:49:13 +0200

Hi Tamas,

due to the fact that I am building directed networks, would it be better to use sum(g.outdegree())/g.vcount()?

thanks,
Simone

Il giorno 26/giu/09, alle ore 13:19, Tamas Nepusz ha scritto:

g.sw=rewire.edges(graph.lattice(vcount(g), nei=mean(degree(g)), dir=TRUE, mutual=TRUE), p=0.25)
g_sw = Graph.Lattice(g.vcount(), nei=sum(g.degree())/g.vcount(), dir=True, mutual=True)
g_sw.rewire(0.25 * g_sw.ecount())

Note that rewire() does not have a p= argument in Python, only n=... which lets you specify the number of rewirings. That's why I've written g_sw.ecount() * 0.25. Another difference is that Graph.rewire() rewires the graph in-place in Python, so you must construct the graph first and then invoke its rewire() method.

--
T.



_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help





reply via email to

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