Distances and Matchings

PersistenceDiagrams.BottleneckType
Bottleneck

Use this object to find the bottleneck distance or matching between persistence diagrams. The distance value is equal to

\[W_\infty(X, Y) = \inf_{\eta:X\rightarrow Y} \sup_{x\in X} ||x-\eta(x)||_\infty,\]

where $X$ and $Y$ are the persistence diagrams and $\eta$ is a perfect matching between the intervals. Note the $X$ and $Y$ don't need to have the same number of points, as the diagonal points are considered in the matching as well.

Warning

Computing the bottleneck distance requires $\mathcal{O}(n^2)$ space. Be careful when computing distances between very large diagrams!

Usage

  • Bottleneck()(left, right[; matching=false]): find the bottleneck matching (if matching=true) or distance (if matching=false) between persistence diagrams left and right

Example

julia> left = PersistenceDiagram([(1.0, 2.0), (5.0, 8.0)]);

julia> right = PersistenceDiagram([(1.0, 2.0), (3.0, 4.0), (5.0, 10.0)]);

julia> Bottleneck()(left, right)
2.0

julia> Bottleneck()(left, right; matching=true)
Bottleneck Matching with weight 2.0:
 [5.0, 8.0) => [5.0, 10.0)
source
PersistenceDiagrams.WassersteinType
Wasserstein(q=1)

Use this object to find the Wasserstein distance or matching between persistence diagrams. The distance value is equal to

\[W_q(X,Y)=\left[\inf_{\eta:X\rightarrow Y}\sum_{x\in X}||x-\eta(x)||_\infty^q\right],\]

where $X$ and $Y$ are the persistence diagrams and $\eta$ is a perfect matching between the intervals. Note the $X$ and $Y$ don't need to have the same number of points, as the diagonal points are considered in the matching as well.

Warning

Computing the Wasserstein distance requires $\mathcal{O}(n^2)$ space. Be careful when computing distances between very large diagrams!

Usage

  • Wasserstein(q=1)(left, right[; matching=false]): find the Wasserstein matching (if matching=true) or distance (if matching=false) between persistence diagrams left and right.

Example

julia> left = PersistenceDiagram([(1.0, 2.0), (5.0, 8.0)]);

julia> right = PersistenceDiagram([(1.0, 2.0), (3.0, 4.0), (5.0, 10.0)]);

julia> Wasserstein()(left, right)
3.0

julia> Wasserstein()(left, right; matching=true)
Matching with weight 3.0:
 [1.0, 2.0) => [1.0, 2.0)
 [3.0, 3.0) => [3.0, 4.0)
 [5.0, 8.0) => [5.0, 10.0)
source