networkx.algorithms.smallworld.lattice_reference¶
-
lattice_reference(G, niter=1, D=None, connectivity=True, seed=None)[source]¶ Latticize the given graph by swapping edges.
- Parameters
G (
graph) – An undirected graph with 4 or more nodes.niter (
integer (optional, default1)) – An edge is rewired approximatively niter times.D (
numpy.array (optional, defaultNone)) – Distance to the diagonal matrix.connectivity (
boolean (optional, defaultTrue)) – Ensure connectivity for the latticized graph when set to True.seed (
integer,random_state, orNone (default)) – Indicator of random number generation state. See Randomness.
- Returns
G – The latticized graph.
- Return type
graph
Notes
The implementation is adapted from the algorithm by Sporns et al. 1. which is inspired from the original work by Maslov and Sneppen(2002) 2.
References