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