
Measuring a Percolation Phase Transition: 1.5 Percentage Points Take the Spanning Probability From 0% to 100%
Take a square lattice and let each cell be “open” independently with probability . Open cells that touch each other are connected. Is there a path of open cells running all the way from the top edge to the bottom edge? That question is called percolation. Whether hot water soaks through coffee grounds, whether a wildfire burns clear across a forest, whether a rumor makes it through a network — they all share this skeleton.
The interesting part starts here. Theory says 2D site percolation has a critical probability : below it, the spanning probability is 0 (on an infinite lattice), above it, 1. Somewhere between 0.59 and 0.60 stands a cliff separating a world that doesn’t connect from a world that does.
The probability moves smoothly, and the outcome moves discontinuously. It’s the same shape as grokking — nothing happens for tens of thousands of steps and then suddenly the model gets it — an observable that jumps while the parameter you’re turning moves continuously. Is it really that abrupt? And can you see the cliff on a finite lattice at all? I measured it with numpy and scipy.
The full code for the experiment is on GitHub.
Experimental design
The task is simple, and the core of the implementation is about ten lines.
- Build an field of uniform random numbers and call a cell occupied when
- Detect all 4-neighbor connected clusters at once with
scipy.ndimage.label - Declare “spanning” when the top row and the bottom row share a cluster label
I swept the occupation probability from to in steps of 0.005 and measured the spanning probability and the largest cluster size at each of (1000 trials at , down to 80 at ). On top of that, for each random field I found , the occupation probability at which that particular field first spans, by bisection. For a fixed random field, raising only ever adds occupied cells, so the spanning threshold can be pinned down to a precision of by bisection. The distribution of tells you both where the transition sits and how blunt it is.
First, watch it span
Here is what happens when you raise gradually on a single random field. Clusters are colored individually, a merged cluster inherits the color of whichever core formed first, and the cluster that spans top to bottom lights up yellow.

What was a scattering of small islands at starts merging like an avalanche from about 0.58, and on this particular field it spanned the screen at . What matters here is not the newly placed cells themselves. The last 0.5% of cells act as bridges between continents that had already grown.
Lining up the landscape below, at, and above the transition on a larger lattice () looks like this.

Only the landscape at the critical point is qualitatively different. Below it is “nothing but small islands,” above it is “almost one color,” while at the critical point clusters of every scale exist simultaneously. I’ll pin that “every scale” down quantitatively later, as a power law.
Result 1: the bigger the lattice, the more the transition becomes a cliff
The family of spanning-probability curves is the main result of this experiment.

The transition at is gentle: even at it spans 3.8% of the time, and even at it fails to span 0.7% of the time. At , though:
| Occupation p | 0.585 | 0.590 | 0.595 | 0.600 |
|---|---|---|---|---|
| Spanning probability (L=1024) | 0.000 | 0.125 | 0.787 | 1.000 |
While the occupation probability moves a mere 1.5 percentage points, from 0.585 to 0.600, the spanning probability jumps from 0% to 100%. All 80 trials fail to span at 0.585, and all 80 span at 0.600. The largest cluster tells the same story: at and the largest cluster is only 2.4% of the lattice, and at 0.60 a single cluster holds 41.7% of it.
How the bluntness disappears can be measured by the spread (interquartile range) of the distribution.

| L | Transition width (IQR) | p at 50% spanning |
|---|---|---|
| 64 | 0.0328 | 0.5919 |
| 128 | 0.0197 | 0.5924 |
| 256 | 0.0111 | 0.5924 |
| 512 | 0.0062 | 0.5918 |
| 1024 | 0.0033 | 0.5928 |
Going from to , a factor of 16, shrinks the transition width from 0.0328 to 0.0033 — exactly a factor of ten. The slope on the log-log plot is . Theory says the width should shrink as using the correlation-length exponent , so the sign and rough size of the slope agree, with a small discrepancy I’ll come back to. Because the shrinkage is a power law, the width never actually reaches zero no matter how large you go — but it heads there reliably. The textbook line “the transition is only truly discontinuous on an infinite lattice” shows up in front of you as a measured curve steepening into a cliff.
Result 2: the measured critical point is 0.5925 ± 0.0004
The occupation probability at which spanning hits 50% barely moves with lattice size, sitting around 0.592 at every size. Extrapolating to an infinite lattice with finite-size scaling ():
The established numerical estimate falls neatly inside the error bar — within 1σ, off by 0.0003. Reading the median directly gives 0.59277, a mere 0.00002 from that estimate, but that agreement is an order of magnitude finer than the uncertainty (±0.0003), so honestly it’s luck. Redraw the random numbers and that digit moves.
Result 3: the power law holds at the critical point and nowhere else
The “clusters of every scale coexisting” state visible in the critical snapshot should show up as a power law in the cluster size distribution, . It’s the same self-similarity story as measuring the dimension of a Sierpiński triangle: the same structure appears no matter what scale you look at. I measured the distribution over 20 lattices at (excluding the spanning cluster).

