 Bottleneck distance

Classes

struct  Gudhi::persistence_diagram::DiagramPoint
Concept of point in a persistence diagram. std::get<0>(point) must return the birth of the corresponding component and std::get<1>(point) its death. Both should be convertible to double. A valid implementation of this concept is std::pair<double,double>. Death should be larger than birth, death can be std::numeric_limits<double>::infinity() for components which stay alive. More...

struct  Gudhi::persistence_diagram::PersistenceDiagram
Concept of persistence diagram. It is a range of DiagramPoint. std::begin(diagram) and std::end(diagram) must return corresponding iterators. More...

Functions

template<typename Persistence_diagram1 , typename Persistence_diagram2 >
double Gudhi::persistence_diagram::bottleneck_distance (const Persistence_diagram1 &diag1, const Persistence_diagram2 &diag2, double e=(std::numeric_limits< double >::min)())
Function to compute the Bottleneck distance between two persistence diagrams. More...

Definition

The bottleneck distance measures the similarity between two persistence diagrams. It is the shortest distance b for which there exists a perfect matching between the points of the two diagrams (completed with all the points on the diagonal in order to ignore cardinality mismatchs) such that any couple of matched points are at distance at most b, where the distance between points is the sup norm in $$\mathbb{R}^2$$ (not the Euclidean distance). On this picture, the red edges represent the matching. The bottleneck distance is the length of the longest edge.

This implementation is based on ideas from "Geometry Helps in Bottleneck Matching and Related Problems" . Another relevant publication, although it was not used is "Geometry Helps to Compare Persistence Diagrams" .

Distance computation

The following example explains how the distance is computed:

#include <gudhi/Bottleneck.h>
#include <iostream>
#include <vector>
#include <utility> // for pair
int main() {
std::vector< std::pair<double, double> > diag1, diag2;
diag1.emplace_back(0., 0.);
diag2.emplace_back(0., 13.);
std::cout << "Bottleneck distance = " << b << std::endl;
}
Bottleneck distance = 6.5 The point (0, 13) is at distance 6.5 from the diagonal and more specifically from the point (6.5, 6.5)

Basic example

This other example computes the bottleneck distance from 2 persistence diagrams:

#include <gudhi/Bottleneck.h>
#include <iostream>
#include <vector>
#include <utility> // for pair
#include <limits> // for numeric_limits
int main() {
std::vector< std::pair<double, double> > v1, v2;
v1.emplace_back(2.7, 3.7);
v1.emplace_back(9.6, 14.);
v1.emplace_back(34.2, 34.974);
v1.emplace_back(3., std::numeric_limits<double>::infinity());
v2.emplace_back(2.8, 4.45);
v2.emplace_back(9.5, 14.1);
v2.emplace_back(3.2, std::numeric_limits<double>::infinity());
std::cout << "Bottleneck distance = " << b << std::endl;
std::cout << "Approx bottleneck distance = " << b << std::endl;
}
Bottleneck distance = 0.75
Approx bottleneck distance = 0.808176

◆ bottleneck_distance()

template<typename Persistence_diagram1 , typename Persistence_diagram2 >
 double Gudhi::persistence_diagram::bottleneck_distance ( const Persistence_diagram1 & diag1, const Persistence_diagram2 & diag2, double e = (std::numeric_limits::min)() )

Function to compute the Bottleneck distance between two persistence diagrams.

Template Parameters
 Persistence_diagram1,Persistence_diagram2 models of the concept PersistenceDiagram.
Parameters
 [in] diag1 The first persistence diagram. [in] diag2 The second persistence diagram. [in] e If e is 0, this uses an expensive algorithm to compute the exact distance. If e is not 0, it asks for an additive e-approximation, and currently also allows a small multiplicative error (the last 2 or 3 bits of the mantissa may be wrong). This version of the algorithm takes advantage of the limited precision of double and is usually a lot faster to compute, whatever the value of e. Thus, by default, e is the smallest positive double.
Examples:
Bottleneck_distance/alpha_rips_persistence_bottleneck_distance.cpp, Bottleneck_distance/bottleneck_basic_example.cpp, and Bottleneck_distance/bottleneck_distance.cpp.
 GUDHI  Version 3.0.0  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : MIT Generated on Tue Sep 24 2019 09:57:51 for GUDHI by Doxygen 1.8.13