Hoshen–Kopelman cluster labeling
Eight checked steps in a Python notebook.
We first write a small part of a calculation and test it. Once we understand the result, we add the next part. These lessons follow that approach rather than beginning with a complete program and asking students to understand everything at once.
We first explain what we want to calculate and define the quantities. We write a small code cell, then compare its result with a known answer. If the check fails, we examine that part before adding the next operation. Each Python lesson retains the complete calculation for comparison. The notebook cells follow this sequence.
Download the Python notebook collection
The Python notebook collection includes the color portrait, all five portrait programs, full diffusion and random-walk examples, binary spinodal simulation, topology, full-resolution 3D algorithms and native VPython viewers. The pages show explained code cells and their measured outputs. The short lessons below provide a smaller starting point.
If you would like a similar tutorial in Julia or C, email me with the lesson title and your intended use. I can share a Google Colab notebook with step-by-step explanations and worked examples.
Email: saswata_at_msme.iith.ac.in (replace _at_ with @).
Eight checked steps in a Python notebook.
Grid, initial profile, one Fourier propagation and an analytical check, in a Python notebook.
One molecular step, repeated sweeps and a mean-square-displacement check, in a Python notebook.
One conserved update, a separate elastic kernel and short matched evolutions, in a Python notebook.
Periodic neighbors, local energy change, acceptance and repeated trials, in a Python notebook.
Seven NumPy steps and a direct-sum reference check.
Our NumPy code, from initial composition through a checked polynomial free energy and a coupled Fourier update on a 256 × 256 grid.
The following resources develop their calculations through notebook cells. The elasticity pages retain worked snippets; complete solver notebooks require a separate code request.
The 256³ spinodal example, topology playground and NRCM C examples provide simulations and explanations. Complete research implementations and historical source archives require a separate code request. The short lessons above do not replace those models or their measured results.