Holes Have to Persist
The most dangerous sentence in data analysis is:
I can see the shape.
Sometimes you can. A scatterplot bends around an empty center. A trajectory looks cyclic. A representation space separates into islands. A sensor trace returns to a loop. But the eye is an impatient topologist. It picks one scale, forgives missing samples, ignores outliers, and promotes a visual impression into a claim.
Persistent homology makes that claim slower.
It says: do not ask whether the point cloud has a hole. Ask when the hole is born, when it dies, and how long it survives while the scale changes.
That shift is small and deep. The object is no longer a picture. It is an experiment over radius.
The Radius Is the Experiment
Start with points (x_1,\ldots,x_n). At radius (r=0), every point is alone. As (r) grows, connect points whose distance is at most (r). Whenever three points are mutually connected, fill in the triangle. Whenever four are mutually connected, the full Vietoris-Rips complex would also include a tetrahedron, and so on.
For this post, the browser lab builds the 2-skeleton:
- vertices,
- edges,
- triangles.
That is enough to compute (H_0), connected components, and (H_1), loops, for the toy point clouds below.
The growing family
\[K_0 \subseteq K_{r_1} \subseteq K_{r_2} \subseteq \cdots\]is a filtration. Edelsbrunner, Letscher, and Zomorodian described persistence as a way to classify topological changes during such growth as features or noise depending on their lifetime.1 That lifetime is the key. A tiny accidental gap may appear at one radius and disappear almost immediately. A real loop should remain alive across a range of radii.
The barcode is the receipt.
birth radius ---------------- death radius
A long bar is not proof that the world truly contains a circle. It is evidence that, under this metric and this filtration, a topological feature survived many scale choices.
What Is Being Counted
The Betti numbers are the small integers behind the picture:
\[\beta_0 = \text{number of connected components}, \qquad \beta_1 = \text{number of independent loops}.\]At small radius, (\beta_0) is large because every point is isolated. As edges appear, components merge and (\beta_0) falls. If the points sit around a ring, there is often a middle band of radii where the graph has closed around the center but triangles have not yet filled the center. During that band, (\beta_1=1).
At larger radius, the same triangles that make the complex less stringy can also kill the loop. The hole was not false because it died. Death is part of the measurement.
Ghrist’s barcode survey frames this as replacing a data set with a family of simplicial complexes indexed by a proximity parameter, then reading global topological objects from that family.2 Carlsson’s “Topology and Data” made the broader case that topology gives data analysis tools for qualitative structure: connectedness, loops, flares, branches, and invariants less tied to coordinates than ordinary geometric summaries.3
The lab is a small version of that program.
The Reduction Algorithm, Briefly
The code does not draw fake bars. It computes them.
For a Vietoris-Rips filtration, each simplex enters at a radius:
- a vertex enters at 0;
- an edge ([i,j]) enters at (d(x_i,x_j));
- a triangle ([i,j,k]) enters when all three of its edges exist, so at (\max(d_{ij}, d_{ik}, d_{jk})).
Sort all simplices by filtration value, with faces before cofaces at ties. Then build the boundary matrix over (\mathbb{F}_2), so addition is xor. A triangle’s boundary is its three edges. An edge’s boundary is its two vertices.
The standard reduction reads columns from left to right:
reduce the current boundary column by earlier columns
if the reduced column is zero:
this simplex births a homology class
else:
its lowest remaining face identifies the class it kills
Zomorodian and Carlsson placed persistent homology in an algebraic framework and derived a natural algorithm for computing interval decompositions over fields, which is the setting used here.4 The browser implementation is deliberately small, but it follows this same face-before-coface filtration and mod-2 boundary reduction idea.
A Barcode Bench
The default point cloud is a noisy ring: 24 points, one outlier, noise level 8%, and selected radius (r=0.28). The lab builds 2324 simplices and computes all finite (H_0) and (H_1) intervals in the 2-skeleton.
The Node audit of the same code reports:
default beta0 at r 1
default beta1 at r 1
longest H1 persistence 0.4137
finite H1 bars 1
simplices 2324
For comparison:
clean ring longest H1 0.4781
figure-eight beta1 at r 2
figure-eight top H1 bars 0.1218, 0.1137
clusters beta0 at r 3
clusters beta1 at r 0
clusters longest H1 0.0445
That last line is the sanity check. Random clustered points can make tiny loops. Persistence does not say “holes never happen by accident.” It says accidental holes tend to be short-lived under the scale experiment.
The implementation computes Vietoris-Rips persistence up to triangles over F2 coefficients. It is sized for inspection in the browser, not for large production TDA workloads.
How to Read It
In the first panel, the chosen radius draws edges and filled triangles. If the edges close a loop before the triangles fill it, the complex has a live (H_1) class.
The barcode panel is the main evidence. Gray (H_0) bars are connected components. Green (H_1) bars are loops. The red vertical line is the selected radius. A feature counts toward the Betti number at that radius if the red line crosses its bar.
The persistence diagram plots birth against death. The diagonal is where features die almost as soon as they are born. Points far above the diagonal have long lifetimes.
The Betti curves show the same information as a time series. A good ring has a middle plateau where (\beta_0=1) and (\beta_1=1). Clusters have a different signature: (\beta_0) stays above one until bridges form, while (\beta_1) usually remains near zero except for small accidental loops.
What to Try
Switch to clusters.
The barcode becomes mostly a story about connected components. A few short (H_1) bars may still appear, because finite samples can form little cycles. They die quickly.
Switch to figure-eight.
There should be two meaningful loops for a band of radii. The two longest (H_1) bars are close in length in the default audit, which is exactly what the two-loop geometry suggests.
Raise Noise.
Noise does not merely jiggle the picture. It changes the birth and death radii. If points fail to bridge around the loop evenly, the loop may be born late. If triangles fill the center early, it may die early.
Raise Outliers.
Outliers stretch (H_0). They can also introduce spurious (H_1) bars by creating accidental polygons with nearby points. Persistence helps, but it does not delete outliers for free.
Move Radius.
This is the most important control. A single radius can make the same point cloud look disconnected, loop-like, or filled in. Persistent homology is the habit of refusing to trust only one of those views.
What This Is Not
Persistent homology is sometimes sold as a machine that finds the true shape of data. That is too strong.
The pipeline makes choices:
- the metric,
- the filtration,
- the coefficient field,
- the sampling density,
- the maximum dimension,
- the numerical threshold for calling a bar meaningful.
Change the metric and the barcode changes. In high-dimensional embedding spaces, Euclidean distance may be an artifact of representation training rather than a faithful geometry. In time-series data, delay coordinates may reveal cycles that raw coordinates hide. In neural activations, a loop may reflect task structure, sampling bias, periodic nuisance variation, or preprocessing.
The barcode is not an oracle. It is a disciplined summary of a scale experiment.
Why ML People Should Care
Machine learning often reduces structure to loss, accuracy, likelihood, or nearest-neighbor statistics. Those are powerful, but they can miss global shape.
Topology asks questions like:
- Did this representation collapse several classes into one connected region?
- Does a latent trajectory loop because the underlying process is periodic?
- Do generated samples cover a manifold or only isolated patches?
- Does an embedding have flares and branches that a cluster count hides?
- Do adversarial or out-of-distribution samples create tunnels in feature space?
The answer is rarely “run persistent homology and believe the longest bar.” The better answer is: use persistence as a stress test for geometry. If a feature appears only at one fragile scale, be suspicious. If it survives across reasonable scales and resampling choices, it becomes harder to dismiss.
This is why the method feels philosophically different from many summaries. It does not choose the scale first. It lets the scale vary, then asks what remains.
Works Cited
The lab exports PersistentHomologyLab and a CommonJS API for Node checks. I
audited the default ring, a clean ring, a noisy ring with outliers, a
figure-eight, clusters, a crescent, and clamped parameter input. The checks
require finite summary values, the requested point count, nontrivial simplex
construction, face-before-coface filtration order, valid birth/death intervals,
and nonnegative Betti numbers.
The default ring has one live loop at (r=0.28). The figure-eight has (\beta_1=2) at (r=0.22). The clusters case has (\beta_0=3) and (\beta_1=0) at (r=0.18). Those are toy examples, but they are useful toy examples: they show the difference between a long-lived hole and a momentary gap.
-
Herbert Edelsbrunner, David Letscher, and Afra Zomorodian, “Topological Persistence and Simplification”, Discrete & Computational Geometry 28, 2002. Springer record: https://link.springer.com/article/10.1007/s00454-002-2885-2. ↩
-
Robert Ghrist, “Barcodes: The persistent topology of data”, Bulletin of the American Mathematical Society 45(1), 2008. ↩
-
Gunnar Carlsson, “Topology and data”, Bulletin of the American Mathematical Society 46(2), 2009. ↩
-
Afra Zomorodian and Gunnar Carlsson, “Computing Persistent Homology”, Discrete & Computational Geometry 33, 2005. ↩