« All simulations

Percolation

Each cell of a square lattice is independently occupied with probability p. Below a critical p the occupied cells form only small, isolated clusters; above it a single cluster suddenly spans the whole system. Watch the giant cluster appear as you sweep p across the percolation threshold (~0.5927 for site percolation on a square lattice).

How it works

Press Start to run a repeated sweep over p. Each cycle draws one random field for the whole lattice and visits every p on a fixed grid, labelling clusters with union-find; the four graphs average over all cycles and converge as it runs. The lattice shown is sampled at exactly the p you set (slider or type a value) — the red cluster, when present, is the one spanning top to bottom. Larger lattices sharpen the transition near pc ≈ 0.5927 (dotted red line) but cost more per frame.

Graphs: (a) mean finite cluster size S(p); (b) cluster-size distribution ns at the displayed p (log-log, ~power law at pc); (c) percolation strength P(p), the fraction of sites in the spanning cluster; (d) spanning probability Π(p), the fraction of sampled states that percolate.