Home▸Physics & Mechanics▸Percolation — Clusters & Critical Threshold (2D)

Percolation — Clusters & Critical Threshold (2D)

2D percolation lab: fill an N×N grid with open sites at probability p, track connected clusters with a union-find structure, and watch the spanning cluster appear right at the critical threshold pc ≈ 0.593.

Physics & Mechanics2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-percolation-threshold ↗ Open standalone

This 2D companion runs the identical site-percolation algorithm as the 3D version — a random N×N grid unioned into clusters with path-compressed, rank-balanced Union-Find and a virtual top/bottom node pair that detects a spanning cluster — but renders it as a flat, readable Canvas 2D grid instead of a WebGL texture. Drag the p slider through pc ≈ 0.593 to watch isolated clusters snap together into one giant spanning cluster (highlighted in red), track the order parameter P∞ and cluster count live, and read the cluster-size histogram flatten toward a power law right at criticality.

⚙ Under the hood

2D percolation lab with an N×N grid, path-compressed union-find clustering, a virtual top/bottom node pair for spanning-cluster detection, and a live log-log cluster-size histogram.

percolationcritical thresholdunion-findphase transitionspanning clusterCanvas 2D

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)