% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Distance.R
\name{wasserstein_distance}
\alias{wasserstein_distance}
\title{Wasserstein distance between two persistence diagrams}
\usage{
wasserstein_distance(df1, df2, dimension = 0, p = 2, ground = c("L2", "Linf"))
}
\arguments{
\item{df1, df2}{Persistence diagram data frames with columns \code{dim},
\code{birth}, \code{death} (e.g. the output of
\code{extract_persistence_pairs()} or \code{persistence_pairs()}).}

\item{dimension}{Homological dimension to compare.}

\item{p}{Wasserstein order (\eqn{p \ge 1}). Defaults to \code{2}.}

\item{ground}{Ground metric on the birth-death plane used to measure the
distance between two points (or a point and the diagonal): \code{"L2"}
(Euclidean, default) or \code{"Linf"} (Chebyshev).}
}
\value{
A single non-negative number, the \eqn{p}-Wasserstein distance.
}
\description{
The \eqn{p}-Wasserstein distance between the points of two persistence
diagrams in a given homological dimension, allowing points to be matched
to the diagonal (Cohen-Steiner, Edelsbrunner, Harer and Mileyko (2010),
"Lipschitz Functions Have \eqn{L_p}-Stable Persistence"). Essential
(death = \code{Inf}) classes are kept rather than dropped - see Details.
Computed exactly via the Hungarian algorithm (\code{clue::solve_LSAP}) on
the augmented assignment problem described in
\code{\link{augmented_cost_matrix}}.
}
\examples{
df1 <- data.frame(dim = c(0, 0), birth = c(0, 0), death = c(1, 2))
df2 <- data.frame(dim = c(0, 0), birth = c(0, 0), death = c(1, 3))
wasserstein_distance(df1, df2, dimension = 0, p = 2)
}
