NetworkX

Previous topic

networkx.generators.random_graphs.binomial_graph

Next topic

networkx.generators.random_graphs.watts_strogatz_graph

networkx.generators.random_graphs.newman_watts_strogatz_graph

newman_watts_strogatz_graph(n, k, p, create_using=None, seed=None)

Return a Newman-Watts-Strogatz small world graph.

Parameters:

n : int

The number of nodes

k : int

Each node is connected to k nearest neighbors in ring topology

p : float

The probability of adding a new edge for each edge

create_using : graph, optional (default Graph)

The graph instance used to build the graph.

seed : int, optional

seed for random number generator (default=None)

Notes

First create a ring over n nodes. Then each node in the ring is connected with its k nearest neighbors (k-1 neighbors if k is odd). Then shortcuts are created by adding new edges as follows: for each edge u-v in the underlying “n-ring with k nearest neighbors” with probability p add a new edge u-w with randomly-chosen existing node w. In contrast with watts_strogatz_graph(), no edges are removed.

References

[R75]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