Recovering normal networks from shortest inter-taxa distance information

Phylogenetic networks are a type of leaf-labelled, acyclic, directed graph used by biologists to represent the evolutionary history of species whose past includes reticulation events. A phylogenetic network is tree–child if each non-leaf vertex is the parent of a tree vertex or a leaf. Up to a certain equivalence, it has been recently shown that, under two different types of weightings, edge-weighted tree–child networks are determined by their collection of distances between each pair of taxa. However, the size of these collections can be exponential in the size of the taxa set. In this paper, we show that, if we have no “shortcuts”, that is, the networks are normal, the same results are obtained with only a quadratic number of inter-taxa distances by using the shortest distance between each pair of taxa. The proofs are constructive and give cubic-time algorithms in the size of the taxa sets for building such weighted networks.


Introduction
Distance-based methods collectively provide fundamental tools for the reconstruction and analysis of phylogenetic (evolutionary) trees. Two of the most popular and longstanding distance-based methods are UPGMA (Sokal 1958) and neighbor joining (Saitou and Nei 1987). Loosely speaking, these methods take as input a distance matrix D on a set X of taxa, whose entries are the distances between pairs of taxa in X , and return an edge-weighted phylogenetic tree on X that best represents D. Distances between taxa could, for example, measure the time since the two taxa separated from a common ancestor. Typically, the property underlying any distance-based method is the following: if T is a phylogenetic tree whose edges are assigned a positive realvalued weight, then the pairwise distances between taxa is sufficient to determine T and its edge weighting (Buneman 1974;Simões-Pereira 1969;Zaretskii 1965). This property is frequently referred to as the Tree-Metric Theorem (see Semple and Steel 2003, Theorem 7.2.6).
While there exist numerous distance-based methods for reconstructing and analysing phylogenetic trees that aim to explicitly represent the treelike evolution of species, there are only a small number of such methods for phylogenetic networks. Yet, phylogenetic networks are necessary to accurately represent the ancestral history of sets of taxa whose evolution includes non-treelike (reticulate) evolutionary processes such as hybridisation and lateral gene transfer. As a step towards developing practical distance-based methods for reconstructing and analysing phylogenetic networks, in this paper we are interested in establishing analogues of the Tree-Metric Theorem for edge-weighted phylogenetic networks. In particular, we establish two such analogues for the increasingly prominent class of tree-child networks. Briefly, we show that, under two types of weightings, edge-weighted tree-child networks on X with no shortcuts can be reconstructed from the pairwise shortest distances between taxa in time polynomial in the size of X . The first type of weighting induces an ultrametric, while the second type of weighting has the property that the pair of edges directed into a reticulation (i.e. a vertex of in-degree two) have equal weight. We envisage that these results could lead to practical algorithms to construct phylogenetic networks from distance data.
The work in this paper is not the first to consider constructing phylogenetic networks from distances. Chan et al. (2006) take a matrix of inter-taxa distances and reconstruct an ultrametric galled network having the property that there is a path between each pair of taxa having the same length as that given in the matrix, if such a network exists. Willson (2012) studied the problem of determining a phylogenetic network given the average distance between each pair of taxa, where each reticulation assigns a probability to the two edges directed into it. It is shown in Willson (2012) that such distances are enough to determine a phylogenetic network with a single reticulation cycle in polynomial time. Bordewich and Semple (2016), the original starting point for this paper, showed that (unweighted) tree-child networks can be reconstructed from the multi-set of distances between taxa in polynomial time. Other methods have been developed for building phylogenetic networks from distance data (see, for example, Willson 2007b;Yu and Nakleh 2015) but these use different approaches to associate a distance to a network than the ones presented here. In addition, Huber and Scholz (2018) considered the problem of reconstructing phylogenetic networks from so-called symbolic distances, and it would be interesting to see if our new results could extend to such distances. Two other papers (specifically Bordewich and Tokac 2016;Bordewich et al. 2017) that are particularly relevant to the work of our paper, are discussed in more detail in the next section.
Although distance based methods may be considered not as accurate as other methods such as maximum likelihood, they still have an important role in studying large datasets and gaining quick results when exploring data. This role may even be more significant for phylogenetic networks, where the complexity of inferring optimal solutions is even higher than for phylogenetic trees. The next section details some background and gives the statements of the two main results.

