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 10:25:29 +0200

Hi Tamas,

I've tryed something similar, but without success...

you code gives me the following error:

--> 258 gSW = Graph.Lattice(g.vcount(), nei=sum(g.degree())/g.vcount(), dir=True, mutual=True)

TypeError: argument 1 must be list, not int
WARNING: Failure executing file: <analisi_venezia.py>

Regards,
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]