Percolation Threshold
Each site on a square lattice is occupied with probability p. Above the critical threshold pc ≈ 0.5927, a giant connected cluster spans the entire lattice. The spanning cluster is highlighted in gold.
About this lab
Percolation theory models the flow of fluids through porous media, the spread of disease through populations, and the connectivity of networks. In site percolation on a square lattice, each site is independently occupied with probability p. The key question is: does a connected path of occupied sites span the lattice from top to bottom?
Below the critical threshold pc ≈ 0.5927, all clusters are finite and no spanning path exists. Above pc, a single giant connected component appears that spans the entire lattice. At pc exactly, the system is at a second-order phase transition: the spanning cluster has fractal dimension approximately 1.896, correlation lengths diverge, and the system shows scale-invariant structure.
This simulation uses union-find (disjoint set union) to efficiently identify clusters. The spanning cluster, if one exists, is highlighted in gold. The cluster-finding algorithm runs in nearly linear time thanks to path compression and union by rank.