Main results
Throughout the paper, X denotes a non-empty finite set. A phylogenetic network N on X is a rooted acyclic directed graph with no parallel edges satisfying the following: (i) the unique root has out-degree two; (ii) the set X is the set of vertices of out-degree zero, each of which has in-degree one; and (iii) all other vertices either have in-degree one and out-degree two, or in-degree two and out-degree one.
If |X | = 1, then we additionally allow the directed graph consisting of the single vertex in X to be a phylogenetic network. A phylogenetic network, as defined here, is often referred to as a binary phylogenetic network. The vertices in X are called leaves, while the vertices of in-degree one and out-degree two are tree vertices, and the vertices of in-degree two and out-degree one are reticulations. An edge directed into a reticulation is a reticulation edge; all other edges are tree edges. An element in X is an outgroup if its parent is the root of N . Furthermore, an edge e = (u, v) is a shortcut if there is a directed path in N from u to v avoiding e. Note that, necessarily, a shortcut is a reticulation edge. In the literature, shortcuts are also known as redundant edges. Ignoring the weighting of the edges, Fig. 1(i) shows a phylogenetic network with root ρ, outgroup r , and X = {r, x 1 , x 2 , x 3 , x 4 , x 5 , x 6 }. It has exactly two reticulations, but no shortcuts. Let N be a phylogenetic network. We say N is tree-child if each non-leaf vertex in N is the parent of either a tree vertex or a leaf. Moreover, N is normal if it is tree-child and has no shortcuts. For example, the phylogenetic network in Fig. 1(i) is normal. As with all figures in this paper, edges are directed down the page. Tree-child networks and normal networks were introduced by Cardona et al. (2009) and Willson (2007aWillson ( , 2010, respectively.  Let N be a phylogenetic network on X , and let E denote the edge set of N . A weighting of N is a function w : E → R that assigns edges a non-negative real-valued weight such that tree edges are assigned a strictly positive weight. Thus reticulation edges are allowed weight zero. Let (N , w) be a weighted phylogenetic network, and let v and v be vertices in N . An up-down path P from v to v is an underlying path where, for some i, (u 1 , v) and (u i , u i+1 ), (u i+1 , u i+2 ), . . . , (u k−1 , v ) are edges in N . The length of P is the sum of the weights of the edges in P and, provided v and v are distinct, u i is the peak of P. In Fig. 1(i), there are exactly two up-down paths joining x 3 and x 5 . One path has weight 21, while the other path has weight 14. As in this example, in this paper we are interested in the inter-taxa distances in (N , w), that is, the lengths of the up-down paths connecting leaves in X . We next state two recent results (Bordewich and Tokac 2016;Bordewich et al. 2017). Both results prompted the two main results in this paper.
Let (N , w) be a weighted phylogenetic network on X and, for all x, y ∈ X , let P x,y be the set of up-down paths from x to y in (N , w). The multi-set of distances from x to y, denoted D x,y , is the multi-set of the lengths of the paths in P x,y . Similarly, the set of distances from x to y, denoted D x,y , is the set of the lengths of the paths in P x,y .
The multi-set distance matrix D of (N , w) is the |X |×|X | matrix whose (x, y)th entry is D x,y (respectively, the set distance matrix D of (N , w) is the |X | × |X | matrix whose (x, y)th entry is D x,y ) for all x, y ∈ X , in which case we say D (resp. D) is realised by (N , w).
Let (N , w) be a weighted phylogenetic network on X and let D be the multi-set distance matrix of (N , w). The underlying problem we are investigating is determining how much information D contains about (N , w). The following highlights that, even with tree edges having positive weights, the weighting of (N , w) cannot be determined exactly. Let u be a reticulation in N with parents p u and q u , and let v be the unique child of u. We can change the weighting of the edges incident with u without changing D. In particular, provided the sum of the weights of ( p u , u) and (u, v) equal w( p u , u) + w (u, v) and the sum of the weights of (q u , u) and (u, v) equal we can change the weights of ( p u , u), (q u , u), and (u, v) (keeping the weights of all other edges the same) to construct a different weighting, w say, so that D is realised by (N , w ). We refer to this change as re-weighting the edges at a reticulation of N . For example, in Fig. 1, (N , w ) has been obtained from (N , w) by reweighting the edges at both reticulations. If N has an outgroup r , a similar occurrence happens with the two edges incident with the root ρ of N . In particular, now let u be the child of ρ that is not r . Note that u is a tree vertex. Then, provided the weights of (ρ, r ) and (ρ, u) sum to w(ρ, r ) + w(ρ, u), we can change the weights of (ρ, r ) and (ρ, u) (keeping the weights of all other edges the same) to construct a different weighting, w say, so that D is realised by (N , w ). We refer to this change as re-weighting the edges at the root of N .
Let (N , w) and (N 1 , w 1 ) be two weighted phylogenetic networks on X . We say (N , w) and (N 1 , w 1 ) are equivalent if N is isomorphic to N 1 , and w 1 can be obtained from w by re-weighting the edges at each reticulation and re-weighting the edges at the root. For example, the weighted phylogenetic networks in Fig. 1 are equivalent. x 1 x 7 x 4 x 3 2 1 We now state the two recent results. A weighting w of a phylogenetic network N is equidistant if the length of all paths starting at the root and ending at a leaf are the same length. A weighting w of a phylogenetic network is a reticulation-pair weighting if, for each reticulation v in (N , w), the two edges directed into v have the same weight. The weightings of the phylogenetic networks shown in Fig. 1 are reticulationpair weightings. The weighting of the phylogenetic network shown in Fig. 2 is an equidistant weighting. The following theorems are established in Bordewich and Tokac (2016) and Bordewich et al. (2017), respectively.
Theorem 2.1 Let D be the set distance matrix of an equidistant-weighted tree-child network (N , w) on X . Then, up to equivalence, (N , w) is the unique such network realising D, in which case a member of its equivalence class can be found from D in O(|X | 4 ) time.
Theorem 2.2 Let D be the multi-set distance matrix with distinguished element r of a reticulation-pair weighted tree-child network (N , w) on X with outgroup r . Then, up to equivalence, (N , w) is the unique such network realising D, in which case a member of its equivalence class can be found from D in time O(|D| 2 ).
Theorems 2.1 and 2.2 are somewhat surprising given that, in the size of the leaf set, it is possible to have exponentially-many up-down paths connecting leaves in a tree-child network. For example, Fig. 3 shows a normal network with 2n + 1 leaves x 1 , x 2 , . . . , x 2n+1 in which there are 2 n distinct up-down paths connecting x 1 and x 2n+1 . Nevertheless, the fact that all such paths are considered is not satisfactory. The next two theorems are the two main results of this paper. They show that, up to shortcuts, we can retain the outcomes of Theorems 2.1 and 2.2 by knowing only a quadratic number of inter-taxa distances.
Let (N , w) be a weighted phylogenetic network on X . The minimum distance matrix D min of (N , w) is the |X | × |X | matrix whose (x, y)th entry is the minimum length of an up-down path joining x and y for all x, y ∈ X . We denote the (x, y)th entry in D min by d min (x, y).

Theorem 2.3
Let D min be the minimum distance matrix of an equidistant-weighted normal network (N , w) on X . Then, up to equivalence, (N , w) is the unique such network realising D min , in which case a member of its equivalence class can be found from D min in O(|X | 3 ) time. Now let (N , w) be a weighted phylogenetic network on X ∪ {r }, where r is an outgroup. For the purposes of the next theorem, the minimum distance matrix D min of (N , w) is the |X | × |X | matrix whose (x, y)th entry is d min (x, y) for all x, y ∈ X . Furthermore, the maximum distance outgroup vector, denoted d max , is the vector of length |X | whose xth coordinate is the maximum length of an up-down path joining r and x for all x ∈ X . We denote the xth coordinate in d max by d max (r, x). The distances in d max are necessary in the way we establish the next theorem. It is easily seen that it is not possible to extend Theorems 2.3 and 2.4 to tree-child networks as the distance information given in the hypothesis of these theorems is insufficient to determine shortcuts. However, these results do hold for temporal treechild networks as such networks have no shortcuts and are therefore normal. For the definition of temporal phylogenetic network, see Baroni et al. (2006).
The rest of the paper is organised as follows. The next section contains some necessary preliminaries. In particular, it contains the constructions of the three operations that underlie the inductive proofs of Theorems 2.3 and 2.4. These proofs, including explicit descriptions of the associated algorithms, are given in Sects. 4 and 5, respectively. The last section, Sect. 6, contains a brief conclusion.

Preliminaries
Let N be a phylogenetic network on X and let {s, t} be a 2-element subset of X . Denote the unique parents of s and t by p s and p t , respectively. We call {s, t} a cherry if p s = p t , that is, the parents of s and t are the same. Furthermore, we call {s, t} a reticulated cherry if either p s or p t , say p t , is a reticulation and p s is a parent of p t , in which case t is the reticulation leaf of the reticulated cherry. Observe that p s is necessarily a tree vertex. To illustrate, in Fig. 1 is a reticulated cherry in which x 4 is the reticulation leaf. In the same figure, {x 4 , x 5 } is also a reticulated cherry. The next lemma is well known for tree-child networks (for example, see Bordewich and Semple 2016). The restriction to normal networks is immediate. We will use it freely throughout the paper. In addition to using the last lemma freely, we will also use freely the following observation. If N is a normal network and u is a vertex of N , then there is a directed path from u to a leaf avoiding reticulations except perhaps u.
Let (N , w) be a weighted phylogenetic network on X . We now describe three operations on (N , w). The first and second operations underlie the inductive approach we take to prove Theorem 2.3, while the first and third operations underlie the inductive approach we take to prove Theorem 2.4. Let {s, t} be 2-element subset of X , and denote the parents of s and t by p s and p t , respectively. First suppose that {s, t} is a cherry. Let g s denote the parent of p s . Then reducing t is the operation of deleting t and its incident edge, suppressing p s , and setting the weight of the resulting edge (g s , s) to be w(g s , p s ) + w( p s , s). Now suppose that {s, t} is a reticulated cherry, in which t is the reticulation leaf. Let g s denote the parent of p s , and let g t denote the parent of p t that is not p s . Then cutting {s, t} is the operation of deleting ( p s , p t ), suppressing p s and p t , and setting the weight of the resulting edge (g s , s) to be Lastly, if g t is a tree vertex and a parent of a tree vertex or a leaf, then isolating {s, t} is the operation of deleting (g t , p t ), suppressing g t and p t , and setting the weight of the resulting edge ( p s , t) to be x 1 x 7 x 4 (N 1 , w 1 ) where g t is the parent of g t and h is the child of g t that is not p t . To illustrate the last two operations, consider Fig. 4. The weighted phylogenetic network (N 1 , w 1 ) has been obtained from the weighted phylogenetic network in Fig. 2 by cutting {x 3 , x 4 }, while (N 2 , w 2 ) has been obtained from the same network by isolating {x 3 , x 4 }.
The proof of the next lemma is straightforward and omitted. We next describe three operations on distance matrices that parallel the operations of reducing, cutting, and isolating. Let D be a distance matrix on X with each entry consisting of a single value, that is, D is an |X | × |X | matrix whose (x, y)th entry is denoted d(x, y). Let {s, t} be a 2-element subset of X .
The first operation will be used only in association with reducing t when {s, t} is a cherry. Let D be the distance matrix on X = X − {t} obtained from D by setting for all x, y ∈ X . We say that D has been obtained from D by reducing t in D.
The second operation will be used only in association with cutting {s, t} when {s, t} is a reticulation cherry in which t is the reticulation leaf, and the weighting is equidistant. Let Intuitively, X t are those leaves whose shortest path to t does not go through the parent of s, and X δ are those members of X t at minimum distance from t. To illustrate, consider the normal network with equidistant weighting shown in Fig. 2 otherwise for all y ∈ X − {t}. We say that D has been obtained from D by cutting {s, t} in D. Intuitively, elements of X δ are being used as a proxy for t in determining the minimum distances from t to members of X t − X δ in D ; the distance from t to any member of X δ remains δ. Thus, continuing the illustration, if the equidistant weighting is denoted by D and D is obtained from D by cutting {x 3 , x 4 }, then The third operation will be used only in association with isolating {s, t} when {s, t} is a reticulated cherry in which t is the reticulation leaf, r is an outgroup, and the weighting is a reticulation-pair weighting. Let r be a distinguished element in X , and let Intuitively, γ is the difference in length of the edge from the parent of s to s and the path from the parent of s to t. Let D be the distance matrix on X obtained from D by setting We say that D has been obtained from D by isolating {s, t} in D. For an illustration, consider the normal network with reticulation-pair weighting in Fig. 1 Thus if the reticulation-pair weighting is denoted by D and D is obtained from D by

Proof of Theorem 2.3
In this section, we establish Theorem 2.3. We begin with two lemmas.
Lemma 4.1 Let (N , w) be a equidistant-weighted normal network on X , where |X | ≥ 2. Let D min be the minimum distance matrix of (N , w), and let {s, t} be a 2-element subset of X such that Then {s, t} is either a cherry or a reticulated cherry of (N , w). Moreover, Proof Let p s and p t denote the parents of s and t, respectively. If p s and p t are both reticulations, then, as N is normal and w equidistant, it is easily seen that there is an element x ∈ X − {s, t} such that either d min (s, t) > d min (s, x) or d min (s, t) > d min (t, x); a contradiction (x is a descendant of a tree vertex on the shortest up-down path from s to t that is not the peak of that up-down path). Thus, either p s or p t is a tree vertex. Without loss of generality, we may assume that p s is a tree vertex. Let u denote the child of p s that is not s. If u is a tree vertex, then, as w is equidistant, where {a, b} is a cherry or reticulated cherry and a, b are descendants of u; a contradiction. Therefore u is either a leaf or a reticulation. If u is a leaf, then, as w is equidistant, u = t, in which case, {s, t} is a cherry. If u is a reticulation, then, as N is normal and it follows that the unique child of u is t, and so {s, t} is a reticulated cherry. Since N has no shortcuts and w is equidistant, it is easily checked that {s, t} is a reticulated cherry in which t is the reticulation leaf if and only if d min (s, t) > d min (t, x) for some x ∈ X − {s, t}. The lemma immediately follows. Proof By Lemma 4.1, {s, t} is either a cherry or a reticulated cherry. Furthermore, by the same lemma, if {s, t} is a reticulated cherry, we may assume, without loss of generality, that t is the reticulation leaf. Also, by Lemma 3.2, (N , w ) is an equidistantweighted normal network regardless of which of the two stated ways it is obtained from (N , w). If {s, t} is a cherry, then it is clear that the distance matrix obtained from D min by reducing t is the minimum distance matrix of (N , w ). Therefore, suppose that {s, t} is a reticulated cherry, in which case (N , w ) is obtained from (N , w) by cutting {s, t}. Let D be the distance matrix obtained from D min by cutting {s, t}. We will show that D is the minimum distance matrix D min of (N , w ). Let p s and p t denote the parents of s and t, respectively, in (N , w). Since the only up-down paths in (N , w) joining elements in X that traverse the edge ( p s , p t ) involve t, it follows that d (x, y) = d min (x, y) for all x, y ∈ X − {t}. Thus, to complete the proof, it suffices to show that d (t, x) = d min (t, x) for all x ∈ X − {t}.
Let g t denote the parent of p t that is not p s . Since N has no shortcuts, g t is not an ancestor of s. Therefore, as N is normal, there is a (directed) path from g t to a leaf, say, containing no reticulations, where / ∈ {s, t}. Note that, in what follows, we never determine but its existence underlies the rest of the proof. Let Thus, if x ∈ X t , then every minimum length up-down path in (N , w) joining t and x must traverse the edge (g t , p t ). Observe that ∈ X t as the edge directed into g t , which is a tree edge, has positive weight and every up-down path from s to traverses this edge and therefore g t , so d min (t, ) < d min (s, ). Now let and let X δ denote the subset of X t consisting of those elements x such that d min (t, x) = δ, that is, Observe that, as w is equidistant, the lengths of all directed paths from g t to a leaf are the same, and so ∈ X δ . Therefore the elements in X δ are descendants of g t . Let y ∈ X − {t}. We next determine whether or not y is a descendant of g t . First note that |X δ | = 1 if and only if g t is the parent of a leaf, in which case is the only leaf apart from t that is a descendant of g t . So assume |X δ | ≥ 2. We establish two claims: To see (i) and (ii), if y is a descendant of g t , then d min (x, y) < δ for all x ∈ X δ − {y}, so On the other hand, if y is not a descendant of g t , then It follows from (i) and (ii) that, for all y ∈ X − {t}, if y is not a descendant of g t , then Hence d (t, x) = d min (t, x) for all x ∈ X − {t}, thereby completing the proof of the lemma.
We next prove the uniqueness part of Theorem 2.3 which we restate for convenience.  (N , w). If n + k = 1, then n = 1 and k = 0, and (N , w) consists of the single vertex in X , and so uniqueness holds. If n + k = 2, then, as N is normal, n = 2 and k = 0, and (N , w) consists of two leaves attached to the root. Again, uniqueness holds as w is equidistant and so the weights of the edges incident with the leaves is fixed. Now suppose that n + k ≥ 3, so n ≥ 2, and that the uniqueness holds for all equidistant-weighted normal networks for which the sum of the number of leaves and the number of reticulations is at most n + k − 1.
Let {s, t} be a 2-element subset of X such that d min (s, t) = min{d min (x, y) : x, y ∈ X, x = y}.
By Lemma 4.1, {s, t} is either a cherry or a reticulated cherry of (N , w). If {s, t} is a reticulated cherry, then, by the same lemma, we can determine from D min which of s and t is the reticulation leaf. Thus, without loss of generality, we may assume that t is the reticulation leaf. Depending on whether {s, t} is a cherry or a reticulated cherry, let (N , w ) and D be the weighted network and distance matrix obtained from (N , w) and D min by reducing t or cutting {s, t}, respectively. By Lemma 4.2, D is the minimum distance matrix of (N , w ). Since (N , w ) either has n − 1 leaves and k reticulations if {s, t} is a cherry, or n leaves and k − 1 reticulations if {s, t} is a reticulated cherry, it follows by the induction assumption that, up to equivalence, (N , w ) is the unique equidistant-weighted normal network with minimum distance matrix D . Let (N 1 , w 1 ) be an equidistant-weighted normal network on X with minimum distance matrix D min . By Lemma 4.1, {s, t} is either a cherry or a reticulated cherry in (N 1 , w 1 ). Indeed, by the same lemma, {s, t} is a cherry in (N 1 , w 1 ) precisely if it is a cherry in (N , w). First assume that {s, t} is a cherry in (N , w). Then {s, t} is a cherry in (N 1 , w 1 ). Let (N 1 , w 1 ) be the equidistant-weighted normal network obtained from (N 1 , w 1 ) by reducing t. By Lemma 4.2, D is the minimum distance matrix of (N 1 , w 1 ) and so, by the induction assumption, (N 1 , w 1 ) and (N , w ) are equivalent. Using this equivalence and considering d min (s, t), it is easily seen that (N 1 , w 1 ) and (N , w) are equivalent. Now assume that {s, t} is a reticulated cherry in (N , w). Then {s, t} is a reticulated cherry in (N 1 , w 1 ) where, by Lemma 4.1, t is a reticulation leaf. Let (N 1 , w 1 ) be the equidistant-weighted normal network obtained from (N 1 , w 1 ) by cutting {s, t}. Since D min is the minimum distance matrix of (N 1 , w 1 ), it follows by Lemma 4.2 that D is the minimum distance matrix of (N 1 , w 1 ). Therefore, by the induction assumption, (N 1 , w 1 ) and (N , w ) are equivalent. By again considering d min (s, t), it is now easily deduced that (N 1 , w 1 ) and (N , w) are equivalent. This completes the proof of the uniqueness part of the theorem.

The algorithm
Let (N , w) be an equidistant-weighted normal network on X and let D min denote the minimum distance matrix of (N , w). We next give an algorithm which takes as input X and D min , and returns a weighted network (N 0 , w 0 ) equivalent to (N , w). Its correctness is essentially established in proving the uniqueness part of Theorem 2.3 and so a formal proof of this is omitted. However, its running time is given at the end of this section. Called Equidistant Normal, the algorithm works as follows.
1. If |X | = 1, then return the weighted phylogenetic network consisting of the single vertex in X . 2. If |X | = 2, say X = {s, t}, then return the weighted phylogenetic network with exactly two leaves s and t adjoined to the root by edges each with weight 1 2 d min (s, t). 3. Else, find a 2-element subset {s, t} of X such that d min (s, t) = min{d min (x, y) : x, y ∈ X, x = y}. (ii) Apply Equidistant Normal to input X and D . Construct (N 0 , w 0 ) from the returned weighted phylogenetic network (N 0 , w 0 ) on X as follows. If p s and p t denote the parents of s and t in (N 0 , w 0 ), respectively, then subdivide ( p s , s) and ( p t , t) with new vertices p s and p t , respectively, adjoin p s and p t via the new edge ( p s , p t ), set w 0 ( p s , s) = 1 2 d min (s, t) and w 0 ( p s , p s ) = w 0 ( p s , s) − 1 2 d min (s, t), and, for some positive real value ω such that ω ≤ 1 2 d min (s, t) and Keeping all other edge weights the same as their counterparts in (N 0 , w 0 ), return (N 0 , w 0 ).
We now consider the running time of Equidistant Normal. The algorithm takes as input a set X and an |X | × |X | distance matrix D min whose entries are the minimum length of an up-down path joining elements in X of an equidistant-weighted normal network (N , w) on X . Unless |X | ∈ {1, 2}, in which case Equidistant Normal runs in constant time, each iteration starts by finding a 2-element subset {s, t} of X such that When we recurse, the distance matrix D inputted to the recursive call is the minimum distance matrix of a normal network with either one less leaf or one less reticulation than a normal network for which D min is the minimum distance matrix. Since a normal network has at most |X | − 2 reticulations, it has O(|X |) vertices in total (Bickner 2012) (also see McDiarmid et al. 2015), and so the total number of iterations is at most O(|X |). Thus Equidistant Normal completes in O(|X | 3 ) time. This completes the proof of Theorem 2.3.

Proof of Theorem 2.4
In this section, we prove Theorem 2.4. We begin with two lemmas. Let N be a phylogenetic network, and suppose that {s, t} is either a cherry or a reticulated cherry in which t is the reticulation leaf in N . Noting that the parent of s has out-degree two and is therefore a tree vertex, we refer to the parent of s as the tree vertex of {s, t}. For the next lemma, the proof of (i) and (iii) are given in Bordewich et al. (2017), while the proof of (ii) is similar to that of Lemma 4.1 and is omitted. For |X | ≥ 2, let (N , w) be a weighted network on X ∪ {r }, where r is an outgroup. For all x, y ∈ X , we denote the value x, y). This value is crucial in obtaining the results in Bordewich et al. (2017).
Lemma 5.1 Let |X | ≥ 2, and let (N , w) be a weighted tree-child network on X ∪{r }, where r is an outgroup. Let D min be the minimum distance matrix and let d max be the maximum distance outgroup vector of (N , w). Let {s, t} be a 2-element subset of X such that Q r (s, t) = max{Q r (x, y) : x, y ∈ X, x = y}.

Then (i) {s, t} is either a cherry or a reticulated cherry of (N , w). (ii) {s, t} is a cherry of (N , w) if and only if
for all x ∈ X − {s, t}. Otherwise, {s, t} is a reticulated cherry in which t is the reticulation leaf if for some x ∈ X − {s, t}. (iii) The length of the longest up-down path in (N , w) starting at r and ending at the tree vertex of {s, t} is Q r (s, t), and d max (r, s) and d max (r, t) are each realised by up-down paths that include this tree vertex.
Lemma 5.2 Let |X | ≥ 2, and let (N , w) be a reticulation-pair weighted normal network on X ∪ {r }, where r is an outgroup. Let D min and d max be the minimum distance matrix and maximum distance outgroup vector of (N , w), respectively. Let {s, t} be a 2-element subset of X such that Q r (s, t) = max{Q r (x, y) : x, y ∈ X, x = y}.
Then the following hold: (i) If {s, t} is a cherry, then the distance matrix and distance vector obtained from D min and d max by reducing t are the minimum distance matrix D min and maximum distance outgroup vector d max realised by the weighted network (N , w ) obtained from (N , w) by reducing t.
(ii) If {s, t} is a reticulated cherry in which t is the reticulation leaf, then the distance matrix and distance vector obtained from D min and d max by isolating {s, t} are the minimum distance matrix D min and maximum distance outgroup vector d max realised by the weighted network (N , w ) obtained from (N , w) by isolating {s, t}.
Proof By Lemma 5.1, {s, t} is either a cherry or a reticulated cherry of (N , w). By the same lemma, if {s, t} is a reticulated cherry, then we may assume, without loss of generality, that t is the reticulation leaf. Furthermore, it follows by Lemma 3.2 that (N , w ) is a reticulation-pair normal network with outgroup r . If {s, t} is a cherry, then it is clear that the lemma holds. Therefore, suppose that {s, t} is a reticulated cherry, in which case (N , w ) is obtained from (N , w) by isolating {s, t}. Let D and d be the distance matrix and distance vector obtained from D min and d max by isolating {s, t}. We will show that D and d are the minimum distance matrix D min and maximum distance outgroup vector d max of (N , w ).
Let p s and p t denote the parents of s and t, respectively, and let g t denote the parent of p t that is not p s in (N , w). Note that, as N is normal, g t is a tree vertex and not an ancestor of p s . Since the only up-down paths in (N , w) joining elements in X which traverse (g t , p t ) involve t, it follows that to complete the proof, it suffices to show that Furthermore, let γ = d max (r, t) − d max (r, s). Then, by Lemma 5.1, since isolating {s, t} creates a cherry {s, t} in (N , w ), x) for all x ∈ X − {s, t}. Lastly, as w is a reticulation-pair weighting, w(g t , p t ) = w( p s , p t ), so d (t, s) = d min (t, s). This completes the proof of the lemma.
We next establish the uniqueness part of Theorem 2.4. For convenience, we restate this theorem.
Theorem 2.4 Let D min and d max be the minimum distance matrix and maximum distance outgroup vector of a reticulation-pair weighted normal network (N , w) on X ∪ {r }, where r is an outgroup. Then, up to equivalence, (N , w) is the unique such network realising D min and d max , in which case a member of its equivalence class can be found from D min and d max in O(|X | 3 ) time.
Proof of the uniqueness part of Theorem 2.4 The proof is by induction on the sum of the number n of leaves and the number k of reticulations in (N , w). If n + k = 1, then n = 1 and k = 0, and so (N , w) consists of the single vertex in X , in which case the uniqueness holds. If n + k = 2, then n = 2, k = 0, and (N , w) consists of two leaves attached to the root, one of which is the outgroup r . Again, the uniqueness holds. Now suppose that n + k ≥ 3, so n ≥ 3, and the uniqueness holds for all reticulation-pair weighted normal networks for which the sum of the number of leaves and the number of reticulations is at most n + k − 1.
Let {s, t} be a 2-element subset of X such that Q r (s, t) = max{Q r (x, y) : x, y ∈ X, x = y}.
By Lemma 5.1, {s, t} is either a cherry or a reticulated cherry. If {s, t} is a reticulated cherry, then, by the same lemma, D min and d max determine whether s or t is the reticulation leaf. Thus, without loss of generality, we may assume that t is the reticulation leaf. Let (N , w ), D , and d be the weighted phylogenetic network, distance matrix, and distance vector obtained from (N , w), D min , and d max , respectively, by reducing t if {s, t} is a cherry or isolating {s, t} if {s, t} is a reticulated cherry. Now (N , w ) either has n − 1 leaves and k reticulations, or n leaves and k − 1 reticulations, and so, by Lemma 5.2 and the induction assumption, up to equivalence, (N , w ) is the unique reticulation-pair weighted normal network with outgroup r whose minimum distance matrix is D and maximum distance outgroup vector is d . Let (N 1 , w 1 ) be a reticulation-pair weighted normal network on X with outgroup r whose minimum distance matrix is D min and maximum distance outgroup vector is d max . By Lemma 5.1, {s, t} is either a cherry or a reticulated cherry in (N 1 , w 1 ). Moreover, by the same lemma, {s, t} is a cherry in (N 1 , w 1 ) if and only if it is a cherry in (N , w). First assume that {s, t} is a cherry in (N , w). Let (N 1 , w 1 ) be the reticulation-pair weighted normal network with outgroup r obtained from (N 1 , w 1 ) by reducing t. By Lemma 5.2, D and d are the minimum distance matrix and maximum distance outgroup vector of (N 1 , w 1 ). Thus, by the induction assumption, (N 1 , w 1 ) and (N , w ) are equivalent. Using this equivalence and considering d min (s, t), it is easily checked that (N 1 , w 1 ) and (N , w) are equivalent. Now assume that {s, t} is a reticulated cherry in (N , w). Then {s, t} is a reticulated cherry in (N 1 , w 1 ) where, by Lemma 5.1, t is the reticulation leaf. Let (N 1 , w 1 ) be the reticulation-pair weighted normal network with outgroup r obtained from (N 1 , w 1 ) by isolating {s, t}. Since D min and d max are the minimum distance matrix and maximum distance outgroup vector of (N 1 , w 1 ), it follows by Lemma 5.2 that D and d are the minimum distance matrix and maximum distance outgroup vector of (N 1 , w 1 ). So, by the induction assumption, (N 1 , w 1 ) and (N , w ) are equivalent.
In (N , w), let p s and p t denote the parents of s and t, respectively, and let g t denote the parent of p t that is not p s . Since N is normal, g t is a tree vertex and not an ancestor of p s . We next show that there is precisely one choice for the attachment of the edge in (N , w ), and thus also in (N 1 , w 1 ), corresponding to (g t , p t ) in (N , w).
Since N is normal, there is a (directed) path P from g t to a leaf, say , containing no reticulations. Since w is reticulation-pair, d min (t, ) is the length of the up-down path whose union of edges consists of the edges in {(g t , p t ), ( p t , t)} and P. Thus, if we knew , then, to locate the place in (N , w ) at which to insert g t , we simply start at and follow the unique path against the direction of the edges towards the root until we reach a distance from , since the bracketed term gives the combined length of (g t , p t ) and ( p t , t). However, a priori, we do not know . So there are potentially O(n) places in (N , w ) at which we could insert g t . We claim there is exactly one such place to insert g t so that the resulting weighted network (after subdividing the edge incident with t, inserting a new vertex p t and adding the new edge (g t , p t )) has minimum distance matrix D min and maximum distance outgroup vector d max and no zero-length tree-edges.
We call a leaf a candidate leaf if • the path starting at and going against the direction of the edges (and, thus, towards the root) a distance d min (t, ) − (d max (r, t) − Q r (s, t)) does not traverse a reticulation; • the unique position along this path at a distance d min (t, )−(d max (r, t)−Q r (s, t)) from , denoted g , is not a vertex, that is, g is partway along an edge of (N , w ); and • g is not an ancestor of p s .
Note that the unknown leaf is a candidate leaf. Moreover, if the second or third conditions were not satisfied and we tried to reconstruct a network by inserting g t at position g we would either need to introduce zero-weight tree edges or we would introduce a shortcut, contradicting the assumptions about (N , w).
We now show that if g is not at the same position as g t , then g is an ancestor of g t . Suppose not, then a minimum length up-down path in (N , w) from t to via g t must traverse the edge containing position g . But then the length of this up-down path is not d min (t, ), by definition of g . Likewise, a minimum length up-down path in (N , w) from t to via p s must traverse the edge containing position g (since p s is not a descendant of g ). Again the length of this up-down path is not d min (t, ). This contradicts the fact that (N , w) has minimum distance matrix D min .
Finally, observe that if g is an ancestor of g t , then the minimum path length between t and in the network obtained from (N , w ) by adding an edge (g , p t ) will be strictly larger than d min (t, ). This establishes the claim. Moreover, the correct position g t can be found as the unique common descendant of all candidate positions g . It now follows that, as (N 1 , w 1 ) and (N , w ) are equivalent, (N 1 , w 1 ) and (N , w) are equivalent. This completes the proof of the uniqueness part of Theorem 2.4.

