Basics
PersistenceDiagrams.PersistenceInterval — TypePersistenceIntervalType for representing persistence intervals. It behaves exactly like a Tuple{Float64, Float64}, but can have meta data attached to it. The metadata is accessible with getproperty or the dot syntax.
Example
julia> interval = PersistenceInterval(1, Inf; meta1=:a, meta2=:b)
[1.0, ∞) with:
 meta1: Symbol
 meta2: Symbol
julia> birth(interval), death(interval), persistence(interval)
(1.0, Inf, Inf)
julia> isfinite(interval)
false
julia> propertynames(interval)
(:birth, :death, :meta1, :meta2)
julia> interval.meta1
:aPersistenceDiagrams.birth — Functionbirth(interval)Get the birth time of interval.
PersistenceDiagrams.death — Functiondeath(interval)Get the death time of interval.
PersistenceDiagrams.persistence — Functionpersistence(interval)Get the persistence of interval, which is equal to death - birth.
PersistenceDiagrams.midlife — Functionmidlife(interval)Get the midlife of the interval, which is equal to (birth + death) / 2.
PersistenceDiagrams.representative — Functionrepresentative(interval::PersistenceInterval)Get the representative (co)cycle attached to interval, if it has one.
PersistenceDiagrams.birth_simplex — Functionbirth_simplex(interval::PersistenceInterval)Get the critical birth simplex of interval, if it has one.
PersistenceDiagrams.death_simplex — Functiondeath_simplex(interval::PersistenceInterval)Get the critical death simplex of interval, if it has one.
An infinite interval's death simplex is nothing.
PersistenceDiagrams.PersistenceDiagram — TypePersistenceDiagram <: AbstractVector{PersistenceInterval}Type for representing persistence diagrams. Behaves exactly like a vector of PersistenceIntervals, but can have additional metadata attached to it. It supports pretty printing and plotting.
Can be used as a table with any function that uses the Tables.jl interface. Note that using it as a table will only keep interval endpoints and the dim and threshold attributes.
Example
julia> diagram = PersistenceDiagram([(1, 3), (3, 4), (1, Inf)]; dim=1, custom_metadata=:a)
3-element 1-dimensional PersistenceDiagram:
 [1.0, 3.0)
 [3.0, 4.0)
 [1.0, ∞)
julia> diagram[1]
[1.0, 3.0)
julia> sort(diagram; by=persistence, rev=true)
3-element 1-dimensional PersistenceDiagram:
 [1.0, ∞)
 [1.0, 3.0)
 [3.0, 4.0)
julia> propertynames(diagram)
(:intervals, :dim, :custom_metadata)
julia> dim(diagram)
1
julia> diagram.custom_metadata
:aPersistenceDiagrams.barcode — Methodbarcode(diagram)Plot the barcode plot of persistence diagram or multiple diagrams in a collection. The infinity keyword argument determines where the infinity line is placed. If unset, the function tries to use threshold(diagram), or guess a good position to place the line at.