# Bottleneck distance user manual¶

## Definition¶

Author: François Godi
Introduced in: GUDHI 2.0.0
Requires: CGAL $$\geq$$ 4.8.0

 Bottleneck distance is the length of the longest edge Bottleneck distance measures the similarity between two persistence diagrams. It’s the shortest distance b for which there exists a perfect matching between the points of the two diagrams (+ all the diagonal points) such that any couple of matched points are at distance at most b. Bottleneck distance user manual

## Function¶

gudhi.bottleneck_distance()

This function returns the point corresponding to a given vertex.

Parameters: diagram_1 (vector[pair[double, double]]) – The first diagram. diagram_2 (vector[pair[double, double]]) – The second diagram. e (float) – 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. float the bottleneck distance.

## Basic example¶

This example computes the bottleneck distance from 2 persistence diagrams:

import gudhi

diag1 = [[2.7, 3.7],[9.6, 14.],[34.2, 34.974], [3.,float('Inf')]]
diag2 = [[2.8, 4.45],[9.5, 14.1],[3.2,float('Inf')]]

message = "Bottleneck distance approximation=" + '%.2f' % gudhi.bottleneck_distance(diag1, diag2, 0.1)
print(message)

message = "Bottleneck distance value=" + '%.2f' % gudhi.bottleneck_distance(diag1, diag2)
print(message)


The output is:

Bottleneck distance approximation=0.81
Bottleneck distance value=0.75