 Methodology article
 Open Access
 Published:
Cophenetic metrics for phylogenetic trees, after Sokal and Rohlf
BMC Bioinformatics volume 14, Article number: 3 (2013)
Abstract
Background
Phylogenetic tree comparison metrics are an important tool in the study of evolution, and hence the definition of such metrics is an interesting problem in phylogenetics. In a paper in Taxon fifty years ago, Sokal and Rohlf proposed to measure quantitatively the difference between a pair of phylogenetic trees by first encoding them by means of their halfmatrices of cophenetic values, and then comparing these matrices. This idea has been used several times since then to define dissimilarity measures between phylogenetic trees but, to our knowledge, no proper metric on weighted phylogenetic trees with nested taxa based on this idea has been formally defined and studied yet. Actually, the cophenetic values of pairs of different taxa alone are not enough to single out phylogenetic trees with weighted arcs or nested taxa.
Results
For every (rooted) phylogenetic tree T, let its cophenetic vector φ(T) consist of all pairs of cophenetic values between pairs of taxa in T and all depths of taxa in T. It turns out that these cophenetic vectors single out weighted phylogenetic trees with nested taxa. We then define a family of cophenetic metrics d_{φ,p} by comparing these cophenetic vectors by means of L^{p} norms, and we study, either analytically or numerically, some of their basic properties: neighbors, diameter, distribution, and their rank correlation with each other and with other metrics.
Conclusions
The cophenetic metrics can be safely used on weighted phylogenetic trees with nested taxa and no restriction on degrees, and they can be computed in O(n^{2}) time, where n stands for the number of taxa. The metrics d_{φ,1} and d_{φ,2} have positive skewed distributions, and they show a low rank correlation with the RobinsonFoulds metric and the nodal metrics, and a very high correlation with each other and with the splitted nodal metrics. The diameter of d_{φ,p}, for p\u2a7e1, is in O(n^{(p+2)/p}), and thus for low p they are more discriminative, having a wider range of values.
Background
Many phylogenetic trees published in the literature or included in phylogenetic databases are actually alternative phylogenies for the same sets of organisms, obtained from different datasets or using different evolutionary models or different phylogenetic reconstruction algorithms [1]. This variety of phylogenetic trees makes it necessary to develop methods for measuring their differences [2, Chapter 30]. The comparison of phylogenetic trees is also used to compare phylogenetic trees obtained through numerical algorithms with other types of hierarchical classifications [3, 4], to assess the stability of reconstruction methods [5], and in the comparative analysis of dendrograms and other hierarchical cluster structures [6, 7]. Hence, and since the safest way to quantify the differences between a pair of trees is through a metric, “tree comparison metrics are an important tool in the study of evolution” [8].
Many metrics for the comparison of phylogenetic trees have been proposed so far [2, Chapter 30]. Some of these metrics are edit distances that count how many operations of a given type are necessary to transform one tree into the other. These metrics include the nearestneighbor interchange metric [9] and the subtree pruneandregrafting distance [10]. Other metrics compare a pair of phylogenetic trees through some consensus subtree. This is the case for instance of the MAST distances defined in [1113]. Finally, many metrics for phylogenetic trees are based on the comparison of encodings of the phylogenetic trees, like for instance the RobinsonFoulds metric [14, 15] (which can also be understood as an edit distance), the triples metric [16], the classical nodal metrics for binary phylogenetic trees [5, 8, 1719], and the splitted nodal metrics for arbitrary phylogenetic trees [20]. The advantage of this last kind of metrics is that, unlike the edit and the consensus distances, they are usually computed in low polynomial time.
In an already fifty years old paper [4], Sokal and Rohlf proposed a technique to compare dendrograms (which, in their paper, were equivalent to weighted phylogenetic trees without nested taxa) on the same set of taxa, by encoding them by means of their halfmatrices of cophenetic values, and then comparing these structures. Their method runs as follows. To begin with, they divide the range of depths of internal nodes in the tree into a suitable number of equal intervals and number increasingly these intervals. Then, for each pair of taxa i,j in the tree, they compute their cophenetic value as the class mark of the interval where the depth of their lowest common ancestor lies. Then, to compare two phylogenetic trees, they compare their corresponding halfmatrices of cophenetic values. In that paper, they do it specifically by calculating a correlation coefficient between their entries. Sokal and Rohlf’s paper [4] is quite cited (612 cites according to Google Scholar on July 1, 2012) and their method has been often used to compare hierarchical classifications (see, for instance, [2123]).
Since Sokal and Rohlf’s paper, other papers have compared the halfmatrices of cophenetic values to define dissimilarity measures between phylogenetic trees (see, for instance, [3, 24]), and such halfmatrices have also been used in the socalled “comparative method”, the statistical methods used to make inferences on the evolution of a trait among species from the distribution of other traits: see [25, 26] and [2, Chapter 25]. But, to our knowledge, no proper metric for phylogenetic trees based on cophenetic values has been formally defined and studied in the literature. In this paper we define a new family of metrics for weighted phylogenetic trees with nested taxa based on Sokal and Rohlf’s idea and we study some of their basic properties: neighbors, diameter, distribution, and their rank correlation with each other and with other metrics.
Our approach differs in some minor points with Sokal and Rohlf’s. For instance, we use as the cophenetic value φ(i,j) of a pair of taxa i,j the actual depth of the lowest common ancestor of i and j, instead of class marks, which was done by Sokal and Rohlf because of practical limitations. Moreover, instead of using a correlation coefficient, we define metrics by using L^{p} norms. Finally, we do not restrict ourselves to dendrograms, without internal labeled nodes, but we also allow nested taxa.
There is, however, a main difference between our approach and Sokal and Rohlf’s. We do not only consider the cophenetic values of pairs of taxa, but also the depths of the taxa. We must do so because we want to define a metric, where zero distance means isomorphism, and the cophenetic values of pairs of different taxa alone do not single out even the dendrograms considered by Sokal and Rohlf. That is, two non isomorphic weighted phylogenetic trees without nested taxa on the same set of taxa can have the same vectors of cophenetic values; see Figure 1.
It turns out that the cophenetic vector consisting of all cophenetic values of pairs of taxa and the depths of all taxa characterizes a weighted phylogenetic tree with nested taxa. This fact comes from the well known relationship between cophenetic values and patristic distances. If we denote by δ(i) the depth of a taxon i, by φ(i,j) the cophenetic value of a pair of taxa i,j and by d(i,j) the distance between i and j, then [27]
So, if the depths of the taxa are known, the knowledge of the cophenetic values of pairs of taxa is equivalent to the knowledge of the additive distance defined by the tree. On their turn, the depths and the additive distance single out the unrooted semilabelled weighted tree associated to the phylogenetic tree with the former root labeled with a specific label “root”, and hence the phylogenetic tree itself: cf. Theorem 1.
The fact that cophenetic vectors single out weighted phylogenetic trees with nested taxa can also be deduced from their relationship with splitted path lengths [20]. Recall that the splitted path length ℓ(i, j) is the distance from the lowest common ancestor of i and j to i. It is known [20, Thm. 10] that the matrix (ℓ(i, j))_{i,j} characterizes a weighted phylogenetic tree with nested taxa. Since, obviously,
the cophenetic vector uniquely determines the matrix of splitted path lengths, and hence the tree.^{a}
The vector of cophenetic values of pairs of different taxa is also related to the notion of ultrametric [28, 29]. Indeed, notice that φ satisfies the threepoint condition of ultrametrics: for every taxa i, j, k,
But φ is not an ultrametric, as φ(i, i) = δ(i) ≠ 0. Actually, φ can only be used to define an ultrametric precisely on ultrametric trees, where the depths of all leaves are the same, say Δ. In this case, Δ  φ is the ultrametric defined by the tree. In particular, ultrametric trees can be compared by comparing their vectors of cophenetic values of pairs of different taxa. A similar idea is used in [30] to induce an average genetic distance between populations from the average coancestry coefficient.
We would like to dedicate this paper to the memory of Robert R. Sokal, father of the field of numerical taxonomy and who passed away last April. His ideas permeate biostatistics and computational phylogenetics.
Notations
A rooted tree is a directed finite graph that contains a distinguished node, called the root, from which every node can be reached through exactly one path. A weighted rooted tree is a pair (T, ω) consisting of a rooted tree T = (V, E) and a weight function\omega :E\to {\mathbb{R}}_{>0} that associates to every arc e ∈ E a nonnegative real number ω(e) > 0. We identify every unweighted (that is, where no weight function has been explicitly defined) rooted tree T with the weighted rooted tree (T, ω) with ω the weight 1 constant function.
Let T = (V, E) be a rooted tree. Whenever (u, v) ∈ E, we say that v is a child of u and that u is the parent of v. Two nodes with the same parent are siblings. The nodes without children are the leaves of the tree, and the other nodes (including the root) are called internal. A pendant arc is an arc ending in a leaf. The nodes with exactly one child are called elementary. A tree is binary, or fully resolved, when every internal node has exactly two children.
Whenever there exists a path from a node u to a node v, we shall say that v is a descendant of u and also that u is an ancestor of v, and we shall denote it by v ≼ u; if, moreover, u ≠ v, we shall write v ≺ u. The lowest common ancestor (LCA) of a pair of nodes u, v of a rooted tree T, in symbols [u, v]_{ T }, is the unique common ancestor of them that is a descendant of every other common ancestor of them. Given a node v of a rooted tree T, the subtree of T rooted at v is the subgraph of T induced on the set of descendants of v (including v itself). A rooted subtree is a cherry when it has 2 leaves, a triplet, when it has 3 leaves, and a quartet, when it has 4 leaves.
The distance from a node u to a descendant v of it in a weighted rooted tree T is the sum of the weights of the arcs in the unique path from u to v. In an unweighted rooted tree, this distance is simply the number of arcs in this path. The depth of a node v, in symbols δ_{ T }(v), is the distance from the root to v.
Let S be a nonempty finite set of labels, or taxa. A (weighted) phylogenetic tree on S is a (weighted) rooted tree with some of its nodes bijectively labeled in the set S, including all its leaves and all its elementary nodes except possibly the root (which can be elementary but unlabeled). The reasons why we allow unlabeled elementary roots are that our results are still valid for phylogenetic trees containing them, and that even if we forbid them, we would need in some proofs to use that Theorem 1 below is true for phylogenetic trees containing them. Moreover, it is not uncommon to add an unlabeled elementary root to a phylogenetic tree in some contexts: see, for instance, the phylogenetic trees depicted in Wikipedia’s entry “Phylogenetic tree”.^{b}
In a phylogenetic tree, we shall always identify a labeled node with its taxon. The internal labeled nodes of a phylogenetic tree are called nested taxa. Notice in particular that a phylogenetic tree without nested taxa cannot have elementary nodes other than the root. Although in practice S may be any set of taxa, to fix ideas we shall usually take S = {1, …, n}, with n the number of labeled nodes of the tree, and we shall use the term phylogenetic tree with n taxa to refer to a phylogenetic tree on this set.
Given a set Sof taxa, we shall consider the following spaces of phylogenetic trees:

