Title: | Gromov-Hausdorff Type Distances for Labeled Metric Spaces |
---|---|
Description: | Computes Gromov-Hausdorff type l^p distances for labeled metric spaces. These distances were introduced in V.Liebscher, Gromov meets Phylogenetics - new Animals for the Zoo of Metrics on Tree Space <arXiv:1504.05795> for phylogenetic trees, but may apply to a diversity of scenarios. |
Authors: | Volkmar Liebscher |
Maintainer: | Volkmar Liebscher <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.8-3 |
Built: | 2025-03-03 06:34:24 UTC |
Source: | https://github.com/cran/gromovlab |
The function gromovdist
calculates the matched Gromov- distances of two metrics on a finite space
:
There, the infimum is taken over all isometric embeddings of
,
of
into a common metric space
. Only
is considered.
At the basis is the reformulation of the metric as value of a convex program, see Liebscher (2015).
Methods for various classes are provided:
dist,dissimilarity
which are distance matrices.
matrix
for matrices containing the individual distances of the elements of .
igraph
for connected graphs. The metric on the nodes or just the leaves (nodes of degree 1) of the graph is the length of the shortest path.
phylo
for phylogenetic trees. Again the metric is induced by the graph.
gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'list' gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'multiPhylo' gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'phylo' gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'dist' gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'dissimilarity' gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'matrix' gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'igraph' gromovdist(d1,d2=NULL,type="l1",p=NULL,leavesonly=TRUE,...)
gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'list' gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'multiPhylo' gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'phylo' gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'dist' gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'dissimilarity' gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'matrix' gromovdist(d1,d2=NULL,type="l1",p=NULL,...) ## S3 method for class 'igraph' gromovdist(d1,d2=NULL,type="l1",p=NULL,leavesonly=TRUE,...)
type |
type of metric to use |
d1 , d2
|
distance object(s). |
p |
if |
leavesonly |
compute the distances between the leaves of the graph/tree only? |
... |
further parameters |
type="l1"
yields
type="l2"
yields
type="linfinity"
yields
type="lp"
is for (not so efficient) computation using constrOptim for arbitrary
If d1
is a list, the distance matrix between all elements of the list is computed. It is represented as an object of class dissimiliarity
, see dissimilarity.object.
The distance is only computed for that part of the objects where the labels are present in both objects. If there are no labels the elements are numbered consecutively.
The distance (one numeric) or a distance matrix for the list
and multiPhylo
methods
Volkmar Liebscher
V.Liebscher, Gromov meets Phylogenetics - new Animals for the Zoo of Metrics on Tree Space. preprint 2015 arXiv:1504.05795
dist, dissimilarity.object,phangorn-package, igraph-package,constrOptim.
library("ape") tr1<-rtree(n=10) tr2<-rtree(n=10) gromovdist(tr1,tr2,"l1") gromovdist(tr1,tr2,"l2") #thesame, but slower gromovdist(d1=tr1,d2=tr2,type="lp",p=2) gromovdist(tr1,tr2,"linf")
library("ape") tr1<-rtree(n=10) tr2<-rtree(n=10) gromovdist(tr1,tr2,"l1") gromovdist(tr1,tr2,"l2") #thesame, but slower gromovdist(d1=tr1,d2=tr2,type="lp",p=2) gromovdist(tr1,tr2,"linf")