What you're seeing
A grid of sites, each independently occupied (colored) with probability p or left empty (dark). Occupied sites that touch edge-to-edge join into clusters, and each cluster gets its own color. At low p you see a confetti of tiny, isolated islands. As you raise p, neighboring islands merge — slowly at first, then, over a remarkably narrow range near p_c ≈ 0.5927, all at once: a single giant cluster appears that threads from one side of the grid to the other. The moment a cluster bridges top to bottom it flares bright white. Nothing coordinates this. Each site is decided by an independent coin flip; the system-spanning network is an emergent fact about connectivity, not about any individual site.
The rule
The entire model:
- Occupy each site of the grid independently with probability p (and leave it empty with probability 1−p).
- Connect any two occupied sites that are orthogonal neighbors (up / down / left / right — 4-connectivity).
- Ask: does a single connected cluster reach all the way across the grid — top to bottom? If so, the system percolates.
That's it. No dynamics, no time, no neighbors influencing one another — just a random pattern and a question about whether a path crosses it. To find the clusters here we use a weighted union-find (union by size with path compression), scanning the grid once and merging each occupied site with its already-seen left and upper neighbors. It is iterative, not recursive, so the grid can be large without overflowing a call stack.
Why it matters
Percolation is the simplest clean example of a connectivity phase transition. Below the critical probability p_c there is no large-scale connection: every cluster is small compared with the system, and the chance of a spanning cluster vanishes as the grid grows. Above p_c a single giant component occupies a finite fraction of all sites and almost surely spans. In the infinite-system limit the change is sharp — a true discontinuity in whether connection exists — even though each site changed by an infinitesimal nudge in p.
Exactly at p_c the spanning cluster is a fractal: it has holes at every scale and its mass grows as a non-integer power of the system size. Cluster sizes are scale-free, following a power law with no characteristic size — the hallmark of a critical point. Because percolation can be defined and studied so cleanly, it became a foundational testbed for universality: the idea that the critical exponents describing the transition depend only on coarse features like dimensionality, not on lattice details, so percolation, the Ising model, and many other systems near their critical points fall into shared classes. (For more on the knife-edge between order and disorder, see this Atlas's essay on the edge of chaos.)
In the wild
The model is abstract, but its question — is there a connected path all the way across? — is everywhere concrete:
- Porous media: whether fluid, oil, or gas flows through rock, soil, or a filter depends on whether the open pores connect into a spanning network. Percolation theory was born (1957) partly to model gas masks — when does a filter's random channels let air through?
- Electrical conduction: a random mix of conducting and insulating grains conducts only once the conductors percolate; below threshold it is an insulator, above it a conductor. This governs conductive composites and many disordered materials.
- Epidemics on networks: if p is the transmissibility of a disease along each contact, a large-scale outbreak is possible exactly when the infectable contacts percolate — the epidemic threshold is a percolation threshold.
- Network robustness: randomly removing nodes or links from a network is bond/site percolation in reverse; the giant component collapses once enough are gone, which is how one reasons about the resilience of power grids and the internet.
- Everyday: water finding a channel through coffee grounds; gelation, where polymer strands cross-link until one molecule spans the whole pot and it sets.
Try this
- Start with p around 0.50 and drag it slowly upward. Find the density where connection snaps on — a spanning cluster lights up white — and notice how close it is to ~0.59.
- Sit right at p ≈ p_c and hit randomize a few times. You'll see clusters of every size, from single sites to a sprawling fractal — the scale-free signature of criticality.
- Compare p = 0.55 and p = 0.62. A change of just 0.07 in density flips the system from "all small islands" to "reliably spanned."
- Switch to Sweep mode and watch the giant cluster appear and vanish as p oscillates across the threshold.
References
- Broadbent, S. R. & Hammersley, J. M. (1957). "Percolation processes I. Crystals and mazes." Mathematical Proceedings of the Cambridge Philosophical Society 53(3), 629–641. (Origin of the model.)
- Stauffer, D. & Aharony, A. (1994). Introduction to Percolation Theory, 2nd ed. Taylor & Francis. (Standard reference for thresholds, scaling, and universality.)
- Square-lattice site percolation threshold p_c ≈ 0.5927 (high-precision numerical estimate); for comparison, square-lattice bond percolation p_c = 1/2 exactly (Kesten, 1980).
- Grimmett, G. (1999). Percolation, 2nd ed. Springer. (Rigorous mathematical treatment.)