% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ph_distances.R
\name{bottleneck_distance}
\alias{bottleneck_distance}
\title{Bottleneck Distance Between Persistence Diagrams}
\usage{
bottleneck_distance(d1, d2, dimension = NULL, tol = .Machine$double.eps^0.5)
}
\arguments{
\item{d1, d2}{\code{persistent_homology} objects, or data.frames with
columns \code{dimension}, \code{birth}, \code{death}.}

\item{dimension}{Integer vector of dimensions to compare. \code{NULL}
(default) compares all dimensions appearing in either diagram and
returns a named numeric vector.}

\item{tol}{Numerical tolerance for binary search (default
\code{.Machine$double.eps ^ 0.5}).}
}
\value{
Named numeric vector. Names are \code{"dim_<k>"}. \code{Inf}
indicates a structural mismatch (different essential counts in that
dimension); a self-distance is always 0.
}
\description{
Computes the bottleneck distance between two persistence diagrams. For
finite pairs, the bottleneck distance is
\deqn{W_\infty(D_1, D_2) = \inf_{\gamma} \sup_{p \in D_1} \|p - \gamma(p)\|_\infty,}
where \eqn{\gamma} ranges over bijections \eqn{D_1 \cup \Delta \to
D_2 \cup \Delta} and \eqn{\Delta = \{(x,x)\}} is the diagonal. Each
point may match a point in the other diagram or its projection onto
the diagonal at cost \eqn{|d - b|/2}. Computed via binary search on
\eqn{\varepsilon} plus a Kuhn bipartite-matching feasibility check.

Essential classes (death = Inf in VR mode, or death = 0 in clique mode)
are matched one-to-one within each dimension. If the diagrams have
different numbers of essential classes in some dimension, the
bottleneck distance for that dimension is \code{Inf}.
}
\examples{
mat1 <- matrix(c(0, .6, .5, .6, 0, .4, .5, .4, 0), 3, 3)
rownames(mat1) <- colnames(mat1) <- c("A","B","C")
ph1 <- persistent_homology(mat1, n_steps = 5)
bottleneck_distance(ph1, ph1)  # self-distance is 0

}
\references{
Edelsbrunner, H. & Harer, J. (2010). \emph{Computational Topology: An
Introduction}. AMS. Section VIII.
}
