Small-World Networks
Small-World Networks
In 1998, Watts and Strogatz proposed a network model that captures a striking property observed in real-world networks: high clustering combined with short average path lengths — the "small-world" phenomenon.
The Ring Lattice
Start with a ring lattice: nodes arranged in a circle, each connected to its nearest neighbours on each side (total degree ).
N=6, K=2: node 0 connects to {1, 2, 4, 5}
Properties of the regular ring lattice:
- High clustering: nearby nodes share many common neighbours
- Long path lengths: to get across the ring takes steps
Average Path Length
The average path length is the mean shortest-path distance over all pairs of nodes:
Shortest paths are computed using breadth-first search (BFS).
Global Clustering Coefficient
The global clustering coefficient is the mean local clustering coefficient across all nodes:
Small-World Signature
A network is "small-world" when, compared to a random graph with the same and :
- (much higher clustering)
- (similar short paths)
Real examples: social networks (six degrees of separation), the brain's connectome, the power grid.
Your Task
Implement:
ring_lattice_adj(N, K)— build the ring lattice adjacency dict; node connects tobfs_distances(adj, source)— BFS fromsource, returns{node: distance}dictaverage_path_length(adj)— mean shortest path over all ordered pairsglobal_clustering(adj)— mean local clustering coefficient
Use from collections import deque for BFS.