The algorithm
Let (N , w) be a reticulation-pair weighted normal network on X ∪ {r }, where r is an outgroup, and let D min and d max denote the minimum distance matrix and maximum distance outgroup vector of (N , w). The following algorithm, called Reticulation-Pair Normal, takes as input X, D min , and d max and returns a weighted network (N 0 , w 0 ) equivalent to (N , w) in which all reticulation edges have weight zero. As before, the proof of its correctness is essentially established in proving the uniqueness part of the theorem and so is omitted. But its running time is given at the end.
1. If |X | = 1, then return the weighted phylogenetic network consisting of the single vertex in X .
2. If |X | = 2, say X = {r, s}, then return the phylogenetic network (N 0 , w 0 ) consisting of leaves r and s adjoined to the root ρ with (ρ, r ) and (ρ, s) positively weighted so that d max (r, s) = w(ρ, r ) + w(ρ, s). 3. Else, find a 2-element subset {s, t} of X such that Keeping all other edges weight the same as their counterparts in (N 0 , w 0 ), return (N 0 , w 0 ). (b) Else ({s, t} is a reticulated cherry, in which t is the reticulation leaf if there exists an x ∈ X − {s, t} such that d min (t, x) < d min (s, x) + d max (r, t) − d max (r, s)), (i) Isolate {s, t} in D min and d max to give the distance matrix D and distance vector d on X . (ii) Apply Reticulation-Pair Normal to input X ∪ {r }, D , and d .
Construct (N 0 , w 0 ) from the returned weighted phylogenetic network (N 0 , w 0 ) on X ∪ {r } as follows. For each leaf in X − {s, t}, follow the unique path starting at and going against the direction of the edges towards the root until either a reticulation or a distance from is reached. Amongst the points reached (which are not reticulations), insert a new vertex g t in the unique point that is a descendant of all the other points reached and weight the edges incident with g t appropriately. Now, subdivide the edge incident with t with a new vertex p t , add the new edge (g t , p t ), and set w 0 ( p s , p t ) = 0, w 0 (g t , p t ) = 0, and where p s is the parent of s. Keeping all other edges the same weight as their counterparts in (N 0 , w 0 ), return (N 0 , w 0 ).
For the running time, Reticulation-Pair Normal takes as input a set X ∪ {r }, a |X | × |X | distance matrix D min whose entries are the minimum-length of an up-down path joining elements in X , and a distance vector d max of length |X | whose entries are the maximum length of an up-down path from r to each element in X of a reticulationpair normal network (N , w) on X ∪ {r }, where r is an outgroup. If |X | ∈ {1, 2}, then the algorithm runs in constant time. If |X | ≥ 3, each iteration begins by finding a 2-element subset {s, t} of X such that Q r (s, t) = max{Q r (x, y) : x, y ∈ X, x = y}.
This takes O(|X | 2 ) time, and once such a 2-element subset is found, we construct D and d . This construction is done in one of two ways depending on whether or not for all x ∈ X − {s, t}. If, for some x, we need to additionally check which of d min (s, x) + d max (r, t) − d max (r, s) < d min (t, x) and d min (s, x) + d max (r, t) − d max (r, s) > d min (t, x) holds. Thus the determination of which way to construct D and d can be done in O(|X |) time. Whether D and d is constructed by reducing an element of X or isolating a 2-element subset of X , the construction can be done in O(|X |) time. Once (N 0 , w 0 ) is returned, it takes constant time to augment to (N 0 , w 0 ) if D and d have been obtained from D min and d max by reducing. Otherwise, we need to find the unique place in (N 0 , w 0 ) to insert g t . Since (N , w) has O(|X |) vertices in total (Bickner 2012), it takes at most O(|X | 2 ) time to find the possible locations in which to insert g t . Finding the correct location, the one that is a descendant of all the others, can be done in O(|X |) time by repeatedly deleting vertices of out-degree zero until the first possible location appears as a vertex of out-degree zero. Thus (N 0 , w 0 ) can be returned in O(|X | 2 ) time, and so the total time of each iteration is O(|X | 2 ).
When we recurse, the distance matrix D and distance vector d inputted to the recursive call is the minimum distance matrix and maximum distance outgroup vector of a normal network with either one less leaf or one less reticulation than (N , w). As normal networks have at most |X | − 2 reticulations, and therefore O(|X |) vertices in total (Bickner 2012), the total number of iterations is at most O(|X |). Hence Reticulation-Pair Normal completes in O(|X | 3 ) time, thereby completing the proof of Theorem 2.4.

