About Percolation Theory
This simulation models site and bond percolation on a 2D square lattice. In site mode each cell is independently occupied with probability p; in bond mode each edge between neighbours opens with probability p. Connected clusters are identified using a union-find algorithm with path compression and union by rank, and the model tests whether any single cluster spans from the top row to the bottom row of the grid.
The sliders set the occupation probability p (0 to 1) and the grid size N (20 to 200), while buttons switch between Site and Bond, draw a fresh random sample, or sweep p across its full range to plot the spanning transition. As p crosses the critical threshold p_c, finite clusters merge into one giant spanning cluster. The same mathematics describes oil flow through porous rock, forest-fire spread, epidemics on networks, and conductivity of random resistor lattices.
Frequently Asked Questions
What is percolation theory?
Percolation theory studies how connectivity emerges in random systems. On a lattice, each site or bond is open with probability p, and the central question is whether open elements link together to form a path that spans the whole structure. It is a foundational model of random connectivity and phase transitions.
What does the simulation actually show?
It draws a 2D grid where occupied sites (or open bonds) are coloured by the cluster they belong to. A spanning cluster connecting the top and bottom edges is highlighted in green. The side panel reports p, the occupied count, the number of clusters, the largest cluster size, and whether the lattice currently spans.
What is the critical threshold p_c?
p_c is the probability at which a spanning cluster first appears in the infinite-lattice limit. For site percolation on a square lattice it is approximately 0.5927, and for bond percolation on the same lattice it is exactly 0.5. Below p_c only finite clusters exist; above it a giant spanning cluster appears.
How does the union-find clustering work?
Each occupied site starts as its own cluster. The algorithm scans the grid, and whenever two neighbouring occupied sites are found it merges their clusters using union by rank. Path compression flattens the tree on each lookup, so finding which cluster a site belongs to is almost constant time. This is the basis of the Hoshen-Kopelman labelling method.
What is the difference between site and bond percolation?
In site percolation the cells themselves are randomly occupied, and two occupied cells are connected only if they are adjacent. In bond percolation every cell is present but the edges connecting neighbours are randomly open. Both show a sharp percolation transition, but the critical thresholds differ: roughly 0.5927 for sites and 0.5 for bonds on the square lattice.
What do the controls do?
The probability slider sets p from 0 to 1, the grid-size slider sets N from 20 to 200. The Site and Bond buttons switch lattice type, New Sample regenerates a fresh random configuration at the current p, and Sweep p steps p across the full range to plot spanning outcomes on the small chart below the grid.
Why is the transition called a phase transition?
As p increases through p_c the system changes abruptly from having only small finite clusters to containing one cluster that spans the lattice. This sudden, qualitative change in macroscopic connectivity is a second-order phase transition, mathematically analogous to spontaneous magnetisation appearing in the Ising model as temperature falls.
Why is the cluster at p_c a fractal?
Exactly at p_c the spanning cluster has no characteristic length scale: it contains holes and tendrils at every size. Its mass grows with system size as a non-integer power, with fractal dimension about 1.896 in two dimensions, rather than scaling as area would for a solid region.
Is the simulation physically accurate?
The model is a faithful implementation of standard 2D percolation: independent random occupation and exact union-find connectivity. Because the grid is finite (N up to 200), the apparent threshold is slightly blurred and varies between samples; the sharp p_c of about 0.5927 is the limit reached only on an infinitely large lattice.
What real-world systems does percolation describe?
Percolation underlies oil and water flow through porous rock, the spread of forest fires where each tree ignites neighbours with probability p, disease transmission across contact networks, gelation of polymers, and the conductivity of random resistor and conductor mixtures. Many such systems share the same critical behaviour through the universality hypothesis.