How to seed graph generator in python-igraph?
问题 Is there any way to seed the following Watts-Strogatz graph generated using python-igraph, so that each time I run the script I get the same realization of SW graph ? import igraph graph = igraph.Graph.Watts_Strogatz(1, N, nei, p) where N is the number of nodes, nei the number of connected neighbors, and p the rewiring probability. 回答1: igraph uses the built-in RNG of Python so you can seed that: In [1]: import random In [2]: random.seed(1234) In [3]: g=Graph.Watts_Strogatz(1, 100, 2, 0.25)