- At the critical point (): the distribution follows a straight line across five decades of size. The measured slope is (theory is ). The fit residual is RMS 0.04 on a log scale — very nearly a perfect line
- Below critical (): clusters larger than die off exponentially. Fitting over the same range gives a residual of 0.49, an order of magnitude larger; it is not a straight line
- Above critical (): removing the giant cluster leaves only fragments with , and the distribution bends away early, at (residual 1.11)
The critical point is the only place with no characteristic size. Step off criticality and a bend always appears, a scale beyond which clusters essentially don’t exist. The straight line at the critical point means one and the same law governs everything from a cluster of size 1 to a monster of half a million sites.
Things worth stating honestly
- The scaling exponent of the transition width disagrees with theory. Measured against a theoretical . Corrections to scaling are known to matter on small lattices like , and the small- points are steepening the slope. I should refit using only larger lattices, but my compute budget stopped at
- is also shallower than the theoretical 2.055. Finite size again: even at , the value moves by ±0.05 depending on how you choose the fit range. As with the Sierpiński dimension measurement, measuring a power-law exponent never escapes a negotiation with the fitting range
- The definition of spanning is somewhat arbitrary. I only looked top-to-bottom. Including left-right, or requiring both, shifts the finite-size curves slightly (the extrapolated infinite-size value doesn’t change)
- The fitted slope at came out at 2.05, coincidentally almost exactly the theoretical value. But look at the residual and it’s obvious the distribution is curved. A good lesson in not concluding “it follows a power law” from the exponent alone
What surprised me when I actually ran it
The biggest surprise was that finite-size effects showed up almost entirely in the width, not the position. Going in, I assumed a small lattice would put the transition point itself noticeably off. In fact even puts the 50%-spanning point at 0.5919, less than 0.001 from the true critical point. What was off was not the location but the spread: individual trials at run wild, spanning at 0.55 in one draw and refusing to span until 0.63 in another. “On average we already know the answer, but no individual answer is trustworthy” converges, as the lattice grows, into “every trial returns the same answer.”
The other surprise was how effective bisection is. Instead of sweeping finely and tracing out the spanning probability, you can pin down the exact at which each random field starts spanning with about a dozen cluster detections. If you want statistics on the transition point, measuring the distribution directly beats measuring the S-curve by a wide margin. Where there’s monotonicity, there’s bisection.
And the strangeness of the critical landscape I genuinely did not anticipate until I saw the figure. Not below the transition, not above it, but at that one point, the system becomes “equally intricate at every scale you look.” So that is what a diverging correlation length looks like.
Criticality is a skeleton that applies to networks too, so it’s tempting to lay society over it. One or two extra connections change nothing, in almost every situation. But when the system happens to be near its critical point, that one connection becomes the bridge between continents. When something suddenly “spans” on social media, or the mood of an organization shifts from one day to the next, probably nothing big happened on the day it changed. The islands had been growing all along, and the last move happened to be a bridge. If that’s right, then a period with no visible change is not a period in which nothing is happening.
Reading the threshold and the percentages
The square-lattice, nearest-neighbor site-percolation threshold near 0.5927 is a numerical estimate, not an exact analytic value. See the Monte Carlo calculation by Newman and Ziff. The 0% and 100% reported here are fractions observed in 80 trials; they do not establish exact probabilities of zero or one on a finite lattice.
Summary
- Measured the spanning probability of 2D site percolation ( lattice, 4-neighbor) for to
- The bigger the lattice, the steeper the transition: at , 1.5 percentage points of occupation (0.585 → 0.600) take the spanning probability from 0% to 100%
- The transition width shrinks as (theory: ); a 16-fold increase in shrinks it by roughly a factor of ten
- Extrapolating to an infinite lattice gives , agreeing with the established numerical estimate 0.59275 within 1σ
- The cluster size distribution follows the power law at the critical point and only there (measured , theory 2.055, straight across five decades); off criticality it bends at a characteristic scale
- Finite-size effects barely moved the location of the transition and showed up as its width — width dominated in this experiment, but finite-size estimates can also have a shifted transition location