Fill a random grid where each site is independently open with probability p. At the critical threshold pc ≈ 0.5927 a spanning cluster connecting top to bottom first appears — this is a continuous (second-order) phase transition studied in statistical physics.
pc ≈ 0.5927 (2D square lattice, site percolation)
D = 91/48 ≈ 1.896 (fractal dimension at criticality)
τ = 187/91 ≈ 2.055 (cluster-size exponent: n(s) ~ s^{-τ})
ν = 4/3 (correlation-length exponent)
β = 5/36 (order-parameter exponent)
The critical exponents of 2D percolation were proven rigorously by Smirnov (Fields Medal 2010) using conformal invariance and SLE (Schramm–Loewner Evolution). The fractal cluster at pc has the same geometry on any 2D lattice — a property called universality.
Percolation theory studies how connected paths form through random media. In site percolation, each cell on a grid is independently declared 'open' with probability p. When p crosses a critical threshold pc, an infinite spanning cluster appears — a classic continuous phase transition.
For site percolation on a 2D square lattice pc ≈ 0.5927. Below this value all clusters are finite; above it a giant spanning cluster emerges with probability approaching 1 as grid size increases.
A spanning cluster is a connected component of open sites that bridges the grid from the top row to the bottom row. Its first appearance at pc marks the percolation phase transition, analogous to liquid freezing or a magnet forming.
Union-Find groups sites into connected components. Each new open site is unioned with its open neighbours. With path compression and union by rank, each operation runs in nearly O(1) amortised time — making it far faster than flood-fill for large grids.
Exactly at p = pc the spanning cluster is a fractal with Hausdorff dimension D = 91/48 ≈ 1.896 in 2D. This means if you measure the cluster's "mass" (number of sites) inside a circle of radius r, it scales as r^D rather than r^2.
In site percolation each vertex is independently open with probability p. In bond percolation each edge (link between neighbours) is open with probability p. Both have phase transitions, but at different thresholds: for bond percolation on a square lattice pc = 0.5 exactly, due to a self-duality symmetry.
At the critical point correlations extend to all length scales, producing scale-free behaviour. The probability that a site belongs to a cluster of size s follows n(s) ~ s^(-τ) with τ = 187/91 ≈ 2.055 in 2D. On a log-log histogram this appears as a straight line — visible in this simulation at p ≈ 0.593.
Percolation models fluid flow through porous rock, electrical conductivity in composite materials, forest-fire spread, epidemic spreading on contact networks, and quantum tunnelling in disordered media. The phase transition maps to a critical point in each system.
On a finite L×L grid the transition is smeared over a width ~L^(-1/ν) around pc, where ν = 4/3. Larger grids produce sharper transitions. This is why small simulations show apparent thresholds scattered around the true pc, and why the histogram power law is only clean on large grids.
Universality means critical exponents (D, τ, ν, β) depend only on the spatial dimension, not microscopic lattice details. All 2D percolation models — square, triangular, honeycomb, site or bond — share the same exponents, forming one universality class. This was proven rigorously by Smirnov using Schramm-Loewner Evolution.
This simulation runs site percolation on a 2D square lattice: every cell in an N×N grid is independently marked "open" with probability p, and a Union-Find (disjoint-set) structure with path halving and union by rank links each open cell to its open neighbours in near-constant time. Two virtual nodes are wired to the top and bottom rows, so the code can instantly test whether the top and bottom are connected — the definition of a spanning cluster. The default p = 0.593 sits right at the known critical threshold p_c ≈ 0.5927 for this lattice, where a spanning cluster first appears with high probability. Clusters are colour-coded by their Union-Find root, and a live histogram tracks the distribution of cluster sizes.
An N×N grid (default 60×60) where each cell opens independently with probability p. Open cells are merged into clusters via Union-Find, coloured by cluster root, and the spanning cluster — one that bridges the top row to the bottom row through the virtual-node trick — is highlighted in red with an on-screen alert. The mini histogram shows how cluster sizes are distributed for the current p.
Drag the Grid size (N) slider (20–120) to change lattice resolution, and the Open probability (p) slider (0–1, default 0.593) to move through the phase transition. Watch the Clusters and Largest cluster readouts, and the red "spanning cluster found" badge that appears once p crosses the critical value. Use Reset to redraw a fresh random grid at the current p, or Sweep to auto-animate p from 0 to 1 and back, watching the transition happen live.
The 2D critical exponents — fractal dimension D = 91/48 ≈ 1.896, cluster-size exponent τ = 187/91 ≈ 2.055, and correlation-length exponent ν = 4/3 — were proven rigorously by Stanislav Smirnov using conformal invariance and Schramm–Loewner Evolution, work that contributed to his 2010 Fields Medal. These exponents are universal: they are the same for square, triangular, or honeycomb lattices.
It implements site percolation on a 2D square lattice. Each of the N×N grid cells is independently opened with probability p (rather than bond percolation, where edges rather than cells are randomly opened), and connectivity between open neighbouring cells is tracked with a Union-Find structure.
The p slider defaults to 0.593 because that is the numerically established critical threshold p_c ≈ 0.5927 for site percolation on an infinite 2D square lattice. Below p_c, clusters stay finite as the grid grows; at and above p_c a giant spanning cluster connecting top to bottom appears with probability approaching 1.
The simulation adds two virtual nodes to the Union-Find structure: every open cell in the top row is unioned with a virtual "top" node, and every open cell in the bottom row is unioned with a virtual "bottom" node. After building all the grid connections, it simply checks whether the virtual top and virtual bottom nodes share the same root — if so, a spanning cluster exists, and it is highlighted in red.
Union-Find (disjoint-set) with path halving and union by rank runs each find/union operation in near-constant amortised time, which scales much better than repeated flood-fill searches when clusters need to be merged incrementally as the grid is built. This makes it practical to rebuild large N×N grids instantly whenever N or p changes.
Exactly at p = p_c, the spanning cluster is a fractal with Hausdorff dimension D = 91/48 ≈ 1.896 — its "mass" scales as radius^D rather than radius^2. The cluster-size distribution follows a power law n(s) ~ s^(-τ) with τ = 187/91 ≈ 2.055, visible as a straight line on a log-log histogram. Both exponents are universal across all 2D lattice types.
Заповніть випадкову сітку, де кожен вузол незалежно відкритий з імовірністю p. При критичному порозі pc ≈ 0.5927 вперше з'являється охоплюючий кластер, що з'єднує верх з низом — це неперервний (другого роду) фазовий перехід, що вивчається у статистичній фізиці.
pc ≈ 0.5927 (2D квадратна сітка, вузлова перколяція)
D = 91/48 ≈ 1.896 (фрактальна розмірність при критичності)
τ = 187/91 ≈ 2.055 (показник розміру кластера: n(s) ~ s^{-τ})
ν = 4/3 (показник кореляційної довжини)
β = 5/36 (показник параметра порядку)
Критичні показники 2D перколяції були доведені суворо Смірновим (Медаль Філдса 2010) за допомогою конформної інваріантності та SLE (еволюція Шрама–Льовнера). Фрактальний кластер при pc має однакову геометрію на будь-якій 2D сітці — явище, зване універсальністю.
Теорія перколяції вивчає, як утворюються зв'язані шляхи через випадкове середовище. У вузловій перколяції кожна клітинка сітки незалежно є «відкритою» з імовірністю p. Коли p перевищує критичний поріг pc, з'являється нескінченний охоплюючий кластер — класичний неперервний фазовий перехід.
Для вузлової перколяції на 2D квадратній сітці pc ≈ 0.5927. Нижче цього значення всі кластери залишаються скінченними; вище нього гігантський охоплюючий кластер виникає з імовірністю, що наближається до 1 зі зростанням розміру сітки.
Охоплюючий кластер — зв'язана компонента відкритих вузлів, що з'єднує верхній рядок сітки з нижнім. Його перша поява при pc відповідає фазовому переходу, аналогічно до замерзання рідини або намагнічування матеріалу.
Union-Find (Система непересічних множин) ефективно групує вузли у зв'язані компоненти. Коли відкривається новий вузол, він об'єднується з відкритими сусідами. Зі стисненням шляху та об'єднанням за рангом кожна операція виконується за майже O(1) амортизованого часу — значно швидше за обхід у ширину для великих сіток.
Саме при p = pc охоплюючий кластер є фракталом з гаусдорфовою розмірністю D = 91/48 ≈ 1.896 у 2D. Це означає, що якщо виміряти «масу» (кількість вузлів) кластера всередині кола радіуса r, вона масштабується як r^D, а не r^2, як для суцільного диска.
У вузловій перколяції кожна вершина незалежно відкрита з імовірністю p. У зв'язковій перколяції кожне ребро між сусідами відкрите з імовірністю p. Обидві мають фазові переходи, але при різних порогах: для зв'язкової перколяції на квадратній сітці pc = 0.5 точно завдяки симетрії самодуальності.
У критичній точці кореляції поширюються на всі масштаби, що породжує безмасштабну поведінку. Імовірність того, що вузол належить кластеру розміру s, підпорядковується n(s) ~ s^(-τ) при τ = 187/91 ≈ 2.055 у 2D. На логарифмічній гістограмі це видно як пряма лінія — помітна у симуляції при p ≈ 0.593.
Перколяція моделює протікання рідини через пористу породу, електропровідність у композитних матеріалах, поширення лісових пожеж, розповсюдження епідемій по мережах контактів та квантове тунелювання у невпорядкованих середовищах. Фазовий перехід відповідає критичній точці у кожній з цих систем.
На скінченній L×L сітці перехід розмитий у смузі ~L^(-1/ν) навколо pc, де ν = 4/3 — показник кореляційної довжини. Більші сітки дають чіткіші переходи. Саме тому симуляції на малих сітках показують удавані пороги, що розсіяні навколо справжнього pc, а степеневий закон гістограми чіткий лише на великих сітках.
Універсальність означає, що критичні показники (D, τ, ν, β) залежать лише від просторової вимірності, а не від мікроскопічних деталей сітки. Усі 2D моделі перколяції — квадратна, трикутна, стільникова, вузлова чи зв'язкова — мають ті самі показники, утворюючи один клас універсальності. Це було доведено суворо Смірновим за допомогою SLE.