Conclusion
In this paper, we established two analogues of the Tree-Metric Theorem for normal networks. The first analogue, Theorem 2.3, shows that a normal network with an equidistant weighting is determined, up to a certain equivalence, by the minimumlengths of the up-down paths joining pairs of taxa. The second analogue, Theorem 2.4, shows that a normal network with an outgroup r and reticulation-pair weighting is determined, up to a certain equivalence, by the minimum-lengths of the up-down paths joining pairs of taxa as well as the maximum-lengths of the up-down paths joining r and a single taxa. Previously, these results were established by using the lengths of all up-down paths joining pairs of taxa of which there could be exponentially-many such lengths.
Normal networks are a rich class of phylogenetic networks. Knowing that a single measure of distance between each pair of taxa is sufficient to determine such networks with certain weightings, we are now interested in developing a practical algorithm for constructing normal phylogenetic networks from distances. On the biological side, this will require the development of appropriate models to take into account that we aim to reconstruct networks from their minimal distances. On the algorithmic side, the main issue will be to develop approaches to deal with noisy data. In this regards, the distancebased, tree-building algorithm neighbor joining (Saitou and Nei 1987) may provide some clues on how to proceed. More specifically, the Neighbor Joining algorithm is based on recursively constructing trees by picking pairs of taxa which correspond to cherries in case the input distance is a tree-distance. Thus, to build normal networks from biological distances, one approach could be to develop an algorithm based on recursively picking pairs of taxa corresponding to cherries and reticulated cherries.