This project explores site percolation on a 2D square lattice, focusing on how global connectivity emerges from local randomness.
Unlike classical left-to-right percolation, the simulation tracks connectivity from a fixed central site to the system boundaries, allowing us to study how multiple independent pathways form as the system approaches criticality.
The project includes an interactive Python simulation with real-time visualization and statistics.
Percolation is a minimal model for studying phase transitions in disordered systems. Each site on a lattice is randomly occupied with probability ( p ). As ( p ) increases, the system undergoes a sharp transition at a critical threshold, where large connected clusters suddenly span the system.
This simple idea captures phenomena across physics and beyond, including:
- fluid flow in porous media
- forest fires
- epidemic spreading
- information and knowledge propagation
- emergence of scientific breakthroughs
Near the critical point, small local changes can produce macroscopic effects.
-
Simulates site percolation on a 2D square lattice
-
Starts connectivity from the center of the system
-
Counts how many of the four boundaries (top, bottom, left, right) are connected to the center by an unbroken cluster
-
Repeats the experiment many times to build a distribution of independent pathways
-
Visualizes:
- the occupied lattice and the cluster reachable from the center
- a histogram of boundary connections (0–4)
This allows us to study not just whether percolation occurs, but how many independent pathways emerge near criticality.
- Adjustable lattice size
- Adjustable occupation probability
- Reproducible randomness via seeding
- Single-run and multi-run modes
- Live visualization and cumulative statistics
- Jupyter-friendly interactive interface
- Left panel: occupied sites and the cluster reachable from the center
- Right panel: distribution of how many edges are connected to the center across runs
Near the critical probability, configurations with 1–2 connected edges dominate, reflecting the onset of large-scale connectivity.
- Python 3.9+
- NumPy
- Matplotlib
- ipywidgets (for interactivity)
Optional (recommended for smooth updates):
pip install ipymplOpen the notebook and run all cells:
interactive_percolation()Use the sliders and buttons to:
- run a single realization
- accumulate statistics over many runs
- reset the histogram
- control randomness via the seed
All simulations are fully reproducible:
- Using the same seed and sequence of actions produces identical results
- Multiple runs advance a single random number stream, ensuring statistical independence without duplication
- Probability sweeps to extract a percolation phase diagram
- Finite-size scaling analysis
- Bond percolation
- Counting disjoint paths via max-flow methods
- Animation and GIF export
This project was inspired by the observation that many breakthroughs — in physics and beyond — occur independently and almost simultaneously. Percolation provides a simple framework for understanding how systems become “ready” for global connectivity once enough local prerequisites accumulate.