Function vietoris_rips_h0

Source
pub fn vietoris_rips_h0(points: &[&[f32]]) -> PersistenceDiagram
Expand description

Compute Vietoris-Rips persistent homology (dimension 0 only).

Dimension 0 (connected components) tracks how clusters merge as the filtration radius grows. This is equivalent to single-linkage clustering.

§Algorithm

  1. Compute pairwise distance matrix.
  2. Sort edges by distance (Kruskal’s algorithm).
  3. Use Union-Find to track component merges.
  4. Each merge creates a death event for the younger component.

§Complexity

O(N² log N) for N points (dominated by sorting N² edges).

For region centroids (N~80), this is ~6,400 edges — instant.