Isomorphism of trees and isometry of ultrametric spaces

We study the conditions under which the isometry of spaces with metrics generated by weights given on the edges of finite trees is equivalent to the isomorphism of these trees. Similar questions are studied for ultrametric spaces generated by labelings given on the vertices of trees. The obtained results generalized some facts previously known for phylogenetic trees and for Gurvich-Vyalyi monotone trees.


Introduction
In 2001 at the Workshop on General Algebra the attention of experts on the theory of lattices was paid to the following problem of I. M. Gelfand: Using graph theory describe up to isometry all finite ultrametric spaces [17]. An appropriate representation of ultrametric spaces by monotone rooted trees was proposed by V. Gurvich and M. Vyalyi in [14]. A simple geometric description of Gurvich-Vyalyi representing trees was found in [20]. This description allows us effectively use the Gurvich-Vyalyi representation in various problems associated with finite ultrametric spaces. In particular, this leads to a graph-theoretic interpretation of the Gomory-Hu Inequality [12]. A characterization of finite ultrametric spaces which are as rigid as possible also was obtained [13] on the basis of the Gurvich-Vyalyi representation. Some other extremal properties of finite ultrametric spaces and related them properties of monotone rooted trees have been found in [11]. The interconnections between the Gurvich-Vyalyi representation and the space of balls endowed with the Hausdorff metric are discussed in [6] (see also [9,19,[21][22][23]).
It is well-known that the sets of leaves of phylogenetic equidistant trees with additive metric are ultrametric. The finite equidistant trees can be considered as finite subtrees of the so-called R-trees (see [1] for some interesting results related to R-trees and ultrametrics). The categorical equivalence of trees and ultrametric spaces was investigated in [16] and [18].
It is interesting to note that, in fact, both the monotone trees and equidistant trees were used in the phylogenetic for the description of related ultrametric spaces long before the publication of paper [14] (see, for example, [24]). The monotone trees and the equidistant trees are dual in a certain sense, but it seems that the description of this duality can be found in Section 7.1 of book [24] only.
In the present paper we discuss the interrelations between the weighted trees with additive metrics and labeled trees with corresponding ultrametrics. In particular, the duality of equidistant trees and monotone trees is studied in details for trees which are more general than the classical phylogenetic trees.
The paper is organized as follows. Section 2 contains some standard definitions from the theory of metric spaces and the theory of graphs. A short list of known properties of Gurvich-Vyalyi representing trees is also given there. Section 3 deals with the weights and labelings on unrooted trees. In Theorem 3.1 we prove that, for all weights, the isomorphisms of weighted trees coincide with isometries of metric spaces endowed with the corresponding additive metrics and, in Proposition 3.4, we show that this property characterizes the trees among all connected weighted graphs. Proposition 3.6 describes conditions under which the labelings on the vertex sets of trees generate ultrametrics. In Theorem 3.10 it is shown that under the same conditions every connected labeled graph G contains a spanning tree T such that labeling, induced on T , generates the same ultrametric as an original labeling on G. Theorem 3.12, one of the main results of the section, shows that, in the contrast with the weighted trees, the isomorphisms of labeled trees coincide with isometries of generated ultrametric spaces only for trees with one vertex.
In Section 4, after defining the concepts of equidistant weight and monotone labeling for the case of an arbitrary rooted tree, we find explicit formulas describing the transition between these weights and labelings in Proposition 4.2. Good functorial properties of such transition are described by Proposition 4.3.
Theorem 4.7, Theorem 4.12 and Theorem 4.13 are generalizations of the wellknown fact about representation of finite ultrametric spaces by phylogenetic trees and by Gurvich-Vyalyi monotone trees. Proposition 4.14 describes the necessary and sufficient conditions under which isomorphism of equidistant trees (monotone trees) is equivalent to isometricity of corresponding ultrametric spaces. Section 5 of the paper contains some characteristic properties of ultrametric spaces of leaves of equidistant rooted trees with pedant roots. In particular, Proposition 5.4 describes a new characteristic property of stars in the language of equidistant weights.

Initial definitions and facts
Let us recall some concepts from the theory of metric spaces and the graph theory.
The quantity diam X = sup{d(x, y) : x, y ∈ X} is the diameter of (X, d).
A metric space (X, d) is ultrametric if the strong triangle inequality d(x, y) ≤ max{d(x, z), d(z, y)}.
holds for all x, y, z ∈ X. In this case d is called an ultrametric on X and (X, d) is an ultrametric space.
Definition 2.1. Metric spaces (X, d) and (Y, ρ) are isometric if there is a bijective mapping Φ : X → Y such that d(x, y) = ρ(Φ(x), Φ(y)) holds for all x, y ∈ X. In this case we write (X, d) ≃ (Y, ρ) and say that Φ is an isometry of (X, d) and (Y, ρ).
A graph is a pair (V, E) consisting of a nonempty set V and a (probably empty) set E whose elements are unordered pairs of different points from V . For a graph G = (V, E), the sets V = V (G) and E = E(G) are called the set of vertices (or nodes) and the set of edges, respectively. We say that G is nonempty if E(G) = ∅. If {x, y} ∈ E(G), then the vertices x and y are adjacent. Recall that a path is a nonempty graph P whose vertices can be numbered so that In this case we say that P is a path joining x 0 and x k .
In this paper we consider finite graphs only. A finite graph C is a cycle if |V (C)| ≥ 3 and there exists an enumeration v 1 , v 2 , . . ., v n of its vertices such that A graph G is connected if for every two distinct u, v ∈ V (G) there is a path P ⊆ G joining u and v. A connected graph without cycles is called a tree. A vertex v of a tree T is a leaf if the degree of v is less than two, If a vertex v is not a leaf of T , then we say that v is an internal node of T .
A tree T may have a distinguished vertex r called the root ; in this case T is called a rooted tree and we write T = T (r).
Let T = T (r) be a rooted tree and let v be a vertex of T . Denote by δ + (v) the out-degree of v, The root r is a leaf of T if and only if δ + (r) 1. Moreover, for a vertex v different from the root r, the equality δ + (v) = 0 holds if and only if v is leaf of T .
Thus, in what follows, we assume that the labels on the tree vertices are some nonnegative numbers.
We also use the notion of complete multipartite graph. Definition 2.3. A nonempty graph G is called complete k-partite if its vertices can be divided into disjoint nonempty sets X 1 , . . ., X k so that k 2 and there are no edges joining the vertices of the same set X i and any two vertices from different X i , X j , 1 i, j k are adjacent. In this case we write G = G[X 1 , ..., X k ].
We shall say that G is a complete multipartite graph if there exists k such that G is complete k-partite.
x 0 x 6 x 5 x 4 x 3 x 2 In particular, a star is a complete bipartite graph G[X 1 , X 2 ] with |X 1 | = 1 or Definition 2.4 ( [5]). Let (X, d) be a finite ultrametric space with |X| 2. Define a graph G D,X as V (G D,X ) = X and for all u, v ∈ V (G D,X ). We call G D,X the diametrical graph of X.
For every nonempty, finite ultrametric space (X, d) we can associate a labeled rooted tree T X = T X (r, l) with r = X and l : V (T X ) → R + by the following rule (see [20]).
If X is a one-point set, then T X is the rooted tree consisting of the node X with the label diam X = 0. Note that for the rooted trees consisting only of one node, we consider that this node is the root as well as a leaf.
Let |X| 2. According to Theorem 2.5 we have G D,X = G D,X [X 1 , ..., X k ] and k 2. In this case the root of the tree T X is labeled by diam X and T X has the nodes X 1 , ..., X k of the first level with the labels .., k. The nodes of the first level with the label 0 are leaves, and those indicated by strictly positive labels are internal nodes of the tree T X . If the first level has no internal nodes, then the tree T X is constructed. Otherwise, by repeating the above-described procedure with X 1 , ..., X k instead of X, we obtain the nodes of the second level, etc. Since X is finite, all vertices on some level will be leaves, and the construction of T X is completed. The above-constructed labeled rooted tree T X is called the representing tree of the ultrametric space (X, d).
In the next sections we will need several different concepts of isomorphism of trees.
Definition 2.6. Let T 1 and T 2 be trees. A bijection f : is valid for all u, v ∈ V (T 1 ). The trees T 1 and T 2 are isomorphic if there exists an isomorphism f : . Let T 1 = T 1 (r 1 ) and T 2 = T 2 (r 2 ) be rooted trees. Then T 1 and T 2 are isomorphic as rooted trees if there is a bijection f : For the case of labeled trees the above definition must be modified as follows.
of the trees T 1 and T 2 is an isomorphism of the labeled trees T 1 (l 1 ) and T 2 (l 2 ) if the equality Analogously, for weighted trees T 1 = T 1 (w 1 ) and holds for every {u, v} ∈ E(T 1 ).
The labeled rooted trees T 1 (r 1 , l 1 ) and T 2 (r 2 , l 2 ) are isomorphic if there is an isomorphism of these trees. In this case we write T 1 (r 1 , l 1 ) ≃ T 2 (r 2 , l 2 ).
is valid.
If T = T (r) is a rooted tree and u, v ∈ V (T ) are distinct, then we say that v is a successor of u whenever u ∈ V (P ), where P is the path joining v and r. A successor v of u is a direct successor of u if {u, v} ∈ E(T ).
The following theorem is a simple modification of Theorem 2.7 [10]. and, in addition, the inequality l(v) < l(u) holds whenever v is a direct successor of u. (ii) There is a finite, nonempty ultrametric space (X, d) such that Recall that a phylogenetic tree is an unrooted tree T , whose inner nodes have degree at least three, together with a labeling defined on the set of leaves of T (see, for example, [25]). Using Theorem 2.5 and above described procedure of construction of representing trees we can simply prove the following result.
Proposition 2.11. The following statements are equivalent for every tree T .
(i) There is a phylogenetic tree T 1 such that T and T 1 are isomorphic as free (unrooted, without labelings) trees. (ii) There is an ultrametric space (X, d) such that the diametrical graph G D,X is complete k-partite with k 3 and T X and T are isomorphic as free (unrooted, without labelings) trees.
Let (X, d) be an ultrametric space. Recall that a ball with a radius r 0 and a center c ∈ X is the set The ballean B X of the ultrametric space (X, d) is the set of all balls of (X, d). Every one-point subset of X belongs to B X , this is a singular ball in X.
Let T = T (r) be a rooted tree. For every vertex v of T we denote by T v the subtree of T such that v is the root of T v , and satisfying In this situation Charles Semple and Mike Steel say that T v is a rooted subtree of T (r) lying below v [24, p. 9]. See Figure 2 for an example of such a rooted subtree.
In what follows we write L = L(T v ) to denote the set of all leaves of T v . If T = T X is the representing tree of a finite ultrametric space (X, d) and v = {x 1 , x 2 , . . . , x n } is a vertex of T X , x i ∈ X, i = 1, . . . , n, then we have For T X consisting of one node only, V (T X ) = X, we consider that X is the root of T X as well as a leaf of T X . Thus, if X = {x}, then we have L(T X ) = {{x}}.
The following proposition claims that the ballean of every finite ultrametric space (X, d) coincides with the vertex set of T X . Proposition 2.12. Let (X, d) be a finite, nonempty ultrametric space with representing tree T X . Then the following statements hold: This proposition is a simple modification of the corresponding result from [21] (see also Theorem 2.5 in [6]).
The proofs of Theorem 2.9, Theorem 2.10 and Proposition 2.12 are based on the next basic theorem.
Theorem 2.13 ([9]). Let (X, d) be a finite ultrametric space and let x 1 and x 2 be two distinct points of X. If P is the path joining the distinct leaves {x 1 } and {x 2 } in T X , then we have where the labeling l : V (T X ) → R + is defined as in (2.1).
The next section of the paper contains several results which can be considered as extensions of Theorem 2.13 to the case of unrooted, labeled trees.

Comments on the concept of graph isomorphism
All above introduced notions of tree isomorphism can be considered as some specifications of the following general definition.
Let G = (V, E, L V , L E , l) be a graph with V (G) = V , E(G) = E and such that L V and L E are some sets of vertex labels and edge labels, respectively, and let f : Definition 2.14. The graphs are isomorphic if there is a bijection f : V 1 → V 2 such that: Two definitions of graph isomorphism are equivalent if any two graphs are isomorphic w.r.t the first definition if and only if these graphs are isomorphic w.r.t. the second one. For the case when are trees, Definition 2.14 is equivalent to: Similarly we can find specifications of Definition 2.14 which are equivalent to definitions of isomorphisms of phylogenetic trees, weighted trees, weighted rooted trees, and weighted labeled trees, but we prefer to use several independent definitions of isomorphism to simplify the statements of future results.
The concept of equivalent isomorphisms (= equivalent definitions of isomorphism) can be more satisfactory described on the basis of category theory, but this is not the subject of the paper.

Weights and labelings on unrooted trees
Let G(w) be a weighted graph. The weight w : E(G) → R + is strictly positive if w(e) > 0 holds for every e ∈ E(G).
Let T = T (w) be a weighted tree with the strictly positive weight w. The function d w : where P is the unique path joining u and v in T , is a metric on V (T ).
If G = G(w) is a connected, weighted graph with the strictly positive weight w : E(G) → R + , then the weighted shortest-path metric is the mapping where P u,v is the set of all paths joining u and v in G. If G is a tree, then, for any pair of distinct u, v ∈ G, the set P u,v contains the unique path. Thus, the metrics d w and ρ w coincide for trees.
The metric defined by (3.2) is called additive. If w(e) = 1 holds for every e ∈ E(G), then d w is called the graph metric on G.
It is easy to prove that the connected graphs G 1 and G 2 are isomorphic as free, unweighted graphs if and only if the metric spaces (V (G 1 ), d 1 ) and (V (G 2 ), d 2 ) are isometric, where d i is graph metric on G i , i = 1, 2. The following theorem is a partial generalization of this fact. Theorem 3.1. Let T 1 = T 1 (w 1 ) and T 2 = T 2 (w 2 ) be weighted trees with strictly positive weights. Then a mapping f : if and only if it is an isomorphism of the weighted trees T 1 (w 1 ) and T 2 (w 2 ).
Proof. Let u, v ∈ V (T 1 ). If f is an isomorphism of T 1 (w 1 ) and T 2 (w 2 ), then, using (2.4), (3.1) and the uniqueness of the path P u,v joining u and v in T 1 , we obtain the equality Hence, f is an isometry of the metric spaces (V (T 1 ), d w1 ) and (V (T 2 ), d w2 ).
Conversely, let f be an isometry of (V (T 1 ), d w1 ) and (V (T 2 ), d w2 ). Then it is easy to see that f is an isomorphism of weighted trees T 1 (w 1 ) and T 2 (w 2 ) if and only if f is an isomorphism of free (unweighted) trees T 1 and T 2 . To prove that f is an isomorphism of T 1 and T 2 it suffices to show that the implication

Now from (3.3) and (3.4) it follows that
Since d w1 is an additive metric, there are Using (3.1) again we can write (3.6) as Let us consider a graph G such that The last equality contradicts the definition of the path P 2 . The validity of (3.3) follows.
are weighted trees with strictly positive weights such that .
Proof. It follows from Theorem 3.1 with f satisfying f (x) = x for every x ∈ X.
Corollary 3.3. Let T 1 = T 1 (w 1 ) and T 2 = T 2 (w 2 ) be weighted trees with strictly positive weights. Then the equivalence is valid.
The concept of isomorphism of weighted trees can be naturally extended to the concept of isomorphism of weighted graphs. Let G 1 = G 1 (w 1 ) and G 2 = G 2 (w 2 ) be connected, nonempty graphs with the weights w 1 : E(G 1 ) → R + and w 2 : E(G 2 ) → R + . We write G 1 (w 1 ) ≃ G 2 (w 2 ) and say that G 1 (w 1 ) and for all u, v ∈ V (G 1 ) and, moreover, The following result shows that the validity of (3.8) is a characteristic property of trees.
Proposition 3.4. Let G 1 and G 2 be connected, nonempty graphs. Then the following statements are equivalent: (i) G 1 and G 2 are trees.
(ii) The equivalence is valid for all strictly positive w 1 : E(G 1 ) → R + and w 2 : . This implication is valid by Corollary 3.3.
(ii) ⇒ (i). As in the proof of Theorem 3.1, it is easy to see that the implication is valid. But, in general, the converse implication is false. Indeed, suppose that G is a finite, connected, nonempty graph which contains a cycle C, C ⊆ G. Let e 0 be a fixed edge of C, e 0 ∈ E(C), and let S 1 := |E(G)|. Write G 1 = G and G = G 2 . We can define two weights w 1 : and w 1 (e) = w 2 (e) = 1 whenever e ∈ E(G) but e = e 0 . Since holds, the weighted graphs G 1 (w 1 ) and G 2 (w 2 ) cannot be isomorphic. Now using (3.2) and (3.9) we see that both the metric spaces where G \ e 0 denotes the connected graph obtained from G by deleting e 0 and d is the graph metric on V (G \ e 0 ).
Remark 3.5. The characterization of trees obtained in Proposition 3.4 is similar to the characterizations of trees which were given in Corollary 3.6 of [7] and Corollary 5 of [8].
Theorem 3.1 and Proposition 3.4 give rise the following problem: Problem 1. Let G 1 (w 1 ) and G 2 (w 2 ) be connected, weighted graphs with the strictly positive weights. Find conditions under which every isometry f : In the rest of the section we consider the labeled, unrooted trees and related them ultrametric spaces and find some modifications of Theorem 2.13, Theorem 3.1, Proposition 3.4 and Problem 1 in this case.
Let T = T (l) be a labeled tree with the labeling l : E(T ) → R + and let d l : V (T )× V (T ) → R + be a mapping defined as where P is the unique path joining u and v in T (cf. Theorem 2.13).
Proposition 3.6. The following statements are equivalent for every labeled tree T = T (l).
Proof. (i) ⇒ (ii). It follows directly from the definitions of metrics and ultrametrics.
(ii) ⇒ (iii). Let (ii) hold and let {u 1 , v 1 } ∈ E(T ). Then u 1 = v 1 holds because T has no loops. Since d l is a metric, from u 1 = v 1 it follows that Since P = (u 1 , v 1 ) is the unique path joining u 1 and v 1 in T , by (3.10) we have It is clear that d l is symmetric and nonnegative. Statement (iii) and the definition of d l imply that the inequality d l (u, v) > 0 holds for every pairs of distinct u, v ∈ V (T ). Thus, to complete the proof of validity of (i), it suffices to show that the strong triangle inequality be the subgraph of T induced by V (P 1,3 ) ∪ V (P 3,2 ). Since v 1 , v 2 ∈ T 1,2,3 and T 1,2,3 is connected, the uniqueness of path joining v 1 and v 2 implies P 1,2 ⊆ T 1,2,3 . Hence, The equality (3.14) and (3.15) imply (3.13).
Remark 3.7. If T = T (l) is a labeled tree but there is {u 1 , v 1 } ∈ E(T ) such that l(u 1 ) = l(v 1 ) = 0, then the mapping d l : V (T )×V (T ) → R + is an pseudoultrametric on V (T ), i.e., d l is a symmetric, nonnegative mapping satisfying the strong triangle inequality.
The following example shows that the converse implication is false in general.
a 4 a 5 Figure 3. The labeled path T 1 (l 1 ) and the labeled star T 2 (l 2 ) generate some isometric ultrametric spaces.
Now we expand the construction of mapping d l , defined by formula (3.10) for labeled trees, to the case of arbitrary finite connected, labeled graph.
Let G = G(l) be a connected, finite graph with a labeling l : V (G) → R + and let ρ l : V (G) × V (G) → R + be a mapping defined as where P u,v is the set of all paths joining u and v in G.
In the formulation of the next theorem we use the notion of spanning tree. Recall that a tree T is a spanning tree for a graph G if T ⊆ G and V (T ) = V (G) hold. It is well-known that a graph G is connected if and only if G contains a spanning tree (see, for example, [2, Theorem 4.6]). Hence, by induction hypothesis, there is a spanning tree T 1 with the same labeling l : V (T 1 ) → R + and satisfying the equality where P 1 u,v is the set of all paths joining u and v in G 1 . To complete the proof it suffices to show that ρ 1 The existence of the path P 1 ∈ P 1 u,v satisfying (3.22) is trivial if e 1 / ∈ E(P ). Let e 1 ∈ E(P ) and let C \ e 1 and P \ e 1 be connected graphs obtained from C and, respectively, from P by deleting e 1 . Write W for the graph with and Then we have Since W is a connected graph, there is a path P 2 ⊆ W joining u and v in W . Consequently, holds. Inequality (3.22) follows from (3.23) and (3.24) with P 1 = P 2 .
Corollary 3.11. The following statements are equivalent for every connected, labeled graph G = G(l): Proof. Proposition 3.6 and Theorem 3.10 imply that (i) ⇔ (ii) is valid. Let G = G(l) be a connected, labeled graph and let T = T (l) be a spanning tree such that d l = ρ l holds. Since E(G) ⊇ E(T ) holds, statement (iii) of the present corollary implies statement (iii) of Proposition 3.6. Thus, we also have (iii) ⇒ (i).
In what follows we give a partial solution of Problem 2 for labeled rooted trees.
for every u i ∈ V (T i ) and, in addition, l(v i ) < l(u i ) holds whenever v i is a direct successor of u i , i = 1, 2. Then the following statements hold: (ii) If the ultrametric spaces (V (T 1 ), d l1 ) and (V (T 2 ), d l2 ) are isometric, then the following conditions are equivalent: is an isomorphism of T 1 (l 1 ) and T 2 (l 2 ).
In proving this theorem we will use some results describing the structure of balleans B X of finite ultrametric spaces (X, d) (see, in particular, Proposition 2.12).
Let A and B be two nonempty bounded subsets of a metric space (X, d). The Hausdorff distance d H (A, B) between A and B is defined by The definition and some properties of the Hausdorff distance can be found in [3]. See also [22,23] for properties of Hausdorff distance in ultrametric spaces. We note only that if {a} and {b} are singular balls in (X, d), then (3.28) implies The following lemma is a part of Theorem 2.5 from [6]. Lemma 3.13 and Proposition 3.6 imply that (B X , d H ) is a finite ultrametric space for every finite ultrametric space (X, d). Now we want to describe the structure of the representing tree T BX . Definition 3.14. Let T 1 and T 2 be trees and let x be a leaf of T 2 . Suppose we have Then there is a unique vertex u ∈ V (T 1 ), such that {x, u} ∈ E(T 2 ). In this case we say that T 2 is obtained by adding the leaf x to the vertex u.
In the following lemma we consider an ultrametric space (X, d) with X satisfying the condition for every Y ⊆ X. We note that for every ultrametric space (Z, ρ) there is an ultrametric space (X, d) such that (X, d) ≃ (Z, ρ) and (3.29) holds for every Y ⊆ X.
Lemma 3.15. Let (X, d) be a finite ultrametric space with the representing tree T X = T X (X, l), let B X be the ballean of (X, d) and let d H be the Hausdorff distance on B X . Then the representing tree T BX of the ultrametric space (B X , d H ) and the labeled rooted tree T 1 = T 1 (r 1 , l 1 ), r 1 = X, obtained from T X by adding a leaf to every internal vertex of T X and labeled such that are isomorphic as labeled rooted trees.
For the proof of this lemma see Theorem 3.10 in [6]. Our next lemma is a direct consequence of Lemma 3.15.
In the proof of Theorem 3.12 we also use the next simple fact.
is an isomorphism of labeled trees T 1 = T 1 (l 1 ) and T 2 = T 2 (l 2 ), then the equality Proof. It follows from Definition 2.7 and (3.10).
Let v * 1 be a leaf of T 1 and let u * 1 be the unique vertex of T 1 such that {v * 1 , u * 1 } ∈ E(T 1 ). Since f is an isomorphism of T 1 (l 1 ) and T 2 (l 2 ), the vertex v * 2 = f (v * 1 ) is a leaf of T 2 and {v * 2 , u * 2 } ∈ E(T 2 ) holds with u * 2 = f (u * 1 ). Using (3.27) we also see that Then the composition is not an isomorphism T 1 and T 2 because v * 1 is a leaf of T 1 , but g(f (v * 1 )) is an inner node of Since f is an isometry, mapping (3.39) is an isometry if and only if g is an isometry. Using (3.38) and Definition 2.1 we can simply prove that g is an isometry if and only if . Let x ∈ V (T 2 ) satisfy (3.41). Let us consider the path P 1 = (v 1 , . . . , v n ) joining v * 2 = v 1 and x = v n , and the path P 2 = (u 1 , . . . , u m ) joining u * 2 = u 1 and x = u m .
We conclude this section with a simple example of connected labeled graph G(l) for which the group of isomorphisms of G(l) coincides with the group isometries of (V (G), ρ l ).
Example 3.18. Let G = G(l) be the labeled graph shown in Figure 4. Then every

Isomorphisms of monotone trees and of equidistant trees
Let T = T (r) be a rooted tree. Write  Let T = T (r, w) be a weighted rooted tree with strictly positive weight. The weight w is equidistant if there is a constant K such that, for every u ∈ V + 0 (T ), where (v 1 , . . . , v n ) is the path joining the root r = v 1 with the leaf u = v n in T . In this case we say that T (r, w) is equidistant.
Note that the root r of an equidistant tree T = T (r, w) can be a leaf of T (see Figure 5).
We will also say that a labeling l : V (T ) → R + of a labeled rooted tree T = T (r, l) is monotone if l −1 (0) = V + 0 (T ) and, in addition, the inequality holds whenever v is a direct successor of u. A tree is monotone if it is a labeled rooted tree with monotone labeling. By Theorem 2.10, the tree T X is monotone for every finite ultrametric space (X, d).  Figure 5. The rooted trees in which the root has degree 1 are known as planted trees. It is an example of planted, equidistant tree satisfying equality (4.2) with K = 7.
The following proposition gives us a tool for investigation of a duality between the equidistant trees and monotone trees.  Proof. (i) Let l : V (T ) → R + be monotone. Since for every {u, v} ∈ E(T ) either u is a direct successor of v or v is a direct successor of u, there is the unique weight w : E(T ) → R + for which (4.4) holds whenever v is a direct successor of u. We must prove that w is equidistant. Equality (4.4) implies that w(e) > 0 for every e ∈ E(T ), i.e., w is strictly positive. Let v ∈ V + 0 (T ) and let (v 1 , . . . , v n ) be a path in T such that v 1 = r and v n = v. Then using (4.4) and the equality l(v) = 0 we obtain Hence (4.2) holds with K = 1 2 l(r). Thus w is equidistant.
where u 1 = r, u n = u and (u 1 , . . . , u n ) is the unique path joining the root r and the node u in T and K is the constant defined by (4.2). Then (4.2) and (4.5) imply that l(v 0 ) = 0 holds for every v 0 ∈ V + 0 (T ). Moreover, if v is a direct successor of u, then using (4.5) we obtain which implies (4.4).
Suppose that l 1 : V (T ) → R + is a monotone labeling such that l 1 = l but holds whenever v is a direct successor of u. Since l 1 and l are monotone, we have l 1 (v) = l(v) for every v ∈ V + 0 (T ). Hence, there is (4.7) u * ∈ V (T ) \ V + 0 (T ) such that l 1 (u * ) = l(u * ) but l 1 (v) = l(v) for every successor of u * . Condition (4.7) implies that the set of all successors of u * is nonempty. Let v * be a direct successor of u * . Then using (4.4) and (4.6) we obtain contrary to l 1 (u * ) = l(u * ). Statement (ii) is proved. Figure 6 gives us an example of equidistant tree and the corresponding monotone tree.
In what follows we writel * w andŵ * l for the monotone labeling and, respectively, for equidistant weight obtained from the equidistant w : E(T ) → R + and, respectively, from the monotone l : V (T ) → R + by (4.4).
is valid for all equidistant weights w 1 : E(T 1 ) → R + and w 2 : is valid for all monotone labelings l 1 : V (T 1 ) → R + and l 2 : are satisfied for every equidistant weight w 1 : E(T 1 ) → R + and every monotone labeling l 1 : V (T 1 ) → R + .
Proof. Statements (i) and (ii) follows directly Proposition 4.2 and the definitions of isomorphic weighted graphs and of isomorphic labeled graphs.
(iii) Let w 1 : E(T 1 ) → R + be an equidistant weight. By statement (i) of Proposition 4.2, l =l * w 1 is the unique monotone labeling satisfying (4.9) 1 2 (l * w 1 (u) −l * w 1 (v)) = w 1 ({u, w}) whenever v is a direct successor of u. By statement (ii) of Proposition 4.2,ŵ * (l * w 1 ) is the unique equidistant weight satisfying (4.10) whenever v is a direct successor of u. Equalities (4.9) and (4.10) imply the first equality in (4.8). The second one can be proved similarly.
The constant K in Definition 4.1 of equidistant trees has a simple geometric interpretation. It is the distance between the root r and arbitrary v 0 ∈ V + 0 (T ) in the metric space (V (T ), d w ), where d w is the additive metric generated by equidistant weight w.
Analogously, if l =l * w, then, for every v ∈ V (T ), the value 1 2 l(v) is the distance in (V (T ), d w ) between v and arbitrary v 0 ∈ V + 0 (T v ), where T v is the rooted subtree of T (r, w) lying below v (see (2.5), (2.6)). x 1 x 2 x 4 x 5 x 8 x 9 x 6 x 7 x 10 x 11 x 12 x 3 T Figure 7. Let x be a root of T , u 1 = x 8 and u 2 = x 12 . Then P = (u 1 , v 1 , v 2 , v 3 , v 4 , u 2 ) = (x 8 , x 5 , x 4 , x 6 , x 7 , x 12 ) and v i * = x 4 . Vertex x 4 is the first common vertex of two paths which join x 8 and x 12 with the root r = x 1 .
Lemma 4.5. Let T = T (r, w) be an equidistant tree, let l =l * w be the corresponding monotone labeling, let u 1 , u 2 be two different points of the set V + 0 (T ) and P be the path joining u 1 and u 2 in T . Then holds.
The dual form of Lemma 4.5 can be formulated as follows (cf. Theorem 2.13).
Lemma 4.6. Let T = T (r, l) be a monotone rooted tree, let w =ŵ * l and let u 1 , u 2 ∈ V + 0 (T ) and u 1 = u 2 . Then (4.11) holds for the path P joining u 1 and u 2 in T . It is well known that, for phylogenetic equidistant trees, the restriction of d w on the set of leaves of T is an ultrametric (see Theorem 7.2.5 in [24]). Lemma 4.5 and Proposition 3.6 imply the following generalization of this result.   (4.15) and is nonempty. Since δ + (r) is strictly positive, we have either r ∈ V ++ 2 (T ), or r ∈ V + 1 (T ). We first do the case r ∈ V ++ 2 (T ). Starting from the tree T (r, w) we define an equidistant tree T ∇ = T ∇ (r ∇ , w ∇ ) by the following inductive rule.
We choose an arbitrary v * ∈ V + 1 (T ) and consider the weighted rooted tree T 1 = T 1 (r 1 , w 1 ) such that where u 1 and u 2 are the neighbors of v * in T . If V + 1 (T 1 ) = ∅, then we set T ∇ (r ∇ , w ∇ ) = T 1 (r 1 , w 1 ).
Otherwise, by repeating the above-described procedure with T 1 (r 1 , w 1 ) instead of T (r, w), we obtain the weighted rooted tree T 2 (r 2 , w 2 ), etc. Since V + 1 (T ) is finite and . In the case r ∈ V + 1 (T ) we define the weighted rooted tree T 1 (r 1 , w 1 ) such that r 1 is the unique direct successor of r, and w 1 = w| E(T1) . Repeating this procedure, we find the smallest positive integer k 0 such that r k0 ∈ V ++ 2 (T ). The weighted rooted tree T k0 = T k0 (r k0 , w k0 ) is equidistant and . Now using (4.16)-(4.18) with T k0 (r k0 , w k0 ) instead of T (r, w) we can construct T ∇ (r ∇ , w ∇ ) such that V + 1 (T ∇ ) = ∅ and (4.19) hold.
Remark 4.9. The condition • there is v ∈ V (T ) such that δ + (v) 2 cannot be dropped in Proposition 4.8. If the inequality δ + (v) 1 holds for all v ∈ V (T ), then T = T (r, w) is a weighted path joining the root r with the unique vertex belonging to the one-point set V + 0 (T ). In this case we have the equality |V + 1 (T )| + 1 = |V (T )|, which together with (4.15) implies |V (T ∇ )| = 1. Thus, T ∇ is empty, contrary to Definition 2.2 An example of transition from T (r, w) to T ∇ (r ∇ , w ∇ ) is given by Figure 9.  holds for some y, z ∈ V + 0 (T ). The following proposition can be considered as a generalization of Theorem 7.2.8 from [24]. Proposition 4.11. Let T 1 (r 1 , w 1 ) and T 2 (r 2 , w 2 ) be equidistant trees. Then is valid Proof. It follows from Proposition 4.3 and Theorem 2.9.
Theorem 4.12. Let T = T (r) be a nonempty rooted tree. Then the following statements are equivalent: is valid whenever w 1 : E(T ) → R + and w 2 : E(T ) → R + are equidistant.
(ii) ⇒ (i). This implication is true if and only if where ⌉ is the logical negation symbol. Suppose there is v * ∈ V + (T ) such that δ + (v * ) = 1. If v * = r, then we have δ(v * ) = 1 and, consequently, there are exactly two nodes v 1 and v 2 such that v * is a direct successor of v 1 and v 2 is the unique direct successor of v * . Let w : E(T ) → R + be an equidistant weight. Then we can find strictly positive, pairwise distinct real numbers t 1 , t 2 , s 1 , s 2 such that (4.20) holds for every e ∈ E(T ). Let us define the weights w 1 : E(T ) → R + and w 2 : E(T ) → R + as if e = {v * , v 2 }, w(e), otherwise.
Then w 1 and w 2 are equidistant and, moreover, using formula (4.18) we obtain the equalities Since t 1 , t 2 , s 1 , s 2 are pairwise distinct, from condition (4.21) it follows that T (r, w 1 ) and T (r, w 2 ) are not isomorphic. Thus, (ii) is false. Hence, The case v * = r is more simple and can be considered similarly.
The following result is a dual form of Theorem 4.12 and it is a partial generalization of Theorem 2.9.
Theorem 4.13. Let T = T (r) be a rooted tree. Then the following statements are equivalent: is valid whenever l 1 : V (T ) → R + and l 2 : V (T ) → R + are monotone.
Proposition 4.14. Let (X, d) be a finite ultrametric space with |X| 2, let T X be the representing tree of (X, d) and let T = T (r, w) be an equidistant tree such that Then the inequality (4. 22) |V (T )| |B X | holds, where B X is the set of balls of (X, d). Moreover, the equality |V (T )| = |B X | holds if and only if T X ≃ T (r, w).
Suppose that T X ≃ T (r, w). Then we have Now, to complete the prove note that |V (T X )| = |B X | holds if and only if so the describe isomorphism of T X and T (r, w) as rooted trees follows from (4.23).

Planted equidistant trees and ultrametrics
Recall that a rooted tree T = T (r) is planted if δ + (r) = 1 holds. The following propositions clarify the "ultrametric" meaning of the constant K from the definition of equidistant trees (see formula (4.2)).  (i) There is r ∈ L such that the weighted rooted tree T (r, w) is equidistant. The proofs of these propositions are straightforward and we omit it here. It should be noted that for some planted equidistant trees T = T (r, w) the restriction d w | L×L on the set L of the leaves of T is not an ultrametric (see Figure 5). The following proposition describes the geometry of planted equidistant trees T (r, w) for which d w | L×L is an ultrametric. Proof. (i) ⇒ (ii) Suppose (i) holds. We must prove inequality (5.2). Let v * ∈ V ++ 2 (T ) such that Let P = (v 0 , . . . , v n ) be the path in T with v 0 = r and v n = v * . Since P is a path, the inequality δ + (v i ) 1 holds for every i ∈ {1, . . . , n − 1}. If there is contrary to (5.3).
Let T = T (w) be a weighted tree. We say that a node v * ∈ V (T ) is a center of T if the rooted tree T (r, w) is equidistant with r = v * . The following example (see Figure 10) shows that several distinct nodes of T can be centers of T . Proposition 5.4. Let T be a nonempty tree. Then the following statements are equivalent: (i) T is star.
(ii) There is a strictly positive weight w : E(T ) → R + such that the weighted rooted tree T (r, w) is equidistant for every r ∈ V (T ).
Proof. (i) ⇒ (ii). Let T be a star and let c be a strictly positive real number. Then T (r, w) is equidistant for every r ∈ V (T ) if we define w : E(T ) → R + as w(e) = c for every e ∈ E(T ).
The rooted trees T (u, w) and T (v * , w) are equidistant. Hence, the equalities Remark 5.5. Other curious characterizations of stars are given by Corollary 4.9 in [7] and by Corollary 8 in [8]. These characterizations as well as Proposition 5.4 describe some extremal properties of weighted stars.
The results of this paper have some natural analogies in the case when weights and labelings of rooted trees are some functions whose range is the positive cone E + of an ordered vector space E and the ultrametrics are replaced by some "generalized ultrametrics" taking their values in E + .

Funding
This investigation was partially supported in the frame of the project: Development of Mathematical Models, Numerical and Analytical Methods, and Algorithms for Solving Modern Problems of Biomedical Research. State registration number: 0117U002165.