Computes persistent homology via full boundary-matrix reduction over
\(\mathbb{Z}/2\) (Edelsbrunner, Letscher & Zomorodian 2000). The
returned persistence diagram pairs each k-dimensional homology class
to the simplex whose addition creates it (birth) and the simplex whose
addition destroys it (death). Essential classes - those never killed -
are reported with death = 0 in clique mode (similarity scale,
descending) and death = Inf in VR mode (distance scale, ascending).
Two filtration modes are supported:
type = "clique"Weighted clique filtration. Input is treated as a similarity matrix; high-weight simplices appear early. For each k-simplex \(\sigma\), the filtration value is \(\min_{(i,j) \in \sigma}\,|w(i,j)|\). Thresholds run high to low.
type = "vr"Vietoris-Rips filtration on a non-negative distance matrix. For each k-simplex \(\sigma\), the filtration value is \(\max_{(i,j) \in \sigma}\,d(i,j)\). Thresholds run low to high. Use
max_scaleto cap the filtration diameter.
Arguments
- x
A square matrix,
tna, ornetobject. Fortype = "vr", must be a non-negative distance matrix. Asimplicial_complexcarrying a$filtrationvector (as returned bybuild_simplicial(type = "vr")) is also accepted and is used directly: its stored filtration values are reduced as they are, sotypeis taken from the complex rather than this argument. For theprint()andplot()methods: an object of classpersistent_homology.- n_steps
Number of grid points for the reported Betti curve (default 20). The persistence diagram itself is exact - it does not depend on
n_steps.- max_dim
Maximum simplex dimension to track (default 3).
- type
Filtration:
"clique"(default, similarity-weighted) or"vr"(Vietoris-Rips on distances).- max_scale
For
type = "vr"only: cap on edge length. Edges withd(i,j) > max_scaleare excluded.NULL(default) usesmax(d).- ...
In
plot.persistent_homology(): Ignored. Inprint.persistent_homology(): Additional arguments (unused).- combined
When
TRUE(default), the two panels are stitched side-by-side viagridExtra::arrangeGrob. WhenFALSE, returns a named list (betti_curve,persistence) of ggplots.
Value
A persistent_homology object with:
- betti_curve
Data frame:
threshold,dimension,betti.- persistence
Data frame of birth-death pairs, one row per homology class:
dimension,birth,death,persistence. Sorted by descending persistence. Essential classes are included, withdeath = 0andpersistence = birthin clique mode, anddeath = Inf,persistence = Infin VR mode (the plot method caps those for display only).- thresholds
Numeric vector of grid thresholds.
- mode
Either
"clique"or"vr".
In print.persistent_homology(): The input object, invisibly.
In plot.persistent_homology(): A grid grob (invisibly) when combined = TRUE; a named list of two ggplots when combined = FALSE.
Methods
plot.persistent_homology(): Two panels: Betti curve (threshold vs Betti number) and persistence diagram (birth vs death). Persistence pairs come from full boundary- matrix reduction; essential classes are shown at the filtration boundary (death = 0in clique mode; in VR mode their storeddeath = Infis capped for display at the largest finite value in the diagram or on the threshold grid, so they still render).
References
Edelsbrunner, H., Letscher, D., & Zomorodian, A. (2000). Topological persistence and simplification. In Proceedings of the 41st Annual Symposium on Foundations of Computer Science, 454-463. Journal version: Discrete & Computational Geometry (2002) 28, 511-533.
Examples
mat <- matrix(c(0,.6,.5,.6,0,.4,.5,.4,0), 3, 3)
colnames(mat) <- rownames(mat) <- c("A","B","C")
ph <- persistent_homology(mat, n_steps = 10)
print(ph)
#> Persistent Homology
#> 10 filtration steps [0.6000 → 0.0060]
#> Features: b0: 2 (1 persistent)
#> Longest-lived:
#> b0: 0.6000 → 0.0000 (life: 0.6000)
#> b0: 0.6000 → 0.5000 (life: 0.1000)