Return a 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 rewiring existing edges as follows: for each edge u-v in the underlying “n-ring with k nearest neighbors” with probability p replace u-v with a new edge u-w with randomly-chosen existing node w. In contrast with newman_watts_strogatz_graph(), the random rewiring does not increase the number of edges.
Parameters: |
|
---|