NetworkX

Previous topic

networkx.binomial_graph

Next topic

networkx.watts_strogatz_graph

Quick search

networkx.newman_watts_strogatz_graph

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

Return a Newman-Watts-Strogatz small world graph.

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.

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

seed : int

seed for random number generator (default=None)

Notes

@ARTICLE{newman-1999-263, author = {M.~E.~J. Newman and D.~J. Watts}, title = {Renormalization group analysis of the small-world network model}, journal = {Physics Letters A}, volume = {263}, pages = {341}, url = {http://www.citebase.org/abstract?id=oai:arXiv.org:cond-mat/9903357}, year = {1999} }