\mathcal{W}\mathcal{T}\left(S\right), of all weighted phylogenetic trees on S

\mathcal{U}\mathcal{T}\left(S\right), of all unweighted phylogenetic trees on S

\mathcal{T}\left(S\right), of all unweighted phylogenetic trees on S without nested taxa

\mathcal{B}\mathcal{T}\left(S\right), of all binary unweighted phylogenetic trees on S without nested taxa
When S = {1, …, n}, we shall simply write {\mathcal{W}\mathcal{T}}_{n}, {\mathcal{U}\mathcal{T}}_{n}, {\mathcal{T}}_{n}, and {\mathcal{B}\mathcal{T}}_{n}, respectively.
Two phylogenetic trees T and T^{′} on the same set S of taxa are isomorphic when they are isomorphic as directed graphs and the isomorphism sends each labeled node of T to the labeled node with the same label in T^{′}. An isomorphism of weighted phylogenetic trees is also required to preserve arc weights. We shall make the abuse of notation of saying that two isomorphic trees are actually the same, and hence of denoting that two trees T, T^{′} are isomorphic by simply writing T = T^{′}.
Methods
Cophenetic vectors
Let S be henceforth a nonempty set of taxa with S = n, which without any loss of generality we identify with {1, …, n}. Let T\in {\mathcal{W}\mathcal{T}}_{n} be a weighted phylogenetic tree on S. For every pair of different taxa i, j in T, their cophenetic value is the depth of their LCA:
To simplify the notations, we shall often write φ_{ T }(i, i) to denote the depth δ_{ T }(i) of a taxon i.
The cophenetic vector of T is
with its elements lexicographically ordered in (i, j).
Example 1
If T is the unweighted phylogenetic tree in Figure 2, then φ(T) is the vector obtained by lexicographically ordering in (i, j) the elements of Table 1.
The cophenetic vectors single out weighted phylogenetic trees with nested taxa.
Theorem 1
For every T,{T}^{\prime}\in \mathcal{W}\mathcal{T}\left(S\right), if φ(T) = φ(T^{′}), then T = T^{′}.
Proof
Let r be a symbol not belonging to S and let X = S ∪ {r}. Recall that a weighted Xtree is an undirected weighted tree T with set of nodes V endowed with a (non necessarily injective) nodelabeling mapping f : X → V such that f(X) contains all the leaves and all the degree2 nodes in T[31].
For every T\in \mathcal{W}\mathcal{T}\left(S\right), let T^{∗} be the weighted Xtree obtained by considering T as undirected and adding to its former root the label r. Then, the distance {d}_{{T}^{\ast}} on T^{∗} between pairs of labels in X is uniquely determined by φ(T) in the following way:
Now, T^{∗} is singled out by {d}_{{T}^{\ast}}[31, Thm. 7.1.8]. Since T is uniquely determined from T^{∗} and the knowledge of the root (that is the node labeled with r), we deduce that φ(T) singles out T. □
This result implies that the vectors of cophenetic values of pairs of different taxa single out unweighted phylogenetic trees without nested taxa.
Corollary 1
For every T\phantom{\rule{0.3em}{0ex}}\in \phantom{\rule{0.3em}{0ex}}{\mathcal{T}}_{n}, let \stackrel{~}{\phi}\left(T\right)\phantom{\rule{0.3em}{0ex}}=\phantom{\rule{0.3em}{0ex}}\left({\phi}_{T}\right.{\left(\right)separators="">(i,j)}_{}\n \n 1\n \u2a7d\n i\n \n j\n \u2a7d\n n\n \n, with its elements lexicographically ordered in (i, j). Then, for every T,{T}^{\prime}\in {\mathcal{T}}_{n}, if \stackrel{~}{\phi}\left(T\right)=\stackrel{~}{\phi}\left({T}^{\prime}\right), then T=T^{′}.
Proof
If T is unweighted and without nested taxa, then, for every taxon i,
and therefore, in this case, φ(T) is uniquely determined by \stackrel{~}{\phi}\left(T\right). □
But in order to single out phylogenetic trees with non constant weights in the arcs or with nested taxa, it is necessary to take into account also the depths of the leaves. Actually, for example, there is no way to reconstruct from \stackrel{~}{\phi}\left(T\right) the weights of the pendant arcs: the depths of the leaves are needed. Or, without being able to compare depths with cophenetic values, there is no way to say whether a taxon is nested or not. More specifically, for instance, the three trees in Figure 1 have the same value of φ(1, 2), and hence the same vector \stackrel{~}{\phi}\left(T\right), but they are not isomorphic as weighted phylogenetic trees.
The cophenetic vector φ(T) of a weighted phylogenetic tree T\in {\mathcal{W}\mathcal{T}}_{n} can be computed in optimal O(n^{2}) time (assuming a constant cost for the addition of real numbers) by computing for each internal node v, its depth δ_{ T }(v) through a preorder traversal of T, and the pairs of taxa of which v is the LCA through a postorder traversal of the tree. Both preorder and postorder traversals are performed in linear time on the usual tree data structures.
Cophenetic metrics
As we have seen in Theorem 1, the mapping
that sends each T\in {\mathcal{W}\mathcal{T}}_{n} to its cophenetic vector φ(T), is injective up to isomorphism. As it is well known, this allows to induce metrics on {\mathcal{W}\mathcal{T}}_{n} from metrics defined on powers of \mathbb{R}. In particular, every L^{p} norm ∥ · ∥_{ p } on {\mathbb{R}}^{n(n+1)/2}, p\u2a7e1, induces a cophenetic metric d_{φ, p} on {\mathcal{W}\mathcal{T}}_{n} by means of
Recall that
and so, for instance,
are the cophenetic metrics on {\mathcal{W}\mathcal{T}}_{n} induced by the Manhattan L^{1} and the euclidean L^{2} norms. One can also use Donoho’s L^{0} “norm” (which, actually, is not a proper norm)
to induce a metric d_{φ,0}(T_{1},T_{2}) on {\mathcal{W}\mathcal{T}}_{n}, which turns out to be simply the Hamming distance between φ(T_{1}) and φ(T_{2}).
As we have seen in the previous subsection, the cophenetic vector of a phylogenetic tree in {\mathcal{W}\mathcal{T}}_{n} can be computed in O(n^{2}) time. For every {T}_{1},{T}_{2}\in {\mathcal{W}\mathcal{T}}_{n}, and assuming a constant cost for the addition and product of real numbers, the cost of computing d_{φ,0}(T_{1}, T_{2}) (as the number of nonzero entries of φ(T_{1})φ(T_{2})) is O(n^{2}), and the cost of computing d_{φ,p}(T_{1}, T_{2})^{p}, for p\u2a7e1 (as the sum of the pth powers of the entries of the difference φ(T_{1})  φ(T_{2})) is O(n^{2} + log2(p)n^{2}), which is again O(n^{2}) if we understand log(p) as part of the constant factor. Finally, the cost of computing d_{φ,p}(T_{1}, T_{2}), p\u2a7e1, as the pth root of d_{φ,p}(T_{1}, T_{2})^{p} will depend on p and on the accuracy with which this root is computed. Assuming a constant cost for the computation of pth roots with a given accuracy (notice that, in practice, for low p and accuracy, this step will be dominated by the computation of d_{φ,p}(T_{1}, T_{2})^{p}), the total cost of computing d_{φ,p}(T_{1}, T_{2}) is O(n^{2}).
Next examples show some features of these cophenetic metrics.
Example 2
Let T\in {\mathcal{U}\mathcal{T}}_{n}, let (u, v) be an arc of T with u or v unlabeled, and let T^{′} be the phylogenetic tree in {\mathcal{U}\mathcal{T}}_{n} obtained by contracting (u, v): that is, by removing the node v and the arc (u, v), labeling u with the label of v if it was labeled, and replacing every arc (v, x) in T by an arc (u, x). Notice that, in the passage from T to T^{′}, for every i, j ∈ S:

If both i,j are descendants of v in T, then {\phi}_{{T}^{\prime}}(i,j)={\phi}_{T}(i,j)1.

In any other case, {\phi}_{{T}^{\prime}}(i,j)={\phi}_{T}(i,j).
As a consequence,
and therefore, if n_{ v } is the number of descendant taxa of v,
So the contraction of an arc in an tree T (which is RobinsonFoulds’ αoperation [15]) yields a new tree T^{′} at a cophenetic distance from T that depends increasingly on the number of descendant taxa of the head of the contracted arc.
Example 3
Let {T}_{0},{T}_{0}^{\prime}\in {\mathcal{W}\mathcal{T}}_{m}, for some m < n, let T\in {\mathcal{W}\mathcal{T}}_{n} be such that its subtree rooted at some node z is T_{0}, and let {T}^{\prime}\in {\mathcal{W}\mathcal{T}}_{n} be the tree obtained by replacing in T this subtree T_{0} by {T}_{0}^{\prime}.
Notice that, for every i, j ∈ {1, …, n}, {\phi}_{T}(i,j)={\delta}_{T}\left(z\right)+{\phi}_{{T}_{0}}(i,j) if i, j ⩽ m, and φ_{ T }(i, j) = φ_{ T }(z, j) if i ⩽ m and j > m, and the same holds in T^{′}, replacing T and T_{0} by T^{′} and {T}_{0}^{\prime}, respectively. Since, moreover, {\delta}_{T}\left(z\right)={\delta}_{{T}^{\prime}}\left(z\right), {\phi}_{T}(z,j)={\phi}_{{T}^{\prime}}(z,j) for every j > m, and {\phi}_{T}(i,j)={\phi}_{{T}^{\prime}}(i,j) for every i,j > m, we conclude that
and hence
So, the cophenetic metrics are local, as other popular metrics like the Robinson Foulds or the triples metrics, but unlike other popular metrics, like for instance the nodal metrics.
Results and discussion
Minimum and maximum values for cophenetic metrics
Our first goal is to find the smallest nonnegative value of d_{φ,p} on several spaces of phylogenetic trees, and the pairs of trees at which it is reached. These pairs of trees at minimum distance can be understood as ‘adjacent’ in the corresponding metric space, and their characterization yields a first step towards understanding how cophenetic metrics measure the difference between two trees.
Notice that this problem makes no sense for weighted phylogenetic trees. For instance, if we add or subtract an ϵ > 0 to the weight of a pendant arc in a tree T, without changing its topology, the distance between T and the resulting tree will be ϵ, which can be as small as desired. So, we only consider this problem on {\mathcal{U}\mathcal{T}}_{n}, {\mathcal{T}}_{n}, and {\mathcal{B}\mathcal{T}}_{n}.
In order to simplify the statements, set
The following easy result, which is a direct consequence of the fact that {D}_{p}({T}_{1},{T}_{2})\u2a7e{D}_{0}({T}_{1},{T}_{2}) for every p\u2a7e1 and {T}_{1},{T}_{2}\in {\mathcal{U}\mathcal{T}}_{n}, will be used in the proof of the next propositions.
Lemma 1
Assume that, for every pair of different trees T_{1}, T_{2} in {\mathcal{U}\mathcal{T}}_{n}, {\mathcal{T}}_{n} or {\mathcal{B}\mathcal{T}}_{n} such that D_{0}(T_{1}, T_{2}) is minimum on this space, we have that D_{ p }(T_{1}, T_{2}) = D_{0}(T_{1},T_{2}). Then, the minimum nonzero value of D_{ p } on this space of trees is equal to the minimum nonzero value of D_{0} on it, and it is reached at exactly the same pairs of trees.
The least nonnegative values of D_{ p }, for p ∈ {0}∪[1, ∞[, on {\mathcal{U}\mathcal{T}}_{n}, {\mathcal{T}}_{n}, and {\mathcal{B}\mathcal{T}}_{n}, together with an explicit description of the pairs of trees where these minimum values are reached, are given by the next three propositions. We give their proofs in the Additional file 1.
Proposition 1
The minimum nonnegative value of D_{ p } on {\mathcal{U}\mathcal{T}}_{n}, for p ∈ {0}∪[1, ∞[ and n\u2a7e2, is 1. And for every T,{T}^{\prime}\in {\mathcal{U}\mathcal{T}}_{n}, D_{ p }(T, T^{′}) = 1 if, and only if, one of them is obtained from the other by contracting a pendant arc.
So, not every tree in {\mathcal{U}\mathcal{T}}_{n} has neighbors at cophenetic distance 1: only those trees with some leaf whose parent is unlabeled. Now, it is not difficult to check that a tree T\in {\mathcal{U}\mathcal{T}}_{n} such that all its leaves have labeled parents has some tree T^{′} such that D_{ p }(T, T^{′}) = 2, which is the minimum value of D_{ p } on {\mathcal{U}\mathcal{T}}_{n} greater than 1. One such T^{′} is obtained by choosing a pendant arc in T and interchanging the labels of its source and its target nodes.
Proposition 2
The minimum nonnegative value of D_{ p } on {\mathcal{T}}_{n}, for p ∈ {0}∪[1, ∞ [ and n\u2a7e3, is 3. And for every T,{T}^{\prime}\in {\mathcal{T}}_{n}, D_{ p }(T, T^{′}) = 3 if, and only if, one of them is obtained from the other by means of one of the following two operations:

(a)
Contracting an arc ending in the parent of a cherry (see Figure 3)

(b)
Pruning and regrafting a leaf that is a sibling of the root of a cherry, to make it a sibling of the leaves in the cherry (see Figure 4)
So, every tree T\in {\mathcal{T}}_{n} has neighbors T^{′} such that D_{ p }(T, T^{′}) = 3. Indeed, take an internal node v in T of largest depth, so that all its children are leaves. If v has exactly two children, one such neighbor of T is obtained by contracting the arc ending in v. If v has more than two children, one such neighbor of T is obtained by replacing any two children of v by a cherry (that is, taking two children i, j of v, removing the arcs (v, i) and (v, j), and then adding a new node v_{0} and arcs (v, v_{0}), (v_{0}, i), and (v_{0}, j)).
Proposition 3
The minimum nonnegative value of D_{ p } on {\mathcal{B}\mathcal{T}}_{n}, for p ∈ {0}∪ [1, ∞[ and n\u2a7e3, is 4. And for every T,{T}^{\prime}\in {\mathcal{B}\mathcal{T}}_{n}, D_{ p }(T, T^{′}) = 4 if, and only if, one of them is obtained from the other by means of one of the following operations:

(a)
Reorganizing a triplet (see Figure 5)

(b)
Reorganizing a completely branched quartet (see Figure 6)
So again, every tree T\in {\mathcal{B}\mathcal{T}}_{n} has neighbors T^{′} such that D_{ p }(T, T^{′}) = 4. Indeed, take an internal node v in T of largest depth, so that its two children are leaves. Let w be the parent of v. Then, either the other child of w is a leaf, in which case w is the root of a triple and reorganizing its taxa we obtain a neighbor of T, or the other child of w is the parent of a cherry (it will have the same, maximum, depth as v), in which case w is the root of a completely branched quartet and reorganizing its taxa we obtain a neighbor of T.
We focus now on the diameter, that is, the largest value of d_{φ,p} on the spaces of unweighted phylogenetic trees (as in the case of the minimum nonzero value, and for the same reasons, the problem of finding the diameter makes no sense for weighted trees). Unfortunately, we have not been able to find exact formulas for it, but we have obtained its order, which we give in the next proposition. We also give its proof in the Additional file 1.
Proposition 4
The diameter of d_{φ,p} on {\mathcal{U}\mathcal{T}}_{n}, {\mathcal{T}}_{n}, and {\mathcal{B}\mathcal{T}}_{n} is in Λ(n^{2}) if p = 0 and in Λ(n^{(p + 2) / p}) if p\u2a7e1.
In particular, the diameter of d_{φ,1} on these spaces is in Λ(n^{3}), and the diameter of d_{φ,2} is in Λ(n^{2}).
Numerical experiments
We have performed several numerical experiments concerning the distributions of d_{φ,1} and d_{φ,2}, and the correlation of these metrics with other phylogenetic tree comparison metrics. The results of all these experiments can be found in the web page http://bioinfo.uib.es/âˆ¼recerca/phylotrees/cophidist/. In this section we report only on some significant results obtained through these experiments.
As a first experiment, we have generated all trees in {\mathcal{B}\mathcal{T}}_{n} and {\mathcal{T}}_{n}, for n = 3, 4, 5, 6, and for all pairs of them we have computed:

The cophenetic distances d_{φ,1} and d_{φ,2} on {\mathcal{B}\mathcal{T}}_{n} and {\mathcal{T}}_{n}.

The RobinsonFoulds distance d_{RF} on {\mathcal{B}\mathcal{T}}_{n} and {\mathcal{T}}_{n}[15].

The classical nodal distances d_{nodal,1} and d_{nodal,2} on {\mathcal{B}\mathcal{T}}_{n}, which compare the vectors of distances between pairs of taxa by means of the Manhattan and the Euclidean norms, respectively; see [5] and [18], respectively, as well as [20].

The splitted nodal distances {d}_{\text{nodal},1}^{\text{sp}} and {d}_{\text{nodal},2}^{\text{sp}} on {\mathcal{T}}_{n}, which compare the matrices of splitted path lengths between pairs of taxa by means of the Manhattan and the Euclidean norms, respectively; see [20].
In order to analyze this data, we have plotted 2Dhistograms for all pairs of metrics and we have computed their Spearman’s rank correlation coefficient. On the one hand, the 2Dhistograms for {\mathcal{B}\mathcal{T}}_{6} and {\mathcal{T}}_{6} (the most significative case) are given in Figures 7 and 8, respectively. For each pair of distances, we have divided the range of values that each of the distances gets into 25 subranges, and computed how many pairs of trees fall into each of the 25 × 25 different possibilities. Each of these possibilities is represented by a rectangle in a grid, whose darkness level is proportional of the number of trees. On the other hand, the Spearman’s rank correlation coefficient between the aforementioned distances in the most significative case of n = 6 are given in Tables 2 and 3.
These histograms and tables show that d_{φ,1} and d_{φ,2} are highly correlated, and that each d_{φ,i}, i = 1, 2, is highly correlated with the corresponding {d}_{\text{nodal},i}^{\text{sp}} on {\mathcal{T}}_{6}. This is not a surprise, because both types of metrics are based on encodings of phylogenetic trees related to the position in the tree of the LCA of every pair of leaves: remember the relationship between depths, cophenetic values and splitted path lengths recalled in the Background section. More surprising to us is the low correlation between each d_{φ,i}, and the corresponding d_{nodal,i} on {\mathcal{B}\mathcal{T}}_{6}, because of the relationship between depths, cophenetic values and patristic distances also recalled in the Background section. The very low correlation between the cophenetic metrics and the RobinsonFoulds metric simply shows that these metrics measure different notions of similarity.
Our second experiment is for values of n greater than 6. The numbers of trees in each of the spaces {\mathcal{T}}_{n} and {\mathcal{B}\mathcal{T}}_{n} make it unfeasible to compute the distances between all pairs of trees. Hence, we have randomly and uniformly generated pairs of trees in each of these spaces for n=10,20,\dots ,100 until the approximated value of the Spearman’s rank correlations of all pairs of distances converge up to 3 significant digits. The corresponding 2Dhistograms and Spearman’s rank correlation coefficient tables for the most significative case of n = 100 are shown in Figures 9 and 10 and Tables 4 and 5. These diagrams and tables confirm the very high correlation between d_{φ,1} and d_{φ,2}, and very low correlation of these metrics and the nodal and RobinsonFoulds metrics. The correlation between each d_{φ,i}, i = 1, 2, and the corresponding {d}_{\text{nodal},i}^{\text{sp}} is still significant, but it decreases as n increases.
Finally, in Figure 11 we have plotted the histograms of the distributions of d_{φ,1} and d_{φ,2} on {\mathcal{B}\mathcal{T}}_{n} and {\mathcal{T}}_{n} for n=10,20,\dots ,100. As it can be seen, they are positive skewed, like the splitted nodal metrics [20], Figure 5], but unlike other metrics like the RobinsonFoulds [32] or the transposition distance [33], Figure 2], which are negative skewed, or the triples metric [16], which is approximately normal.
Conclusions
Following a fifty years old idea of Sokal and Rohlf [4], we have encoded a weighted phylogenetic tree with nested taxa by means of its vector of cophenetic values of pairs of taxa, adding moreover to this vector the depths of single taxa. These positive realvalued vectors single out weighted phylogenetic trees with nested taxa, and therefore they can be used to define metrics to compare such trees. We have defined a family of metrics d_{φ,p}, for p ∈ {0}∪[1, ∞[, by comparing these vectors through the L^{p} norm.
We cannot advocate the use of any cophenetic metric d_{φ,p} over the other ones except, perhaps, warning against the use of the Hamming distance d_{φ,0} because it is too uninformative. Since the most popular norms on {\mathbb{R}}^{m} are the Manhattan L^{1} and the Euclidean L^{2}, it seems natural to use d_{φ,1} or d_{φ,2}. And since these two metrics are very highly correlated, the comparison of trees using one or the other will not differ greatly. Each one of these metrics has its own advantages.
On the one hand, the computation of d_{φ,1} does not involve roots, and therefore it can be computed exactly. Moreover, it takes integer values on unweighted trees and in this case its range of values is greater, thus being more discriminative. Actually, since ∥x∥_{ p } ⩽ ∥x∥_{1} for every x\in {\mathbb{R}}^{m} and p\u2a7e1, we have that
On the other hand, the comparison of cophenetic vectors by means of the Euclidean norm enables the use of many geometric and clustering methods that are not available otherwise. In particular, it is possible to compute the mean value of the square of d_{φ,2} under different evolutionary models. We shall report on this elsewhere.
As a rule of thumb, and as we already advised in the context of splitted nodal metrics [20], we suggest using d_{φ,1} when the trees are unweighted, because these trees can be seen as discrete objects and thus their comparison through a discrete tool as the Manhattan norm seems appropriate. When the trees have arbitrary positive real weights, they should be understood as belonging to a continuous space [34], and then the Euclidean norm is more appropriate.
Future work will include a deeper study of the distribution of d_{φ,1} and d_{φ,2} on different spaces of unweighted phylogenetic trees.
Endnotes
^{a}There are some details to be filled here, because for technical reasons we shall allow the root of our phylogenetic trees to have outdegree 1 without being labeled, and this case is not covered by [20, Thm. 10], but it is not difficult to modify the argument given above to cover also this case.^{b}http://en.wikipedia.org/wiki/Phylogenetic_tree
References
HoefEmden K: Molecular phylogenetic analyses and reallife data. Comput Sci Eng. 2005, 7: 8691. 10.1109/MCSE.2005.55.
Felsenstein J: Inferring Phylogenies. 2004, USA: Sinauer Associates Inc.
Rohlf F, Sokal R: Comparing numerical taxonomic studies. Syst Zool. 1981, 30: 459490. 10.2307/2413054.
Sokal R, Rohlf F: The Comparison of Dendrograms by Objective Methods. Taxon. 1962, 11: 3340. 10.2307/1217208.
Williams WT, Clifford HT: On the comparison of two classifications of the same set of elements. Taxon. 1971, 20: 519522. 10.2307/1218253.
Handl J, Knowles J, Kell DB: Computational cluster validation in postgenomic data analysis. Bioinformatics. 2005, 21: 32013212. 10.1093/bioinformatics/bti517.
Restrepo G, Mesa H, Llanos E: Three Dissimilarity Measures to Contrast Dendrograms. J Chem Inf Model. 2007, 47: 761770. 10.1021/ci6005189.
Steel MA, Penny D: Distributions of tree comparison metrics—some new results. Syst Biol. 1993, 42: 126141.
Waterman MS, Smith TF: On the similarity of dendrograms. J Theor Biol. 1978, 73: 789800. 10.1016/00225193(78)901376.
Allen BL, Steel MA: Subtree transfer operations and their induced metrics on evolutionary trees. Ann Combinatorics. 2001, 5: 113. 10.1007/s0002600180068.
Finden C, Gordon A: Obtaining common pruned trees. J Classification. 1985, 2: 255276. 10.1007/BF01908078.
Goddard W, Kubicka E, Kubicki G, McMorris F: The agreement metric for labeled binary trees. Math Biosci. 1994, 123: 215226. 10.1016/00255564(94)900124.
Zhong Y, Meacham C, Pramanik S: A general method for treecomparison based on subtree similarity and its use in a taxonomic database. Biosystems. 1997, 42: 18. 10.1016/S03032647(97)016845.
Robinson DF, Foulds LR: Comparisonof weighted labelled trees. Proc 6th Australian Conf Combinatorial Mathematics, Lecture Notes in Mathematics. 1979, Berlin Heidelberg: Springer, 119126.
Robinson DF, Foulds LR: Comparison of phylogenetic trees. Math Bioscie. 1981, 53: 131147. 10.1016/00255564(81)900432.
Critchlow DE, Pearl DK, Qian C: The triples distance for rooted bifurcating phylogenetic trees. Syst Biol. 1996, 45: 323334. 10.1093/sysbio/45.3.323.
Farris JS: A successive approximations approach to character weighting. Syst Zool. 1969, 18: 374385. 10.2307/2412182.
Farris JS: On comparing the shapes of taxonomic trees. Syst Zool. 1973, 22: 5054. 10.2307/2412378.
Phipps JB: Dendrogram topology. Syst Zool. 1971, 20: 306308. 10.2307/2412343.
Cardona G, Llabrés M, Rosselló F, Valiente G: Nodal distances for rooted phylogenetic trees. J Math Biol. 2010, 61: 253276. 10.1007/s0028500902952.
Basford N, Butler J, Leone C, Rohlf F: Immunologic Comparisons of Selected Coleoptera With Analyses of Relationships Using Numerical Taxonomic Methods. Syst Biol. 1968, 17: 388406. 10.1093/sysbio/17.4.388.
Chui V, Thornton I: A Numerical Taxonomic Study of the Endemic Ptycta Species of the Hawaiian Islands (Psocoptera: Psocidae). Syst Biol. 1972, 21: 722. 10.1093/sysbio/21.1.7.
Leelambikaa M, Sathyanarayanaa N: Genetic characterization of Indian Mucuna (Leguminoceae) species using morphometric and random amplification of polymorphic DNA (RAPD) approaches. Plant Biosystems. 2011, 145: 786797. 10.1080/11263504.2011.610924.
Hartigan J: Representation of similarity matrices by trees. J Am Stat Assoc. 1967, 62: 11401158. 10.1080/01621459.1967.10500922.
Harvey PH, Pagel M: The comparative method in evolutionary biology. 1991, USA: Oxford university press
Pagel MD: Inferring the Historical Patterns of Biological Evolution. Nature. 1999, 401: 877884. 10.1038/44766.
Farris JS, Kluge AG, Eckardt MJ: A numerical approach to phylogenetic systematics. Syst Zool. 1970, 19: 172189. 10.2307/2412452.
Johnson SC: Hierarchical clustering schemes. Psychometrika. 1967, 32: 241254. 10.1007/BF02289588.
Sneath P, Sokal R: Numerical Taxonomy. 1973, USA: Freeman and Co
Xu S, Atchley WR, Fitch WM: Phylogenetic Iinference under the pure drift model. Mol Biol Evol. 1994, 11: 949960.
Semple C, Steel M: Phylogenetics. 2003, USA: Oxford University Press
Steel M: Distribution of the symmetric difference metric on phylogenetic trees. SIAM J Discrete Mathematics. 1988, 1: 541551. 10.1137/0401050.
Alberich R, Cardona G, Rosselló F, Valiente G: An algebraic metric for phylogenetic trees. Appl Mathematics Lett. 2009, 22: 13201324. 10.1016/j.aml.2009.03.003.
Billera LJ, Holmes SP, Vogtmann K: Geometry of the space of phylogenetic trees. Adv Appl Mathematics. 2001, 27: 733767. 10.1006/aama.2001.0759.
Acknowledgements
The research reported in this paper has been partially supported by the Spanish government and the UE FEDER program, through project MTM200907165. We thank the comments and suggestions of the reviewers, which have led to a substantial improvement of this paper.
Author information
Authors and Affiliations
Corresponding author
Additional information
Competing interests
The authors declare that they have no competing interests.
Authors’ contributions
AM and FR developed the theoretical part of the paper. GC, LR and DS implemented the algorithms and performed the numerical experiments. GC and DS prepared the Additional file 1 web page. FR prepared the first version of the manuscript. All authors revised, discussed, and amended the manuscript and approved its final version. All authors read and approved the final manuscript.
Electronic supplementary material
Authors’ original submitted files for images
Below are the links to the authors’ original submitted files for images.
Rights and permissions
Open Access This article is published under license to BioMed Central Ltd. This is an Open Access article is distributed under the terms of the Creative Commons Attribution License ( https://creativecommons.org/licenses/by/2.0 ), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
About this article
Cite this article
Cardona, G., Mir, A., Rosselló, F. et al. Cophenetic metrics for phylogenetic trees, after Sokal and Rohlf. BMC Bioinformatics 14, 3 (2013). https://doi.org/10.1186/14712105143
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/14712105143
Keywords
 Phylogenetic Tree
 Rooted Tree
 Internal Node
 Label Node
 Weighted Tree