aryagraph.generators.random.watts_strogatz#
- aryagraph.generators.random.watts_strogatz(n: int, k: int, p: float, *, seed: int | Generator | None = None) Graph[source]#
Watts–Strogatz small world.
Starts from a ring where each node links to its
k // 2nearest neighbors on each side, then rewires the far end of every edge with probability p to a uniformly chosen node, avoiding self-loops and duplicates (networkx’s procedure). The edge countn·(k // 2)is preserved.k == ngives the complete graph;k > nis an error.