#

Note

This documents the development version of NetworkX. Documentation for the current release can be found here.

#

networkx.algorithms.smallworld.random_reference

random_reference(G, niter=1, connectivity=True, seed=None)[source]

Compute a random graph by swapping edges of a given graph.

Parameters
  • G (graph) – An undirected graph with 4 or more nodes.

  • niter (integer (optional, default=1)) – An edge is rewired approximately niter times.

  • connectivity (boolean (optional, default=True)) – When True, ensure connectivity for the randomized graph.

  • seed (integer, random_state, or None (default)) – Indicator of random number generation state. See Randomness.

Returns

G – The randomized graph.

Return type

graph

Notes

The implementation is adapted from the algorithm by Maslov and Sneppen (2002) 1.

References

1

Maslov, Sergei, and Kim Sneppen. “Specificity and stability in topology of protein networks.” Science 296.5569 (2002): 910-913.