networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersReturns
sigma(G, niter=100, nrand=10, seed=None)

The small-world coefficient is defined as: sigma = C/Cr / L/Lr where C and L are respectively the average clustering coefficient and average shortest path length of G. Cr and Lr are respectively the average clustering coefficient and average shortest path length of an equivalent random graph.

A graph is commonly classified as small-world if sigma>1.

Notes

The implementation is adapted from Humphries et al. .

Parameters

G : NetworkX graph

An undirected graph.

niter : integer (optional, default=100)

Approximate number of rewiring per edge to compute the equivalent random graph.

nrand : integer (optional, default=10)

Number of random graphs generated to compute the average clustering coefficient (Cr) and average shortest path length (Lr).

seed : integer, random_state, or None (default)

Indicator of random number generation state. See Randomness<randomness> .

Returns

sigma : float

The small-world coefficient of G.

Returns the small-world coefficient (sigma) of the given graph.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/smallworld.py#229
type: <class 'function'>
Commit: