A null model asks: is this network's structure surprising, or a consequence of the connections on each node (i.e. the degrees)? This is no different from any other statistical question: generate many random networks with the same degree sequence and compare. P-stability is the guarantee that you can sample a random graph from the starting graph in polynomial time.
Left: a bipartite network — rows connected to columns. Right: the same network as an adjacency matrix. The degree sequence is the row and column sums in the margins.
A switch picks two edges (i,a) and (j,b) whose crossed pairs are absent, and swaps endpoints. Two cells go dark, two light up, and every margin stays exactly the same.
A switch is really two hinge flips in a row. One hinge flip moves a single edge endpoint, (i,a) → (i,b): column a loses a degree, column b gains one, and the network briefly has a neighbouring degree sequence \(d'\) at L1-distance 2 from \(d\). The second flip moves it back. P-stability is a statement about exactly these neighbouring sequences: \(\Omega(d')\) is never much larger than \(\Omega(d)\), so a chain that wanders through them spends most of its time in \(\Omega(d)\) itself — which is how the guarantee transfers to the switch chain.
Every network reachable this way is a realization of the same degree sequence. Their set, \(\Omega(d)\), is finite but astronomically large. The starting network is one point in it.
Think of \(\Omega(d)\) as a state space where every state is one whole network — a complete realization of \(d\) — and a switch is one step from a realization to a neighbouring one. Then a random walk composed of these steps mixes fast when the state space is well-connected and slowly when there are bottlenecks.
How do you prove there are no bottlenecks? With a canonical-path argument: pick one route (a sequence of switches) between every pair of states, then check that no single state is crossed by too many routes (the congestion \(\rho\)) and that no route is too long (\(\ell\)). If routes are spread evenly, the state space has no narrow passage, and a random walk cannot get stuck. Those two numbers bound the mixing time:
Where P-stability comes in. Bounding the congestion means counting the routes that cross a given state \(Z\). The standard trick: any route crossing \(Z\) can be reconstructed from \(Z\) plus a "leftover" network. That leftover is not a realization of \(d\) — it is a realization of a slightly perturbed sequence \(d'\), off by one or two degrees, which is exactly what a hinge flip produces. So the number of routes through \(Z\) is at most \(\mathrm{poly}(n)\cdot|\Omega(d')|\). P-stability caps that count:
No state carries more than a polynomial multiple of its fair share of routes, so the congestion is polynomial, so the switch chain has no bottleneck and mixes in polynomially many steps.
The perturbed sequences \(d''\) appear only in the encodings used to count routes — never as states of the chain.
300 walkers start at the same realization in both state spaces. Watch how far each population is from uniform.
Run N independent chains from the observed network, each for T steps, and measure a statistic on every sample — here community structure: the share of edges that fall inside the two known groups (a simple modularity). Together the sampled values form the null distribution.
With a small T the samples are still close relatives of the starting network: the histogram hugs the observed value and z collapses toward 0 — the test says "nothing unusual" whether or not something is. Nothing in the p-value reveals this.
With T at the proven mixing bound, samples are approximately uniform draws from Ω(d) and the comparison means what it claims:
Canonical-path polynomials carry large exponents (\(O(n^{13})\) for general degree sequences, where \(n\) is the number of vertices). In practice P-stability is used qualitatively: it certifies the true mixing time is polynomial, which justifies trusting a cheap empirical stopping rule.
A z-score assumes the null histogram is roughly bell-shaped. Some statistics aren't — algebraic connectivity is exactly 0 for any disconnected sample, so the histogram gets a spike at 0 next to a separate hump. Look at the histogram first; if it isn't bell-shaped, use the rank p-value, which only counts samples at least as extreme as the observed and works for any shape.
The smallest achievable p-value with \(N\) samples is \(1/(N+1)\). A target threshold fixes a minimum N regardless of how fast sampling is.