newman_watts_strogatz_graph¶
-
newman_watts_strogatz_graph(n, k, p, seed=None)[source]¶ Return a Newman–Watts–Strogatz small-world graph.
Parameters: - n (int) – The number of nodes.
- k (int) – Each node is joined with its
knearest neighbors in a ring topology. - p (float) – The probability of adding a new edge for each edge.
- seed (int, optional) – The seed for the random number generator (the default is
None).
Notes
First create a ring over
nnodes. Then each node in the ring is connected with itsknearest neighbors (ork - 1neighbors ifkis odd). Then shortcuts are created by adding new edges as follows: for each edge(u, v)in the underlying “n-ring withknearest neighbors” with probabilitypadd a new edge(u, w)with randomly-chosen existing nodew. In contrast withwatts_strogatz_graph(), no edges are removed.See also
References
[1] M. E. J. Newman and D. J. Watts, Renormalization group analysis of the small-world network model, Physics Letters A, 263, 341, 1999. http://dx.doi.org/10.1016/S0375-9601(99)00757-4