Approximating subtree distances between Phylogenies
Abstract
We give a 5-approximation algorithm to the rooted Subtree-Prune-and-Regraft (rSPR) distance between two phylogenies, which was recently shown to be NP-complete by Bordewich and Semple [5]. This paper presents the first approximation result for this important tree distance. The algorithm follows a standard format for tree distances such as Rodrigues et al. [24] and Hein et al. [13]. The novel ideas are in the analysis. In the analysis, the cost of the algorithm uses a \cascading" scheme that accounts for possible wrong moves. This accounting is missing from previous analysis of tree distance approximation algorithms. Further, we show how all algorithms of this type can be implemented in linear time and give experimental results.
Full text
APPROXIMATING SUBTREE DISTANCES BETWEEN PHYLOGENIES M. L. BONET, K. ST. JOHN, R. MAHINDRU, AND N. AMENTA Abstract. We give a 5-approximation algorithm to the rooted Subtree-Prune-and-Regraft (rSPR) distance between two phylogenies, which was recently shown to be NP-complete by Bordewich and Semple [5]. This paper presents the first approximation result for this important tree distance. The algorithm follows a standard format for tree distances such as Rodrigues et al. [24] and Hein et al. [13]. The novel ideas are in the analysis. In the analysis, the cost of the algorithm uses a “cascading” scheme that accounts for possible wrong moves. This accounting is missing from previous analysis of tree distance approximation algorithms. Further, we show how all algorithms of this type can be implemented in linear time and give experimental results. 1. Introduction Phylogenies, or evolutionary histories, are an important tool in almost all branches of biology. They give a framework for analyzing the interrelationships between species and are indispensable in studying evolution [14]. In addition to the direct applications, techniques for building and comparing phylogenies have been used for designing vaccines [7, 16, 21], haplotyping [9, 12], and determining the evolution of human language [11, 26]. Most optimization criteria for creating phylogenies are NP-hard [1, 10]. To evaluate the correctness of proposed phylogenies (given by heuristics and approximation algorithms), the distance between the two trees is needed. Efficiency is key since algorithms that approximate the correct phylogeny often produce thousands of candidate trees (for example [17, 25]) and analyzing and visualizing these requires distances to be computed quickly [3, 15]. While the Robinson-Foulds distance [23] (basically the sum of the false positives and false negatives) is often used since it can be calculated in linear time [8], it The first author was partially supported by the Spanish grant TIN2004-04343. Also this project was partially supported by NSF-ITR 0121651/0121682 and computational support by NSF-MRI 0215942. The second author would like to thank the Centre de Recerca Matematica at the Barcelona for hosting her visit Spring 2005. 1
2 M. L. BONET, K. ST. JOHN, R. MAHINDRU, AND N. AMENTA lacks biological motivation. The TBR and rooted SPR metrics have better biological intuition [14]. Unfortunately, both are NP-hard to compute [2, 5]. In addition to its value in phylogenetic reconstruction searches, rooted SPR distance is also valuable for more complex evolutionary events. Maddison [18] showed that the number of reticulation events between two gene trees and rSPR of those two trees are closely related. Baroni et al. [4] refine this, giving elegant results about the rSPR distance and the number of complex evolutionary events. Building on this equivalence has led to advances in network models of evolution [6, 20, 22]. Our contributions are a 5-approximation for the SPR distance between rooted trees, counterexamples that point out subtle flaws of past approximation algorithms for TBR, and linear time versions of all these algorithms. With a small modification to the algorithms of [13, 24], we can get a 5- approximation algorithm for the related distance metric, rooted SPR. The proof of the approximation bounds uses a “cascading” accounting scheme to capture the complexity and illustrates the difficult situations to approximate. On the application side, we can improve the running time of these algorithms to linear time in the number of nodes. We end the paper by giving initial experimental results on the effectiveness of these algorithms on both biological and random datasets. The problem of calculating TBR and SPR distances between trees has generated much interest and past work. Hein et al. [13] had many good intuitions and defined the maximum agreement forest (MAF), which is the key to the NP-completeness proofs for both TBR and rooted SPR. Unfortunately, subtle details were missed in the proofs. Allen and Steel [2] gave a counterexample to the argument in [13] and a correct proof for the NP-completeness of TBR distance. Rodrigues et al. [24] gave a counterexample to the approximation algorithm for TBR distance in [13] and provide a new approximation algorithm. Unfortunately, the approximation bounds of [24] are not correct– we give a counterexample in Section 5. Recently, Bordewich and Semple [5] have shown that the calculation of SPR distance on rooted trees is NP-hard. Their development of a Maximum Agreement Forest for rooted SPR gives a natural way to prove bounds for approximation algorithms for this important distance metric. We use their new work to give the first approximation algorithm with provable bounds for rooted SPR distance. 2. Background This section contains the basic definitions needed for the paper, which the expert may wish to skip. We follow the standard definitions from [2, 5, 24].
APPROXIMATING SUBTREE DISTANCES 3 EAB CDFG GAB CDEF G AB C DEF CG DBAFE start → → 1 TBR tree move EAB CDFG DAB EF GC EAB CDFG →1 rSPR move Figure 1. Beginning with the start tree, we show an example of a TBR move at the top and an example of a rSPR move at the bottom. Note that the rSPR move prunes a rooted subtree and must regraft it by the same cut edge. For TBR, an edge is removed entirely and a new edge (the blue dotted edge in the figure) is chosen. Since TBR allows more freedom in reconnecting, there are pairs of trees which take strictly less TBR moves than rSPR moves (e.g. the TBR tree and the start tree). Definition 1. [5]: A rooted binary phylogenetic X-tree (or more briefly a tree) is a rooted tree where the root has degree two, all other interior nodes have degree 3 and the leaves are labeled by elements of the set X. Xis called the label set of the tree. Definition 2. [2]: A subtree prune and regraft (SPR) operation on a binary tree Tis defined as cutting any edge and thereby pruning a subtree t, then regrafting the subtree by the same cut edge to a new vertex obtained by subdividing a pre-existing edge in T−t. We apply a forced contraction to maintain the binary property of the resulting tree. The SPR distance between two trees T1and T2is the minimal number of SPR moves needed to transform T1into T2. When working with rooted trees, we refer to this distance as rooted SPR or rSPR. See Figure 1. Definition 3. [2]: A tree bisection and reconnection (TBR) operation on a binary tree Tis defined as removing any edge, giving two new subtrees t1and t2, which are then reconnected by creating a new edge betweeen the midpoints of any edge in t1and any edge in t2. We apply a forced contraction to maintain the binary property of the resulting tree. The TBR distance
4 M. L. BONET, K. ST. JOHN, R. MAHINDRU, AND N. AMENTA between two trees T1and T2is the minimal number of TBR moves needed to transform T1into T2. See Figure 1. Allen and Steel [2] showed that the TBR distance between two trees is one less than the size of the TBR maximum agreement forest, MAFTBRof the two trees. Definition 4. [2]: Suppose we have two binary trees T1and T2on the same leaf set, L. Then •An agreement forest (AF) for T1and T2is a collection F= {t1, . . . , tk}of binary trees such that, if we let Ljbe the leaf set of tjfor j∈ {1, ..., k}, then the following are satisfied: (1) L1, . . . , Lkpartitions L. (2) tj=T1|Lj=T2|Ljfor all j∈ {1, . . . , k}; and (3) for both i = 1 and i = 2 the trees {Ti(Lj) : j= 1, . . . , k}are vertex-disjoint subtrees of Ti. •Amaximum agreement forest (MAFTBR) for T1and T2is an agreement forest Ffor T1and T2for which |F| is minimal. Let m(T1, T2) := min{|F|?1 : Fis an AF for T1and T2}. Bordewich and Semple [5] showed that the rSPR distance of two trees is the same as the size of the maximum agreement forest for rooted trees of the two trees. Below we give the definition of maximum agreement forest for SPR on rooted trees, and since we focus only on rooted trees, we will call it simply maximum agreement forest for SPR or MAFSPR. Definition 5. [5]: Let Tbe a rooted binary phylogenetic X-tree (or more briefly a tree) and Va subset of the vertex set of T.T(V)is the minimal rooted subtree of Tthat connects the elements of V.T|Vis obtained from T(V)by splicing out all non-root vertices of degree two (that is, replacing the vertex and its two adjacent edges with a single edge). Definition 6. [5]: Let T1and T2be two rooted binary phylogenetic X- trees. For the purposes of definition, we regard the root of both T1and T2as a vertex ρat the end of an edge adjoined to the original root. Furthermore, we regard ρas part of the label set of T1and T2. An (rSPR) agreement forest for T1and T2is a collection {Tρ,T1,T2, . . . , Tk}where Tρis a rooted tree and T1,T2, . . . , Tkare rooted binary phylogenetic trees with label sets {Lρ,L1,L2, . . . , Lk}such that the following properties are satisfied: (1) The label sets partition X∪ρand, in particular, ρ∈ Lρ. (2) For all i∈ {ρ, 1,2, . . . , k}, Ti≃T1| Li≃T2| Li.
APPROXIMATING SUBTREE DISTANCES 5 (3) The trees in {T1(Li)|i∈ {ρ, 1,2, . . . , k}}, and the trees in {T2(Li)| i∈ {ρ, 1,2, . . . , k}} are vertex disjoint rooted subtrees of T1and T2, respectively. Definition 7. A (rSPR) maximum agreement forest (MAFSPR) for T1 and T2is the agreement forest for T1and T2with the minimal number of components. The MAFSPRneed not be unique, so in the subsequent proof, we will select an arbitrary MAFSPRFand use it consistently. Definition 8. Let Fbe an agreement forest for T1and T2. We say that a set Eof edges in T1(T2, respectively) are links with respect to Fif removing Eand then splicing out all vertices of degree two yields the agreement forest F. Two algorithms [13, 24] have been proposed to approximate MAFTBRsize (for the TBR distance) and therefore the TBR distance. In this paper, we adapt these two algorithms to get an algorithm for the rooted version of maximum agreement forest for SPR, and analyze its performance. 3. The General Algorithm The general algorithm proceeds by examining the sibling pairs in the first tree, T1and finding the corresponding leaves in the second tree, T2. At each step, the algorithm eliminates an edge or contracts identical sibling pairs, creating, in the end, an agreement forest for T1and T2. To distinguish between the original trees and the forests that are created after each step of the algorithms, we add a superscript with the step number. T0 1and T0 2 are the initial trees given to the algorithm, and Ti 1and Ti 2are the forests that result after the ith step of the algorithm. We let Nbe the count of the number of components in the agreement forest that are created from T2 by the algorithm. Nprovides an upper bound on the distance between the trees. At the start N= 1. At each step i, for each sibling pair a,bin Ti 1, we look at aand bin Ti 2and follow the cases in Figure 2. We repeat, until all components are of size 1 and then output the number of cuts, N, and the resulting agreement forest. Figure 2 gives the Hein variant of the algorithm. The Rodrigues variant differs only by a small change in Cases 1 and 2. Namely, Case 1 occurs when there is either one or two subtrees between aand bin Ti 2, and we cut them. Case 2 occurs when there are three or more subtrees between aand b, and we cut aand b. Due to Case 5, which contracts identical sibling pairs, the leaves of the forests, Ti 1and Ti 2, can differ from one step of the algorithm to another.
6 M. L. BONET, K. ST. JOHN, R. MAHINDRU, AND N. AMENTA Case 1: There’s 1 subtree between a&b in Ti 2: Cut the subtree l in Ti 2. N:= N+ 1 e ba A 1 1 Case 2: There are ≥2 subtrees between a&b in Ti 2: Cut a&bin Ti 1&Ti 2. N:= N+ 2. A ab A k 1 ee k 1 Case 3: a&bare in separate components of Ti 2: Cut a&bin Ti 1&Ti 2. N:= N+ 2. ab Case 4: bis a singleton in Ti 2: Cut bin Ti 1. Ndoes not change. ab Case 5: The sibling pair occurs in both: Replace it by “(a, b),” in Ti 1&Ti 2. Ndoes not change. ab Figure 2. The cases of Hein variant of the algorithm at step i. A slight modification is needed for the rSPR distance. Since you could have the component that contains the root in the forest for one tree that does not occur in the forest for the other tree, as in [5], we view the root as a node ρhanging off the pendant edge where the root is located in the tree. We then apply the algorithm above to trees on the extended leaf set of X∪ρ. An edge cut in Ti 2at step icorresponds to a particular edge of T2. We call this a cut edge in T2. Recall that the links are defined in terms of the initial trees, T1and T2and the MAFSPRF. Next we will define a related concept, that of virtual link, in terms of T2, the forest Ti 2, and F.
APPROXIMATING SUBTREE DISTANCES 7 Definition 9. Consider a Case 5 step in which nodes aand bare contracted into a new node (a, b). We call (a, b)acontraction and we say aand bare contracted into (a, b). If ais contracted into band bis contracted into c, we also say ais contracted into c. Definition 10. An edge ein Ti 2is a virtual link of Ti 2(or at step i) if every path between it and a leaf contains a link. If the leaf is a contraction of nodes due to Case 5, we undo the contractions. Since virtual links are defined in terms of the forests Ti 2for some step i, an edge may not be a virtual link at stage jbut could become one at some stage j+s. But once an edge becomes a virtual link, it remains a virtual link. 4. 5-Approximation for rSPR The basic idea of our proof that the algorithm gives a 5-approximation for rSPR is to look at an arbitrarily chosen MAFSPRFfor trees T1and T2. For each link of T2with respect to F, we will “charge” a cost for the edges the algorithm cuts. The overall charges on the links will equal the number of cuts made by the algorithm, and we show that the charges do not exceed 5 for any link of T2. Thus, the algorithm produces a result that is at most a multiplicative factor of 5 of the true distance. Definition 11. Let Fbe an MAFSPRfor T1and T2, and aand bbe two nodes of Ti 1and Ti 2. i) We say that aparticipates in component tof Fif either ais a leaf of t, or ais a contraction containing a leaf a0of t. ii) We say that aand bshare a component tof Fif both aand b participate in t. Notice that a contraction amay participate in multiple components of F. We split the analysis of the cases of the algorithm into two sub-cases: those in which the nodes aand bof the sibling pair we are processing share a component of the MAFSPR(the “A” cases), and those where aand b do not share any component of the MAFSPR(the “B” cases). Thus we consider Case 1A, Case 1B, etc. 4.1. Agreement Forest Lemmas. For the cost analysis of the algorithm, we prove several lemmas about the trees with respect to the underlying maximum agreement forest. Lemma 12 shows that in Cases 1A and 2A, the edges eimight not be links, but virtual links. That is, it is possible after repeated applications of Case 2 to have links “buried” in the subtrees Ai, with einot being a link. In both Hein el al. and Rodrigues et al., this
8 M. L. BONET, K. ST. JOHN, R. MAHINDRU, AND N. AMENTA subtlety was missed (Theorem 9 of [13] and Lemma 4 of [24]) and is the main reason their approximation bounds are incorrect. This is illustrated in the example in Section 5. Lemma 12. Let T1and T2be rooted phylogenetic trees on the same leaf set. Let Fbe a MAFSPRfor T1and T2, and Ti 1and Ti 2be the result after the ith step of the algorithm. Assume that aand bare a sibling pair in Ti 1, and a and bare in the same component of Ti 2, but are not siblings, so that between aand b, there are subtrees A1, A2, . . . , Ak,k≥1. Call the edges above the subtrees e1, e2, . . . , ek(see Figure 2). If aand bshare a component tof F (see Definition 11), then i) For all j, none of the leaves of Ajparticipate in the MAFSPRcomponent t. ii) e1, e2, . . . , ekare all virtual links at stage iof the algorithm. Proof of Lemma 12: Proof of i: Towards a contradiction, assume that there exists j, such that some leaf lin Ajparticipates in t. Since a,band lall share the MAFSPRcomponent t, there are nodes a0,b0and l0of the original trees such that a0,b0and l0are in t, and a0is contracted into a,b0into band l0into l. By the definition of MAFSPR,tis an induced rooted subtree of T0 1and of T0 2, and therefore l0should appear in T0 1between a0and b0. Since aand bare a sibling pair in Ti 1,l0(or a node into which l0has been contracted) has been detached from T1at some step of the algorithm prior to step i. Only Cases 2, 3 or 4 cut edges in T1. Case 2 and 3 cut the same nodes in both trees. Case 4 only cuts off a node bif bis a singleton already in T2. Therefore if l0(or a node into which l0is contracted) was detached at some earlier step in the forest for T1, it must also have been detached in the forest for T2as well. But this is not the case, and we get a contradiction. Thus Ajdoes not participate in t. Proof of ii: Recall that aand bshare a rooted component tof the MAFSPRF. Then there are leaves a0and b0in T2, contracted into aand bof Ti 2respectively, such that a0and b0belong to component t. Therefore we know that there are no links nor virtual links in the path from ato b in Ti 2. Now, if say eiis not a virtual link, that means that there is a path down from eito a leaf lof T2without a link, and hence a link-free path from a0and b0to l0. So l0would participate in t, which contradicts part i) of this lemma. ¤ The following lemma will help us analyze Case 3A. Lemma 13. Let aand bbe a sibling pair in Ti 1but contained in different components of Ti 2, and assume aand bshare a component tof F. Then
APPROXIMATING SUBTREE DISTANCES 9 the step jat which aand bwere first separated into two components was a Case 1B. Proof of Lemma 13: Let (a0, b0) be the sibling pair in Tj 1handled in step j. Step jhas to be a Case 1, since neither anor bis a singleton and Case 1 is the only one in which two non-singleton components are created. Then in Tj 2, the subtree induced by the four nodes a, b, a0, b0has sibling pairs either (a0, a) and (b, b0), or (a, b0) and (b, a0), while in Tj 1, the induced subtree has to have sibling pairs (a0, b0) and (a, b). Thus the four nodes cannot all share a component of F. Similarly, aand bcannot share one component t1of Fwhile a0and b0share another component t2, since these two components would have to intersect in T2. Since we assume aand bshare a component of F,a0and b0cannot share a component of F, and step jis a Case 1B. ¤ The following definition and lemmas will help us deal with the analysis of the first three cases when the sibling pair does not share a component, i.e., Cases 1B, 2B and 3B. We show here that there is a link for every “B” case. We use the links in tree T1since that makes the argument simpler. The definition of virtual link can be trivially adapted to the tree Ti 1. Definition 14. Let abe a node of Ti 1or Ti 2, and then let uabe the edge that has aas its lower endpoint. Definition 15. Let abe a leaf of Ti 1and let (a1, b1). . . (ak, bk)be sibling pairs handled in previous steps i1, . . . , ikof the algorithm. Suppose that ∀j, 1≤j≤k,ajdoes not share any MAFSPRcomponents with bjand that ∀j, 1≤j≤k,ajand bjare contracted into a, that is, steps i1, . . . , ikof the were all Case 1B(which is always followed by a Case 5). Define nol(a) to be the number of links among {ua1, ub1, . . . , uak, ubk},and define nop(a) to be the number of pairs k. Lemma 16. Let abe a leaf of Ti 1. Then if uais a virtual link at stage i which is not a link, then nop(a)< nol(a). Otherwise, nop(a)≤nol(a). Proof of Lemma 16. We prove it by induction on d, the depth of a. Base Case: if the depth of ais 0, then ais not contracted and is also a leaf of Ti 1. In this case nop(a) = 0 and nol(a) = 0, and the statement of the lemma holds. Induction Step: suppose the lemma holds for nodes of depth ≤d−1. Let abe a node of depth d, and suppose a= (a0, b0). We will use the following facts: •if a0and b0share a component, nop(a0) + nop(b0) = nop(a) •if a0and b0do not share a component, nop(a0)+nop(b0)+1 = nop(a) •if ua0and ub0are links, nol(a0) + nol(b0) + 2 = nol(a).
16 M. L. BONET, K. ST. JOHN, R. MAHINDRU, AND N. AMENTA 6 1 2354 6 1324 5 Figure 3. The pair of trees give a counterexample to Lemma 10 of Hein et al.. Any MAFTBR for the pair of trees has {2,3,5,6}as a component, but when the algorithm is run, the leaf 5 will be cut by a Case 1. Rodigues variant is at best a 3-approximation for rSPR. Using TBR moves that are not SPR moves (i.e. take at least 2 SPR moves to emulate), we show that the algorithm of Rodrigues et al. [24] is at best a 4-approximation. The example in Figure 5 is constructed to take full advantage of TBR (and thus does not work for SPR). In TBR, each cut edge yields an unrooted tree in the agreement forest (unlike the rooted trees in the SPR agreement forest). Figure 5 has subtrees (colored red) that are identical by the removal of an edge under TBR, but for which the algorithm (and rSPR) makes 3 cuts. A similar example shows that the algorithm of Hein et al is not a 4-approximation, as claimed, but at best a 5-approximation. We have also isolated where the proofs break down in [13, 24]. For Hein et al., they claim that Let T1and T2be rooted phylogenetic trees on the same leaf set. Then there is Fa MAFSPR for T1and T2such that the edges cut by the algorithm in Case 1 are links. (Lemma 10 of [13]). However, there are pairs of trees for which no choice of the MAFTBR will give that the edges cut in Case 1 are links. For example, see Figure 3. The analysis of Rodrigues et al. [24] also fails in a subtle way. In Lemma 4 of [24], it is claimed, without proof, that if in Case 2 of the algorithm incorrect cuts are made, that there is always a link connecting the remaining subtrees that can be charged the cost of the incorrect move. However, if you have repeated applications of Case 2, you can have remaining subtrees whose connecting edges are not links, and you will charge an edge that is not a link. Since only links can be charged, this subtle oversight undercounts the charges and makes their analysis not hold. For example, let us run the algorithm on the trees in Figure 4. Assume you start with the sibling pair (9,10) in the first tree. In the second tree,
APPROXIMATING SUBTREE DISTANCES 17 1 1 5 8 22 25 26 2 f g h i j 7 6 4 13 14 15 16 17 18 19 20 21 23 24 a b c d 9 3 10 11 12 e c g l a b d e f h k m o n j i 9 1 3 5 7 8 6 4 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2 Enlargement of the T2 subtrees between 9 &10: T Figure 4. A counterexample to the approximation to TBR claims of Rodrigues et al.. Note that the trees are constructed so that the removal of the red subtrees yields a maximum agreement forest. Recall that for TBR, the resulting MAFTBRconsists of unrooted trees. The algorithm starts by choosing a sibling pair in T1, say (9,10). By Case 2, 9 and 10 are cut in both trees, leaving behind the red subtrees in T1, listed to the left side of the picture. This is repeated for (11,12),(13,14),...,(25,26). Note that all of these are bad cuts. The same process is repeated for (3,4),(5,6),(7,8) as well as (1,2), leaving only the red subtrees. The red subtrees are then cut apart starting at their sibling pair, using 3 cuts, when a single cut at the root of the red subtrees would suffice. This example takes 3×27+26 27 = 3 + 26 27 times the optimal.
18 M. L. BONET, K. ST. JOHN, R. MAHINDRU, AND N. AMENTA T2, 9 and 10 have 3 subtrees (call them S1,S2, and S3) in between. The algorithm applies Case 2 which says to cut off the sibling pair nodes in both trees. The resulting trees after this first set of moves are missing 9 and 10. Above each of the subtrees, S1,S2, and S3is a link in the MAFTBR. So, the edges directly above the subtrees S1,S2, and S3, are now virtual links. Note that none of these were virtual links when we started, since 9 and 10 do not have links directly above them. But after 9 and 10 are deleted, they become a virtual link. Continuing on the trees in Figure 4, the algorithm examines the sibling pairs: (9,10), . . . , (25,26). For each, Case 2 is applied (where you delete the pair in both trees). This gets repeated up one level with (3,4), (5,6), and (7,8), and again with (1,2). In the analysis in [24], it iss assumed that there is a link above the remaining subtrees between 1 and 2 which we charge for removing 1 and 2. However, due to the “cascading” of the Case 2 applications, none of these remaining edges is a link, so, a non-link is incorrectly charged. The optimal edges to cut would have been the ones above all the red subtrees. But instead, the algorithm cuts off 1,2, . . . , 26, plus three edges for each of the red subtrees (the three edges are needed due to the way the red subtrees are arranged in T1and T2), using a 26 + 3 ∗27 when 27 edges would be enough. 6. Linear Running Time We can show that all variants of the algorithm can be implemented in linear time. This is a significant improvement over the stated polynomial time implementation of Rodrigues et al. [24]. Our data structure for a tree contains links from the parent to its two children and a link from the child to the parent. The queue of sibling pairs to be processed is stored a linked list. All of the algorithms look at sibling pairs in T1and find the corresponding leaves in T2. There are a linear number of sibling pairs examined by the algorithm (this is bounded above by the number of internal nodes of T1, which is linear in the number of leaves). We can find the initial sibling pairs by scanning the tree T1and placing the sibling pairs in a queue. We process each sibling pair in the queue according to the case of the algorithm that applies. The trees are preprocessed in linear time to construct a lookup table of leaf nodes. This allows leaves to be located in each tree in constant time. We need to show that each of the linear number of sibling pairs can be processed in constant time. Each case is a local operation on the trees that can be done in constant time, so, we need only show that determing
APPROXIMATING SUBTREE DISTANCES 19 the case to be applied can also be done in constant time. The number of subtrees between those leaves in T2determines which step of the algorithm is applied. Note that Cases 2 and 3 of all the variants of the algorithm perform the same action, so, we do not need to distinguish between them in our checks. To decide which case to apply, we perform several simple (and local!) operations. Each check takes constant time: •if parent(a) does not exist or parent(b) does not exist, then either aor bis a singleton in Ti 2and we must be in Case 4. •else if parent(a) = parent(b), then aand bare a sibling pair in Ti 2 and we must be in Case 5. •else if parent(a) = grandparent(b) or grandparent(a) = parent(b), then there’s a single subtree between aand band we must be in Case 1. •otherwise, the distance between aand bin Ti 2is larger than 2. This could occur because there’s many subtrees on the path between a and b(Case 2) or because aand bare in different components (Case 3). 7. Experimental Results Our initial experiments compare the two variants of the algorithm, Rodrigues et al. [24] and Hein et al. [13], applied to rSPR distances on sets of real data and also on randomly generated trees. The biology trees were generated by heuristic searches on DNA and RNA sequence data and tend to be very similar in topology. The random trees were generated for varying number of taxa under a uniform and Yule-Harding distribution. We implemented the algorithms in Java, using the code base of TreeJuxtaposer [19] (freely available at //olduvai.sourceforge.net). We chose both Java and the code base to make inclusion into tree visualization programs such as TreeJuxtaposer and TreeSet Visualization [19, 3] easier in the future. Each dataset consists of 100 trees. We did a pairwise comparison of all distinct trees in the dataset and report the average distance and standard deviation for each dataset under the two variants of the algorithms . We looked at two sets of biological trees: first, trees generated by parsimony search on animal RNA data (provided by the Hillis laboratory at UT Austin). Each tree has 128 leaves. For the Hein variant, the average distance between trees was 14.8 versus 16.1 for the Rodrigues variant. The second set of trees was also generated by parsimony search on chloroplast DNA (provided by the Jansen laboratory at UT Austin). each tree has 28 leaves. We did a pairwise comparison of all distinct trees in the dataset.
20 M. L. BONET, K. ST. JOHN, R. MAHINDRU, AND N. AMENTA For the Hein variant, the average distance between trees was 7.6 versus 8.1 for the Rodrigues variant. On the biological datasets, the Hein variant algorithm performs better experimentally. This is somewhat surprising due to the the stronger counterexample for Hein versus Sagot: we have a counterexample for Hein that take almost 4 times the optimal answer for rSPR versus the best known counterexample for Sagot that takes only 3 times. Our analysis of the algorithms in Section 4 suggests another possibility. The worst situation for the Hein variant is many cascading 2A charges. The Rodrigues variant of the algorithm is designed to minimize the problems with the cascading 2A charges, and instead performs worst when there are 1B and 3A charges (see Lemma ?? and its corresponding version in Theorem 20). This suggests that biological trees (that we analyzed) have less nesting of sibling pairs inside one another (the cascading 2A cases) and more occurrences of sibling pairs occurring in different components of the MAFSPR (the 1B and 3A cases). For trees with a different bias, we could expect to see the Rodrigues variant doing well. We then applied both variants of the algorithm to randomly generated trees under both the uniform and Yule-Hardy distributions. We created datasets of 100 trees with taxa of 10, 50, 100, and 500. We then ran both variants of the algorithm on the pairwise comparison of the trees and compared the average distance. In contrast to the biological data sets, we saw no statistically significant difference between the two variants of the algorithm, except at 10 taxa for the uniform model. For the other 7 datasets of random trees, the average distances reported were within the standard deviations. Interestingly, the average distance for random trees scales linearly with the number of taxa under both distributions of random trees. 8. Conclusion & Future Work We have given the first approximation algorithm for the important rSPR tree distance metric. We hope to improve the algorithm and give a tighter analysis of the running time, since we currently have a 5-approximation but have a counterexample that only requires a 4-approximation. We further plan are larger experimental study focusing on the effects of heuristics on the bounds achieved. 9. Acknowledgments The first author was partially supported by the Spanish grant TIN2004- 04343. Also this project was partially supported by USA NSF grants ITR 0121651 and 0121682 and computational support by MRI 0215942 and the computational facility at the CUNY Graduate Center. The second author
APPROXIMATING SUBTREE DISTANCES 21 Uniform Yule-Harding number of taxa: 10 50 100 500 10 50 100 500 Hein ave 6.28 43.30 90.70 476.80 6.27 44.77 93.73 489.16 std 0.15 2.74 7.42 92.04 0.15 2.45 7.55 88.67 Rodrigues ave 6.83 43.82 91.40 478.53 6.44 45.19 94.31 490.19 std 0.17 2.88 9.37 101.70 0.19 2.52 7.61 89.21 Animal Chloroplast RNA DNA number of taxa: 128 28 Hein ave 14.8 7.6 std 1.17 0.53 Rodrigues ave 16.1 8.1 std 1.05 0.49 Figure 5. The experimental results of the Hein and Rodrigues variants of the algorithm run on datasets of 100 trees. The table reports the average distance and standard deviation between distinct trees in the dataset. would like to thank the Centre de Recerca Matematica at the Barcelona for hosting her visit for Spring 2005. We would also like to thank the Hillis and Jansen laboratories at the University of Texas, Austin for the biological tree datasets and the Munzner group at the University of British Columbia for the TreeJuxtaposer code base used in implementing the algorithms. References [1] L. Addario-Berry, B. Chor, M. Hallett, J. Lagergren, A. Panconesi, and T. Wareham. Ancestral maximum likelihood of phylogenetic trees is hard. In Proc. 3rd International Workshop Algs. in Bioinformatics (WABI03), volume 2812 of Lecture Notes in Computer Science, pages 202–215, 2003. [2] B. Allen and M. Steel. Subtree transfer operations and their induced metrics on evolutionary trees. Annals of Combinatorics, 5:1–13, 2001. [3] Nina Amenta and Jeff Klingner. Case study: Visualizing sets of evolutionary trees. In 8th IEEE Symposium on Information Visualization (InfoVis 2002), pages 71–74, 2002. Software available at comet.lehman.cuny.edu/treeviz. [4] Mihaela Baroni, Stefan Grunewald, Vincent Moulton, and Charles Semple. Bounding the number of hybridisation events for a consistent evolutionary history. TJ. Math. Biol., 51:171–182, 2005. [5] M. Bordewich and C. Semple. On the computational complexity of the rooted subtree prune and regraft distance. Annals of Combinatorics, 8:409–423, 2005. [6] M. Bordewich and C. Semple. Computing the minimum number of hybridisation events for a consistent evolutionary history. submitted, 2006.
22 M. L. BONET, K. ST. JOHN, R. MAHINDRU, AND N. AMENTA [7] RM Bush, CA Bender, K Subbarao, NJ Cox, and WM Fitch. Predicting the evolution of human influenza a. Science, 286(5446):1921–5, 3 December 1999. [8] W. H. E. Day. Optimal algorithms for comparing trees with labeled leaves. Journal of Classification, 2:7–28, 1985. [9] Zhihong Ding, Vladimir Filkov, and Dan Gusfield. A linear-time algorithm for the perfect phylogeny haplotyping (pph) problem. In RECOMB 2005, pages 585–600, 2005. [10] L. R. Foulds and R. L. Graham. The Steiner tree problem in phylogeny is npcomplete. Advances in Appl. Math., 3:43–49, 1982. [11] R.D. Gray and Q.D. Atkinson. Language-tree divergence times support the anatolian theory of indo-european origin. Nature, 426:435–439, 2003. [12] Dan Gusfield. An overview of combinatorial methods for haplotype inference. In S. Istrail, M. Waterman, and A. Clark, editors, Computational Methods for SNPs and Haplotype Inference, volume 2983 of Lecture Notes in Computer Science, pages 9–25. Springer, 2004. [13] J. Hein, T. Jiang, L. Wang, and K. Zhang. On the complexity of comparing evolutionary trees. Discrete Applied Mathematics, 71:153–169, 1996. [14] D. M. Hillis, B. K. Mable, and C. Moritz. Molecular Systematics. Sinauer Assoc., Sunderland, Mass., 1996. [15] David Hillis, Tracy Heath, and Katherine St. John. Analysis and visualization of tree space. J. of Systematic Biology, 3:471–482, 2005. [16] David M. Hillis. Predictive evolution. Science, 286(5446):1866–1867, 3 December 1999. [17] John P. Huelsenbeck and Fredrik Ronquist. Mrbayes: Bayesian inference of phylogeny, 2001. [18] W.P. Maddison. Gene trees in species trees. Syst. Biol., 1997. [19] Tamara Munzner, Fran¸cois Guimbr`etiere, Serdar Tasiran, Li Zhang, and Yunhong Zhou. TreeJuxtaposer: Scalable tree comparison using Focus+Context with guaranteed visibility. SIGGRAPH 2003 Proceedings, published as special issue of Transactions on Graphics, pages 453–462, 2003. [20] Luay K. Nakhleh, Tandy Warnow, C. Randal Linder, and Katherine St. John. Reconstructing reticulate evolution in species–theory and practice. Journal of Computational Biology, 12(6-7), 2005. [21] V. Novitsky, U. R. Smith, P. Gilbert, M. F. McLane, P. Chigwedere, C. Williamson, T. Ndung’u, I. Klein, S. Y. Chang, T. Peter, I. Thior, B. T. Foley, S. Gaolekwe, N. Rybak, S. Gaseitsiwe, F. Vannberg, R. Marlink, T. H. Lee, and M. Essex. Human immunodeficiency virus type 1 subtype c molecular phylogeny: Consensus sequence for an aids vaccine design? Journal of Virology, 76(11):5435–5451, June 2002. [22] R.D.M. Page and M.A. Charleston. Trees within trees: phylogeny and historical associations. Trends in Ecology and Evolution, 13(9):356–359, 1998. [23] D.R. Robinson and L.R. Foulds. Comparison of phylogenetic trees. Mathematical Biosciences, 53:131–147, 1981. [24] E. M. Rodrigues, M.-F. Sagot, and Y. Wakabayashi. Some approximation results for the maximum agreement forest problem. In J. D. P. Rolim M. Goemans, K. Jansen and L. Trevisan, editors, Approximation, Randomization and Combinatorial Optimization: Algorithms and Techniques (APPROX and RANDOM 2001), Berkeley, California, Lecture Notes in Computer Science, volume 2129, pages 159–169, 2001. [25] D.L. Swofford. PAUP*. Phylogenetic Analysis Using Parsimony (*and Other Methods). Version 4. Sinauer Associates, Sunderland, Massachusetts, 2002.
APPROXIMATING SUBTREE DISTANCES 23 [26] T. Warnow, D. Ringe, and A. Taylor. Reconstructing the evolutionary history of natural languages. In Association for Computing Machinery and the Society of Industrial and Applied Mathematics, Proceedings of ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 314–322, 1996. Lenguajes y Sistemas Informaticos (LSI), Universidad Politecnica de Catalunya (UPC), 08034 Barcelona, Spain E-mail address:[email protected] Department of Mathematics & Computer Science, Graduate Center & Lehman College, City University of New York, Bronx, NY 10468 E-mail address:[email protected] Department of Computer Science, Stony Brook University, Stony Brook, NY 11794 E-mail address:[email protected] Computer Science Department,, University of California,Davis, CA 95616 E-mail address:[email protected]