An efficient algorithm for testing the compatibility of phylogenies with nested taxa
 Yun Deng†^{1} and
 David FernándezBaca†^{1}Email authorView ORCID ID profile
https://doi.org/10.1186/s1301501700997
© The Author(s) 2017
Received: 23 December 2016
Accepted: 4 March 2017
Published: 16 March 2017
Abstract
Background
Semilabeled trees generalize ordinary phylogenetic trees, allowing internal nodes to be labeled by higherorder taxa. Taxonomies are examples of semilabeled trees. Suppose we are given collection \(\mathcal {P}\) of semilabeled trees over various subsets of a set of taxa. The ancestral compatibility problem asks whether there is a semilabeled tree that respects the clusterings and the ancestor/descendant relationships implied by the trees in \(\mathcal {P}\). The running time and space usage of the best previous algorithm for testing ancestral compatibility depend on the degrees of the nodes in the trees in \(\mathcal {P}\).
Results
We give a algorithm for the ancestral compatibility problem that runs in \(O(M_{\mathcal {P}}\log ^2 M_{\mathcal {P}})\) time and uses \(O(M_{\mathcal {P}})\) space, where \(M_{\mathcal {P}}\) is the total number of nodes and edges in the trees in \(\mathcal {P}\).
Conclusions
Taxonomies enable researchers to expand greatly the taxonomic coverage of their phylogenetic analyses. The running time of our method does not depend on the degrees of the nodes in the trees in \(\mathcal {P}\). This characteristic is important when taxonomies—which can have nodes of high degree—are used.
Keywords
Algorithms Phylogenetics Supertrees TaxonomiesIntroduction
In the tree compatibility problem, we are given a collection \(\mathcal {P}= \{\mathcal {T}_1, \mathcal {T}_2, \ldots , \mathcal {T}_k\}\) of rooted phylogenetic trees with partially overlapping taxon sets. \(\mathcal {P}\) is called a profile and the trees in \(\mathcal {P}\) are the input trees. The question is whether there exists a tree \(\mathcal {T}\) whose taxon set is the union of the taxon sets of the input trees, such that \(\mathcal {T}\) exhibits the clusterings implied by the input trees. That is, if two taxa are together in a subtree of some input tree, then they must also be together in some subtree of \(\mathcal {T}\). The tree compatibility problem has been studied for over three decades [1–4].
In the original version of the tree compatibility problem, only the leaves of the input trees are labeled. Here we study a generalization, called ancestral compatibility, in which taxa may be nested. That is, the internal nodes may also be labeled; these labels represent higherorder taxa, which are, in effect, sets of taxa. Thus, for example, an input tree may contain the taxon Glycine max (soybean) nested within a subtree whose root is labeled Fabaceae (the legumes), itself nested within an Angiosperm subtree. Note that leaves themselves may be labeled by higherorder taxa. The question now is whether there is a tree \(\mathcal {T}\) whose taxon set is the union of the taxon sets of the input trees, such that \(\mathcal {T}\) exhibits not only the clusterings among the taxa, but also the ancestor/descendant relationships among taxa in the input trees. Our main result is a \(O(M_{\mathcal {P}}\log ^2 M_{\mathcal {P}})\) algorithm for the compatibility problem for trees with nested taxa, where \(M_{\mathcal {P}}\) is the total number of nodes and edges in the trees in \(\mathcal {P}\).
Background
The tree compatibility problem is a basic special case of the supertree problem. A supertree method is a way to synthesize a collection of phylogenetic trees with partially overlapping taxon sets into a single supertree that represents the information in the input trees. The supertree approach, proposed in the early 90s [5, 6], has been used successfully to build largescale phylogenies [7].
The original supertree methods were limited to input trees where only the leaves are labeled. Page [8] was among the first to note the need to handle phylogenies where internal nodes are labeled, and taxa are nested. A major motivation is the desire to incorporate taxonomies as input trees in largescale supertree analyses, as way to circumvent one of the obstacles to building comprehensive phylogenies: the limited taxonomic overlap among different phylogenetic studies [9]. Taxonomies group organisms according to a system of taxonomic rank (e.g., family, genus, and species); two examples are the NCBI taxonomy [10] and the Angiosperm taxonomy [11]. Taxonomies spanning a broad range of taxa provide structure and completeness that might be hard to obtain otherwise. A recent example of the utility of taxonomies is the Open Tree of Life, a draft phylogeny for over 2.3 million species [12].
Taxonomies are not, strictly speaking, phylogenies. In particular, their internal nodes and some of their leaves are labeled with higherorder taxa. Nevertheless, taxonomies have many of the same mathematical characteristics as phylogenies. Indeed, both phylogenies and taxonomies are semilabeled trees [13, 14]. We will use this term throughout the rest of the paper to refer to trees with nested taxa.
The fastest previous algorithm for testing ancestral compatibility, based on earlier work by Daniel and Semple [15], is due to Berry and Semple [16]. Their algorithm runs in \(O \left( \log ^2 n \cdot \tau _\mathcal {P}\right)\) time using \(O \left( \tau _\mathcal {P}\right)\) space. Here, n is the number of distinct taxa in \(\mathcal {P}\) and \(\tau _\mathcal {P}= \sum _{i = 1}^k \sum _{v \in I(\mathcal {T}_i)} d(v)^2\), where \(I(\mathcal {T}_i)\) is the set of internal nodes of \(\mathcal {T}_i\), for each \(i \in \{1, \ldots , k\}\), and d(v) is the degree of node v. While the algorithm is polynomial, its dependence on node degrees is problematic: semilabeled trees can be highly unresolved (i.e., contain nodes of high degree), especially if they are taxonomies.
Our contributions
As stated earlier, our main result is an algorithm to test ancestral compatibility that runs in \(O(M_{\mathcal {P}}\log ^2 M_{\mathcal {P}})\) time, using \(O(M_{\mathcal {P}})\) space. These bounds are independent of the degrees of the nodes of the input trees, a valuable characteristic for large datasets that include taxonomies. To achieve our result, we extend ideas from our recent algorithm for testing the compatibility of ordinary phylogenetic trees [2]. As in that algorithm, a central notion in the current paper is the display graph of profile \(\mathcal {P}\), denoted \(H_{\mathcal {P}}\). This is the graph obtained from the disjoint union of the trees in \(\mathcal {P}\) by identifying nodes that have the same label (see the section titled "Testing ancestral compatibility"). The term “display graph” was introduced by Bryant and Lagergren [17], but similar ideas have been used elsewhere. In particular, the display graph is closely related to Berry and Semple’s restricted descendancy graph [16], a mixed graph whose directed edges correspond to the (undirected) edges of \(H_{\mathcal {P}}\) and whose undirected edges have no correspondence in \(H_{\mathcal {P}}\). The second kind of edges are the major component of the \(\tau _\mathcal {P}\) term in the time and space complexity of Berry and Semple’s algorithm. The absence of such edges makes \(H_{\mathcal {P}}\) significantly smaller than the restricted descendancy graph. Display graphs also bear some relation to tree alignment graphs [18].
Here, we exploit the display graph more extensively than in our previous work. Although the display graph of a collection of semilabeled trees is more complex than that of a collection of ordinary phylogenies, we are able to extend several of the key ideas—notably, that of a semiuniversal label—to the general setting of semilabeled trees. As in [2], the implementation relies on a dynamic graph data structure, but it requires a more careful amortized analysis based on a weighing scheme.
Contents
This paper has five sections, in addition to this introduction. The section titled "Preliminaries" presents basic definitions regarding graphs, semilabeled trees, and ancestral compatibility. The section titled "The display graph" introduces the display graph and discusses its properties. The section titled "Testing ancestral compatibility" presents \(\mathrm{BuildNT}\), our algorithm for testing ancestral compatibility. We first present the algorithm recursively, and then show how to transform it into an iterative algorithm, \(\mathrm{BuildNT}_\mathrm{N}\), that is easier to implement. We also give an example of the execution of \(\mathrm{BuildNT_N}\). The "Implementation" section gives the implementation details for \(\mathrm{BuildNT_N}\). The "Discussion" section gives some concluding remarks.
Preliminaries
For each positive integer r, [r] denotes the set \(\{1, \ldots , r\}\).
Graph notation
Let G be a graph. V(G) and E(G) denote the node and edge sets of G. The degree of a node \(v \in V(G)\) is the number of edges incident on v. A tree is an acyclic connected graph. In this paper, all trees are assumed to be rooted. For a tree T, r(T) denotes the root of T. Suppose \(u, v \in V(T)\). Then, u is an ancestor of v in T, denoted \(u \le _T v\), if u lies on the path from v to r(T) in T. If \(u \le _T v\), then v is a descendant of u. Node u is a proper descendant of v if u is a descendant of v and \(v \ne u\). If \(\{u,v\} \in E(T)\) and \(u \le _T v\), then u is the parent of v and v is a child of u. If neither \(u \le _T v\) nor \(v \le _T u\) hold, then we write \(u \parallel _T v\) and say that u and v are not comparable in T.
Semilabeled trees
A semilabeled tree is a pair \(\mathcal {T}= (T,\phi )\) where T is a tree and \(\phi\) is a mapping from a set \(L(\mathcal {T})\) to V(T) such that, for every node \(v \in V(T)\) of degree at most two, \(v \in \phi (L(\mathcal {T}))\). \(L(\mathcal {T})\) is the label set of \(\mathcal {T}\) and \(\phi\) is the labeling function of \(\mathcal {T}\).
For every node \(v \in V(T)\), \(\phi ^{1}(v)\) denotes the (possibly empty) subset of \(L(\mathcal {T})\) whose elements map into v; these elements as the labels of v (thus, each label is a taxon). If \(\phi ^{1}(v) \ne \emptyset\), then v is labeled; otherwise, v is unlabeled. Note that, by definition, every leaf in a semilabeled tree is labeled. Further, any node, including the root, that has a single child must be labeled. Nodes with two or more children may be labeled or unlabeled. A semilabeled tree \(\mathcal {T}= (T,\phi )\) is singularly labeled if every node in T has at most one label; \(\mathcal {T}\) is fully labeled if every node in T is labeled.
Semilabeled trees, also known as X trees, generalize ordinary phylogenetic trees, also known as phylogenetic X trees [14]. An ordinary phylogenetic tree is a semilabeled tree \(\mathcal {T}= (T,\phi )\) where r(T) has degree at least two and \(\phi\) is a bijection from \(L(\mathcal {T})\) into leaf set of T (thus, internal nodes are not labeled).
Let \(\mathcal {T}= (T,\phi )\) be a semilabeled tree and let \(\ell\) and \(\ell '\) be two labels in \(L(\mathcal {T})\). If \(\phi (\ell ) \le _T \phi (\ell ')\), then we write \(\ell \le _\mathcal {T}\ell '\), and say that \(\ell '\) is a descendant of \(\ell\) in \(\mathcal {T}\) and that \(\ell\) is an ancestor of \(\ell '\). We write \(\ell <_\mathcal {T}\ell '\) if \(\phi (\ell ')\) is a proper descendant of \(\phi (\ell )\). If \(\phi (\ell ) \parallel _T \phi (\ell ')\), then we write \(\ell \parallel _\mathcal {T}\ell '\) and say that \(\ell\) and \(\ell '\) are not comparable in \(\mathcal {T}\). If \(\mathcal {T}\) is fully labeled and \(\phi (\ell )\) is the parent of \(\phi (\ell ')\) in T, then \(\ell\) is the parent of \(\ell '\) in \(\mathcal {T}\) and \(\ell '\) is a child of \(\ell\) in \(\mathcal {T}\); two labels with the same parent are siblings.
Two semilabelled trees \(\mathcal {T}= (T,\phi )\) and \(\mathcal {T}' = (T', \phi ')\) are isomorphic if there exists a bijection \(\psi : V(T) \rightarrow V(T')\) such that \(\phi ' = \psi \circ \phi\) and, for any two nodes \(u, v \in V(T)\), \((u,v) \in E(T)\) if and only \((\psi (u), \psi (v)) \in E(T')\).
Let \(\mathcal {T}= (T,\phi )\) be a semilabeled tree. For each \(u \in V(T)\), X(u) denotes the set of all labels in the subtree of T rooted at u; that is, \(X(u) = \bigcup _{v: u \le _T v} \phi ^{1}(v)\). X(u) is called a cluster of T. \({\mathrm{Cl}}(\mathcal {T})\) denotes the set of all clusters of \(\mathcal {T}\). It is well known [14, Theorem 3.5.2] that a semilabeled tree \(\mathcal {T}\) is completely determined by \({\mathrm{Cl}}(\mathcal {T})\). That is, if \({\mathrm{Cl}}(\mathcal {T}) = {\mathrm{Cl}}(\mathcal {T}')\) for some other semilabeled tree \(\mathcal {T}'\), then \(\mathcal {T}\) is isomorphic to \(\mathcal {T}'\).
Suppose \(A \subseteq L(\mathcal {T})\) for a semilabeled tree \(\mathcal {T}= (T,\phi )\). The restriction of \(\mathcal {T}\) to A, denoted \(\mathcal {T}A\), is the semilabeled tree whose cluster set is \({\mathrm{Cl}}(\mathcal {T} A) = \{X \cap A : X \in {\mathrm{Cl}}(\mathcal {T}) \text { and } X \cap A \ne \emptyset \}.\) Intuitively, \(\mathcal {T} A\) is obtained from the minimal rooted subtree of T that connects the nodes in \(\phi (A)\) by suppressing all vertices of degree two that are not in \(\phi (A)\).
 (i)
if \(\ell _1 <_\mathcal {\mathcal {T}'} \ell _2\), then \(\ell _1 <_\mathcal {T}\ell _2\), and
 (ii)
if \(\ell _1 \parallel _\mathcal {\mathcal {T}'} \ell _2\), then \(\ell _1 \parallel _\mathcal {\mathcal {T}} \ell _2\).
Lemma 1
(Bordewich et al. [13]) Let \(\mathcal {T}\) and \(\mathcal {T}'\) be semilabelled trees such that \(L(\mathcal {T}') \subseteq L(\mathcal {T})\). Then \(\mathcal {T}\) ancestrally displays \(\mathcal {T}'\) if and only if \(D(\mathcal {T}') \subseteq D(\mathcal {T})\) and \(N(\mathcal {T}') \subseteq N(\mathcal {T})\).
Profiles and ancestral compatibility
Lemma 2
Suppose \(\mathcal {P}\) is ancestrally compatible and let \(\mathcal {T}\) be a tree that ancestrally displays \(\mathcal {P}\). Then, for any \(X \subseteq L(\mathcal {P})\), \(\mathcal {T} X\) ancestrally displays \(\mathcal {P} X\).
For technical reasons, fully labeled trees are easier to handle than those that are not. Suppose \(\mathcal {P}\) contains trees that are not fully labeled. We can convert \(\mathcal {P}\) into an equivalent profile \(\mathcal {P}'\) of fullylabeled trees as follows. For each \(i \in [k]\), let \(l_i\) be the number of unlabeled nodes in \(T_i\). Create a set \(L'\) of \(n' = \sum _{i \in [k]} l_i\) labels such that \(L' \cap L(\mathcal {P}) = \emptyset\). For each \(i \in [k]\) and each \(v \in V(T_i)\) such that \(\phi _i^{1}(v) = \emptyset\), make \(\phi _i^{1}(v) = \{\ell \}\), where \(\ell\) is a distinct element from \(L'\). We refer to \(\mathcal {P}'\) as the profile obtained by adding distinct new labels to \(\mathcal {P}\) (see Fig. 1).
Lemma 3
(Daniel and Semple [15]) Let \(\mathcal {P}'\) be the profile obtained by adding distinct new labels to \(\mathcal {P}\). Then, \(\mathcal {P}\) is ancestrally compatible if and only if \(\mathcal {P}'\) is ancestrally compatible. Further, if \(\mathcal {T}\) is a semilabeled phylogenetic tree that ancestrally displays \(\mathcal {P}'\), then \(\mathcal {T}\) ancestrally displays \(\mathcal {P}\).
From this point forward, we make the following assumption.
Assumption 1
For each \(i \in [k]\), \(\mathcal {T}_i\) is fully and singularly labeled.
By Lemma 3, no generality is lost in assuming that all trees in \(\mathcal {P}\) are fully labeled. The assumption that the trees are singularly labeled is inessential; it is only for clarity. Note that, even with the latter assumption, a tree that ancestrally displays \(\mathcal {P}\) is not necessarily singularly labeled. Figure 2 illustrates this fact.
The display graph
\(H_{\mathcal {P}}\) has \(O(M_{\mathcal {P}})\) nodes and edges, and can be constructed in \(O(M_{\mathcal {P}})\) time. By Assumption 1, there is a bijection between the labels in \(L(\mathcal {P})\) and the nodes of \(H_{\mathcal {P}}\). Thus, from this point forward, we refer to the nodes of \(H_{\mathcal {P}}\) by their labels. It is easy to see that if \(H_{\mathcal {P}}\) is not connected, then \(\mathcal {P}\) decomposes into labeldisjoint subprofiles, and that \(\mathcal {P}\) is compatible if and only if each subprofile is compatible. Thus, without loss of generality, we shall assume the following.
Assumption 2
\(H_{\mathcal {P}}\) is connected.
Positions
Our compatibility algorithm processes the trees in \(\mathcal {P}\) from the top down, starting at the roots. We refer to the set of nodes in \(\mathcal {P}\) currently being considered as a “position”. The algorithm advances from the current position to the next by replacing certain nodes in the current position by their children. Formally, a position (for \(\mathcal {P}\)) is a vector \(U = (U(1), U(2), \ldots , U(k))\), where \(U(i) \subseteq L(\mathcal {T}_i)\), for each \(i \in [k]\). Since labels may be shared among trees, we may have \(U(i) \cap U(j) \ne \emptyset\), for \(i, j \in [k]\) with \(i \ne j\). For each \(i \in [k]\), let \(\mathrm{Desc}_i(U) = \{\ell : \ell ' \le _{\mathcal {T}_i} \ell , \text { for some } \ell ' \in U(i)\}\), and let \(\mathrm{Desc}_\mathcal {P}(U) = \bigcup _{i \in [k]} \mathrm{Desc}_i(U)\).
 (V1)
if \(U(i) \ge 2\), then the elements of U(i) are siblings in \(\mathcal {T}_i\) and
 (V2)
\(\mathrm{Desc}_i(U) = \mathrm{Desc}_\mathcal {P}(U) \cap L(\mathcal {T}_i)\).
Lemma 4
Proof
By (V2), we have that \(\mathcal {T}_i\mathrm{Desc}_i(U)\) and \(\mathcal {T}_i \mathrm{Desc}_\mathcal {P}(U) \cap L(\mathcal {T}_i)\) are isomorphic, for each \(i \in [k]\). The lemma then follows from the definition of \(\mathcal {P} \mathrm{Desc}_\mathcal {P}(U)\). \(\square\)
For any valid position U, \(H_{\mathcal {P}}(U)\) denotes the subgraph of \(H_{\mathcal {P}}\) induced by \(\mathrm{Desc}_\mathcal {P}(U)\).
Observation 1
For any valid position U, \(H_{\mathcal {P}}(U)\) is the subgraph of \(H_{\mathcal {P}}\) obtained by deleting all labels in \(V(H_{\mathcal {P}}) \setminus \mathrm{Desc}_\mathcal {P}(U)\), along with all incident edges.
Semiuniversal labels
Let U be a valid position, and let \(\ell\) be a label in U. Then, \(\ell\) is semiuniversal in U if \(U(i) = \{\ell \}\), for every \(i \in [k]\) such that \(\ell \in L(\mathcal {T}_i)\). In Fig. 3, labels 1 and 2 are semiuniversal in \(U_\mathrm{root}\), but g is not, since g is in both \(L(\mathcal {T}_2)\) and \(L(\mathcal {T}_3)\), but \(U_\mathrm{root}(2) \ne \{g\}\).
The term “semiuniversal”, borrowed from Pe’er et al. [19], derives from the following fact. Suppose that \(\mathcal {P}\) is ancestrally compatible, that \(\mathcal {T}\) is a tree that ancestrally displays \(\mathcal {P}\), and that \(\ell\) is a semiuniversal label for some valid position U. Then, as we shall see, \(\ell\) must label the root \(u_\ell\) of a subtree of \(\mathcal {T}\) that contains all the descendants of \(\ell\) in \(\mathcal {T}_i\), for every i such that \(\ell \in L(\mathcal {T}_i)\). The qualifier “semi” is because this subtree may also contain labels that do not descend from \(\ell\) in any input tree, but descend instead from some other semiuniversal label \(\ell '\) in U. In this case, \(\ell '\) also labels \(u_\ell\). We exploit this property of semiuniversal labels in our ancestral compatibility algorithm and its proof of correctness (see "Testing ancestral compatibility").
For each label \(\ell \in L(\mathcal {P})\), let \(k_\ell\) denote the number of input trees that contain label \(\ell\). We can obtain \(k_\ell\) for every \(\ell \in L(\mathcal {P})\) in \(O(M_{\mathcal {P}})\) time during the construction of \(H_{\mathcal {P}}\).
Lemma 5
Let \(U = (U(1), \ldots , U(k))\) be a valid position. Then, label \(\ell\) is semiuniversal in U if the cardinality of the set \(J_\ell = \{i \in [k] : U(i) = \{\ell \}\}\) equals \(k_\ell\).
Proof
By definition, \(U(i) = \{\ell \}\), for every \(i \in J_\ell\). Since \(J_\ell  = k_\ell\), the lemma follows. \(\square\)
Successor positions
Observation 2
Let U be a valid position, and let \(U'\) be the successor of U with respect to the set S of semiuniversal labels in U. Then, \(H_{\mathcal {P}}(U')\) can be obtained from \(H_{\mathcal {P}}(U)\) by doing the following for each \(\ell \in S\): (1) for each \(i \in [k]\) such that \(U(i) = \{\ell \}\), delete all edges between \(\ell\) and \({\mathrm{Ch}}_i(\ell )\); (2) delete \(\ell\).
Let U be a valid position, and W be a subset of \(\mathrm{Desc}_\mathcal {P}(U)\). Then, UW denotes the position \((U(1) \cap W, U(2) \cap W, \ldots , U(k) \cap W)\). In Fig. 3, the components of \(H_{\mathcal {P}}(U')\), where \(U'\) is the successor of \(U_\mathrm{root}\), are \(W_1 = \{3,4,a,b,c,d,e,g\}\) and \(W_2 = \{f,h,i\}\). Thus, \(U'  W_1 = (\{3\}, \{e,g\}, \{g\})\) and \(U'  W_2 = (\{f\}, \{f\}, \emptyset )\). We have the following result.
Lemma 6
Let U be a valid position, and S be the set of all semiuniversal labels in U. Let \(U'\) be the successor of U with respect to S, and let \(W_1, W_2, \ldots , W_p\) be the label sets of the connected components of \(H_{\mathcal {P}}(U')\). Then, \(U'  W_j\) is a valid position, for each \(j \in [p]\).
Proof
It suffices to argue that \(U'\) satisfies conditions (V1) and (V2). The lemma then follows from the fact that the connected components of \(H_{\mathcal {P}}(U')\) are labeldisjoint.
\(U'\) must satisfy condition (V1), since U does. Suppose \(\ell \in S\). Then, for each \(i \in [k]\) such that \(\ell \in L(\mathcal {T}_i)\), \(\mathrm{Desc}_i(U') = \mathrm{Desc}_i(U) \setminus \{\ell \}\) and \(\mathrm{Desc}_\mathcal {P}(U') \cap L(\mathcal {T}_i) =(\mathrm{Desc}_\mathcal {P}(U) \cap L(\mathcal {T}_i)) \setminus \{\ell \}\). Thus, since (V2) holds for U, it also holds for \(U'\). \(\square\)
Testing ancestral compatibility
Overview of the algorithm
\(\mathrm{BuildNT}\) (Algorithm 1) is our algorithm for testing compatibility of semilabeled trees. Its argument, U, is a valid position in \(\mathcal {P}\) such that \(H_{\mathcal {P}}(U)\) is connected. \(\mathrm{BuildNT}\) relies on the fact—proved later, in Theorem 1—that if \(\mathcal {P}\mathrm{Desc}_\mathcal {P}(U)\) is compatible, then U must contain a nonempty set S of semiuniversal labels. If such a set S exists, the algorithm replaces U by its successor \(U'\) with respect to S. It then processes each connected component of \(H_{\mathcal {P}}(U')\) recursively, to determine if the associated subprofile is compatible. If all the recursive calls are successful, then their results are combined into a supertree for \(\mathcal {P}\mathrm{Desc}_\mathcal {P}(U)\).
Next, we argue the correctness of \(\mathrm{BuildNT}\).
Correctness
Lemma 7
Let U be a valid position in \(\mathcal {P}\). If \(\mathrm{BuildNT}(U)\) returns a tree \(\mathcal {T}_U\), then \(\mathcal {T}_U\) is a phylogenetic tree such that \(L(\mathcal {T}_U) = L(U)\).
Proof
We use induction on L(U). The base case, where \(L(U) = 1\), is handled by Lines 5–6. In this case, \(S = L(U) = \{\ell \}\) and \(\mathrm{BuildNT}(U)\) correctly returns the tree consisting of a single node, labeled by \(\{\ell \}\). Otherwise, let \(W_1, \ldots , W_p\) be the connected components of \(H_{\mathcal {P}}(U)\) in step 8. Since \(\mathrm{BuildNT}(U)\) returns tree \(\mathcal {T}_U\), it must be the case that, for each \(j \in [p]\), the result \(t_j\) returned by the recursive call to \(\mathrm{BuildNT}(UW_j)\) in Line 10 is a tree. Since \(S \ge 1\), we have \(L(W_j) < L(U)\), for each \(j \in [p]\). Thus, we can assume inductively that \(t_j\) is a phylogenetic tree for \(L(W_j)\). Since \(S \cup \bigcup _{j \in [p]} L(W_j) = L(U)\), the tree returned in Line 13 is a phylogeny with species set L(U). \(\square\)
Theorem 1
Let \(\mathcal {P}= \{\mathcal {T}_1, \mathcal {T}_2, \ldots , \mathcal {T}_k\}\) be a profile and let \(U_\mathrm{root}\) be the root position, as defined in Eq. (1). Then, \(\mathrm{BuildNT}(U_\mathrm{root})\) returns either (i) a semilabeled tree \(\mathcal {T}\) that ancestrally displays \(\mathcal {P}\), if \(\mathcal {P}\) is ancestrally compatible, or (ii) incompatible otherwise.
Proof
 (i)
Suppose that \(\mathrm {BuildNT}(U_\mathrm{root})\) returns a semilabeled tree \(\mathcal {T}\). By Lemma 7, \(L(\mathcal {T}) = L(\mathcal {P})\). We prove that \(\mathcal {T}\) ancestrally displays \(\mathcal {P}\). By Lemma 1, it suffices to show that \(D(\mathcal {T}_i) \subseteq D(\mathcal {T})\) and \(N(\mathcal {T}_i) \subseteq N(\mathcal {T})\), for each \(i \in [k]\). Consider any \((\ell ,\ell ') \in D(\mathcal {T}_i)\). Then, \(\ell\) has a child \(\ell ''\) in \(\mathcal {T}_i\) such that \(\ell '' \le _{\mathcal {T}_i} \ell '\) —note that we may have \(\ell '' = \ell\). There must be a recursive call to \(\mathrm {BuildNT}(U)\), for some valid position U, where \(\ell\) is the set S of semiuniversal labels obtained in Line 1. By Observation 2, label \(\ell ''\), and thus \(\ell '\), both lie in one of the connected components of the graph obtained by deleting all labels in S, including \(\ell\), and their incident edges from \(H_{\mathcal {P}}(U)\). It now follows from the construction of \(\mathcal {T}\) that \((\ell , \ell ') \in D(\mathcal {T})\). Thus, \(D(\mathcal {T}_i) \subseteq D(\mathcal {T})\). Now, consider any \(\{\ell ,\ell ' \} \in N(\mathcal {T}_i)\). Let v be the lowest common ancestor of \(\phi _i(\ell )\) and \(\phi _i(\ell ')\) in \(\mathcal {T}_i\) and let \(\ell _v\) be the label of v. Then, \(\ell _v\) has a pair of children, \(\ell _1\) and \(\ell _2\) say, in \(\mathcal {T}_i\) such that \(\ell _1 \le _{\mathcal {T}_i} \ell\), and \(\ell _2 \le _{\mathcal {T}_i} \ell '\). Because \(\mathrm {BuildNT}(U_\mathrm{root})\) returns a tree, there are recursive calls \(\mathrm {BuildNT}(U_1)\) and \(\mathrm {BuildNT}(U_2)\) for valid positions \(U_1\) and \(U_2\) such that \(\ell _1\) is semiuniversal for \(U_1\) and \(\ell _2\) is semiuniversal for \(U_2\). We must have \(U_1 \ne U_2\); otherwise, \(U_1(i) = U_2(i) \ge 2\), and, thus, neither \(\ell _1\) nor \(\ell _2\) is semiuniversal, a contradiction. Further, it follows from the construction of \(\mathcal {T}\) that we must have \(\mathrm{Desc}_\mathcal {P}(U_1) \cap \mathrm{Desc}_\mathcal {P}(U_2) = \emptyset\). Hence, \(\ell \parallel _\mathcal {T}\ell '\), and, therefore, \(\{\ell ,\ell '\} \in N(\mathcal {T})\).
 (ii)
Asssume, by way of contradiction, that \(\mathrm{BuildNT}(U_\mathrm{root})\) returns incompatible, but that \(\mathcal {P}\) is ancestrally compatible. By assumption, there exists a semilabeled tree \(\mathcal {T}\) that ancestrally displays \(\mathcal {P}\). Since \(\mathrm {BuildNT}(U_\mathrm{root})\) returns incompatible, there is a recursive call to \(\mathrm{BuildNT}(U)\) for some valid position U such that U has no semiuniversal label, and the set S of Line 1 is empty. By Lemma 2, \(\mathcal {T} \mathrm{Desc}_\mathcal {P}(U)\) ancestrally displays \(\mathcal {P}\mathrm{Desc}_\mathcal {P}(U)\). Thus, by Lemma 4, \(\mathcal {T} \mathrm{Desc}_\mathcal {P}(U)\) ancestrally displays \(\mathcal {T}_i  \mathrm{Desc}_i(U)\), for every \(i \in [k]\). Let \(\ell\) be any label in the label set of the root of \(\mathcal {T} \mathrm{Desc}_\mathcal {P}(U)\). Then, for each \(i \in [k]\) such that \(\ell \in L(\mathcal {T}_{i})\), \(\ell\) must be the label of the root of \(\mathcal {T}_i\mathrm{Desc}_i(U)\). Thus, for each such i, \(U(i) = \{\ell \}\). Hence, \(\ell\) is semiuniversal in U, a contradiction.
An iterative version
We now present \(\mathrm {BuildNT}_\mathrm {N}\) (Algorithm 2), an iterative version of \(\mathrm {BuildNT}\), which lends itself naturally to an efficient implementation. \(\mathrm{BuildNT_N}\) performs a breadthfirst traversal of \(\mathrm{BuildNT}\)’s recursion tree, using a firstin firstout queue Q that stores pairs of the form \((U, \mathrm{pred})\), where U is a valid position in \(\mathcal {P}\) and \(\mathrm{pred}\) is a reference to the parent of the node corresponding to U in the supertree built so far. \(\mathrm{BuildNT_N}\) simulates recursive calls in \(\mathrm{BuildNT}\) by enqueuing pairs corresponding to subproblems. We explain this in more detail next.
Although the order in which \(\mathrm{BuildNT_N}\) processes connected components differs from that of \(\mathrm {BuildNT}\) —breadthfirst instead of depthfirst—, it is straightforward to see that the effect is equivalent, and the proof of correctness of \(\mathrm{BuildNT}\) (Theorem 1) applies to \(\mathrm{BuildNT_N}\) as well. We thus state the following without proof.
Theorem 2
Let \(\mathcal {P}= \{\mathcal {T}_1, \mathcal {T}_2, \ldots , \mathcal {T}_k\}\) be a profile. Then, \(\mathrm{BuildNT_N}(\mathcal {P})\) returns either (i) a semilabeled tree \(\mathcal {T}\) that ancestrally displays \(\mathcal {P}\), if \(\mathcal {P}\) is ancestrally compatible, or (ii) incompatible otherwise.
Let Q be \(\mathrm{BuildNT_N}\)’s firstin firstout queue. In the rest of the paper, we will say that a valid position U is in Q if \((U,\mathrm{pred}) \in Q, \text { for some } \mathrm{pred}.\) Let \(H_Q\) be the subgraph of \(H_{\mathcal {P}}\) induced by \(\bigcup \{\mathrm{Desc}(U): U \text { is in } Q\}.\) By Observation 1, \(H_Q\) is obtained from \(H_{\mathcal {P}}\) through edge and node deletions.
Lemma 8
At the start of any iteration of \(\mathrm{BuildNT_N}\)’s while loop, the set of connected components of \(H_Q\) is \(\{V(H_{\mathcal {P}}(U)) : U \text { is in } Q\}\).
Proof
The property holds at the outset, since, by Assumption 2, \(H_{\mathcal {P}}= H_{\mathcal {P}}(U_\mathrm{root})\) is a connected graph, and the only element of Q is \((U_\mathrm{root},\mathtt {null})\). Assume that the property holds at the beginning of iteration l. Let \((U, \mathrm{pred})\) be the element dequeued from Q in Line 4. Then, \(H_{\mathcal {P}}(U)\) is connected. In place of \((U, \mathrm{pred})\), Lines 13–14 enqueue \((UW_j, r_U)\), for each \(j \in [p]\), where, by construction, \(H_{\mathcal {P}}(UW_j)\) is a connected component of \(H_{\mathcal {P}}(U)\). Thus, the property holds at the beginning of iteration \(l+1\). \(\square\)
In other words, Lemma 8 states that each iteration of \(\mathrm{BuildNT_N}(\mathcal {P})\) deals with a subgraph of \(H_{\mathcal {P}}\), whose connected components are in onetoone correspondence with the valid positions stored in Q. This is illustrated by the next example.
An example
In each figure, \(H_Q\) is shown on the left and the current supertree is shown on the right. For brevity, the figures only exhibit the state of \(H_Q\) and the supertree after all the nodes at each level are generated. The various valid positions processed by \(\mathrm{BuildNT_N}(\mathcal {P})\) are denoted by \(U_\alpha\), for different subscripts \(\alpha\); \(S_\alpha\) denotes the semiuniversal labels in \(U_\alpha\), and \(U_\alpha '\) denotes the successor of \(U_\alpha\) with respect to \(S_\alpha\). We write \(L_\alpha\) as an abbreviation for \(L(U_\alpha )\) The root of the tree for \(L_\alpha\) is \(r_{U_\alpha }\) and is labeled by \(S_\alpha\).
Initially, \(Q = ((U_\mathrm{root},\mathtt {null}))\). In what follows, the elements of Q are listed from front to rear.
The only semiuniversal labels in \(U_{12}\), \(U_{21}\), and \(U_{22}\) are, respectively, e, h, and i. Since none of these labels have proper descendants, each of them is a leaf in the supertree.
After level 2 is processed, \(Q = ((U_{111},r_{11}), (U_{112},r_{11}))\).
The only semiuniversal label in \(U_{112}\) is d. Since d has no proper descendants, it becomes a leaf in the supertree.
After level 3 is processed, \(Q = ((U_{1111},r_{111}), (U_{1112},r_{111}))\).
Level 4. Refer to Fig. 8. The only semiuniversal labels in \(U_{1111}\) and \(U_{1112}\) are, respectively, b and c. Since neither of these labels have proper descendants, each of them is a leaf in the supertree.
After level 4 is processed, Q is empty, and \(\mathrm{BuildNT_N}(\mathcal {P})\) terminates.
Implementation
Here we prove the following result.
Theorem 3
There is an algorithm that, given a profile \(\mathcal {P}\) of rooted trees, runs in \(O(M_{\mathcal {P}}\log ^2 M_{\mathcal {P}})\) time, and either returns a tree that displays \(\mathcal {P}\), if \(\mathcal {P}\) is compatible, or reports that is \(\mathcal {P}\) is incompatible otherwise.
We prove this theorem by showing how to implement \(\mathrm{BuildNT_N}\) so that the algorithm runs in \(O(M_{\mathcal {P}}\log ^2 M_{\mathcal {P}})\) on any profile \(\mathcal {P}\).
As in the section titled "An iterative version", let \(H_Q\) denote the subgraph of \(H_{\mathcal {P}}\) associated with the valid positions in \(\mathrm{BuildNT_N}\)’s queue. By Lemma 8, each valid position U in Q corresponds to one connected component of \(H_Q\) —namely \(\mathrm{Desc}(U)\) —and viceversa. We use this fact in the implementation of \(\mathrm{BuildNT_N}\): alongside each valid position U in Q, we also store a reference to the respective connected component, together with additional information, described next, to quickly identify semiuniversal labels.

Let \(J_U = \{i \in [k] : U(i) \ne \emptyset \}\). Then, \(Y.\mathtt {map}\) is a map from \(J_U\) to L(U), where, for each \(i \in J_U\), \(Y.\mathtt {map}(i) = U(i)\).

For each \(\ell \in Y\), \(\ell .\mathtt {count}\) equals the cardinality of the set \(\{i \in [k] : Y.\mathtt {map}(i) = \{\ell \}\}\). (Recall that \(k_\ell\) is the number of input trees that contain \(\ell\).).

\(Y.\mathtt {exposed}\), a set consisting of all \(i \in [k]\) such that \(Y.\mathtt {map}(i) = \{\ell \}\) for some \(\ell \in Y\) such that \(\ell .\mathtt {count}= k_\ell\).

\(Y.\mathtt {weight}\), which equals \(\sum _{\ell \in Y} k_\ell\). This field is needed for technical reasons, to be explained later.
The data fields listed above allow us to efficiently retrieve the set S of semiuniversal labels in U, as needed in line 5 of \(\mathrm{BuildNT_N}(\mathcal {P})\). Indeed, suppose that U is the valid position extracted from Q at the beginning of an iteration of the while loop of Lines 3–14, and that \(Y = V(H_{\mathcal {P}}(U))\). Then, by Lemma 5, we have \(S = \{v \in Y.\mathtt {map}(i) : i \in Y.\mathtt {exposed}\}\). What remains is to devise an efficient way to update these fields for each of the connected components of \(H_{\mathcal {P}}(U)\) created by replacing U with its successor in Line 11.
 (a)
Generate the new connected components resulting from these deletions, and
 (b)
Produce the required \(\mathtt {map}\), \(\mathtt {count}\), and \(\mathtt {exposed}\) data fields for the various connected components.
For part (b), we need to augment HDT in order to maintain the the required data fields for the various connected components created during edge and node deletion. In the next subsections, we describe how to do this. We begin by explaining how to initialize all the required data fields for \(H_{\mathcal {P}}= H_{\mathcal {P}}(U_\mathrm{root})\).
Initializing the data fields

For each \(i \in [k]\), \(Y_\mathrm{root}.\mathtt {map}(i) = \{ r(T_i)\}\). This takes O(k) time.

\(Y_\mathrm{root}.\mathtt {weight}= \sum _{\ell \in L(\mathcal {P})} k_\ell\). This takes \(O(M_{\mathcal {P}})\) time.
 1.
Set \(\ell .\mathtt {count}\) to 0 for all \(\ell \in L(\mathcal {P})\).
 2.For each \(i \in [k]\), do the following.
 (a)
Let \(\rho _i\) denote the label of \(r(T_i)\).
 (b)
Increment \(\rho _i.\mathtt {count}\) by one.
 (a)
Maintaining the data fields
Suppose that all data fields fields are correctly computed for every connected component that is in Q at the beginning of an iteration of the while loop in 3–14 of \(\mathrm{BuildNT_N}\). We now show how to generate the same fields efficiently for the new connected components created by Line 11.
Computing successor positions
 1.
Identify the set S of semiuniversal labels in U. As we saw, this set is given by \(S = \{\ell \in Y.\mathtt {map}(i) : i \in Y.\mathtt {exposed}\}\).
 2.
Set \(Y.\mathtt {map}(i) = \emptyset\), for every \(i \in Y.\mathtt {exposed}\).
 3.
Make \(Y.\mathtt {exposed}= \emptyset\).
 4.For each \(\ell \in S\) and each i such that \(\ell \in L(T_i)\), do the following.

If \({\mathrm{Ch}}_i(\ell ) \ne \emptyset\), replace \(Y.\mathtt {map}(i)\) by \({\mathrm{Ch}}_i(\ell )\). If \({\mathrm{Ch}}_i(\ell )\) is a singleton set \(\{\alpha \}\), increment \(\alpha .\mathtt {count}\) by one. If \(\alpha .\mathtt {count}= k_\ell\), add i to \(Y.\mathtt {exposed}\).

Otherwise, \(Y.\mathtt {map}(i)\) is undefined.

 5.
For each label \(\ell\) in S, delete the edges incident on \(\ell\) and then \(\ell\) itself, updating the data fields as necessary after each deletion.
Next let us focus on how to handle the deletion of a single edge in Step 5.
Deleting an edge
 1.Delete \((\ell ,\alpha )\), querying HDT to determine whether this disconnects Y.

If Y remains connected, skip the next steps and proceed directly to the next child of \(\ell\).

Otherwise, Y is split into two components, \(Y_1\) and \(Y_2\).

 2.
Update \(Y_1.\mathtt {weight}\) and \(Y_2.\mathtt {weight}\).
 3.
Identify which of \(Y_1\) and \(Y_2\) has the smaller \(\mathtt {weight}\) field. Without loss of generality, assume that \(Y_1.\mathtt {weight}\le Y_2.\mathtt {weight}\).
 4.
Initialize \(Y_1.\mathtt {map}\) and \(Y_1.\mathtt {exposed}\) to \(\mathtt {null}\).
 5.
Initialize \(Y_2.\mathtt {map}\) and \(Y_2.\mathtt {exposed}\) to \(Y.\mathtt {map}\) and \(Y.\mathtt {exposed}\), respectively.
 6.For each label \(\beta\) in \(Y_1\), perform the following steps for each i such that \(\beta \in L(\mathcal {T}_i)\).
 (a)
Delete \(\beta\) from \(Y_2.\mathtt {map}(i)\) and add \(\beta\) to \(Y_1.\mathtt {map}(i)\).
 (b)
Adjust \(\mathtt {count}\) and \(\mathtt {exposed}\) fields as necessary.
 (a)
To perform Step 2, we use the wellknown technique of scanning the smaller component [21]. We first consult HDT to determine which of \(Y_1\) or \(Y_2\) has fewer nodes. Assume, without loss of generality, that \(Y_1 \le Y_2\). We initialize \(Y_1.\mathtt {weight}\) to 0 and \(Y_2.\mathtt {weight}\) to \(Y.\mathtt {weight}\). We then scan the labels of \(Y_1\), incrementing \(Y_1.\mathtt {weight}\) by \(k_\ell\) for each label \(\ell \in Y_1\). When the scan of \(Y_1\) is complete, we make \(Y_2.\mathtt {weight}= Y_2.\mathtt {weight} Y_1.\mathtt {weight}\). We claim that any label \(\ell \in L(\mathcal {P})\) is scanned \(O(\log M_{\mathcal {P}})\) times over the entire execution of \(\mathrm{BuildNT_N}(\mathcal {P})\). To verify this, let \(N(\ell )\) be the number of nodes in the connected component containing \(\ell\). Suppose that, initially, \(N(\ell ) = N\). Then, the rth time we scan \(\ell\), \(N(\ell ) \le N/2^r\). Thus, \(\ell\) is scanned \(O(\log N)\) times. The claim follows, since \(N = O(M_{\mathcal {P}})\). Therefore, the total number of updates over all labels is \(O(M_{\mathcal {P}}\log M_{\mathcal {P}})\).
Each execution of Step 6(a) updates each of \(Y_1.\mathtt {map}(i)\) and \(Y_2.\mathtt {map}(i)\) once. Step 6(b) is more complex, but can also be accomplished with O(1) data field updates. We omit the (tedious) details. In summary, each execution of step 6 for some \(\beta \in L(\mathcal {P})\) performs \(O(k_\beta )\) data field updates.
Let us track the number of data field updates in Step 6 that can be attributed to some specific label \(\beta \in L(P)\) over the entire execution of \(\mathrm{BuildNT_N}(\mathcal {P})\). Let \(w_r(\beta )\) be the weight of the connected component containing \(\beta\) at the beginning of Step 6, on the rth time that \(\beta\) is considered in that step. Thus, \(w_0(\beta ) \le \sum _{\ell \in L(\mathcal {P})} k_\ell\). We claim that \(w_r(\beta ) \le w_0(\beta )/2^r\). The reason is that we only consider \(\beta\) if (a) \(\beta\) is contained in one of the two components that result from deleting an edge in step 1 and (b) the component containing \(\beta\) has the smaller weight. Hence, the number of times \(\beta\) is considered in step 6 over the entire execution of \(\mathrm{BuildNT_N}(\mathcal {P})\) is \(O(\log w_0(\beta ))\), which is \(O(\log M_{\mathcal {P}})\), since \(w_0(\beta ) = O(M_{\mathcal {P}})\). Therefore, the total number of data field updates in Step 6, over all labels in \(L(\mathcal {P})\) considered throughout the entire execution of \(\mathrm{BuildNT_N}(\mathcal {P})\), is \(O(\log M_{\mathcal {P}}\cdot \sum _{\ell \in L(\mathcal {P})} k_\ell )\), which is \(O(M_{\mathcal {P}}\log M_{\mathcal {P}})\).
Summary

Initializing the data structures. This has two parts.

Setting up the HDT data structure for \(H_{\mathcal {P}}\). This takes \(O(M_{\mathcal {P}}\log ^2 M_{\mathcal {P}})\) time.

Initializing the data fields for the single connected component of \(H_{\mathcal {P}}\). This takes \(O(M_{\mathcal {P}})\) time.


Maintaining the data structures. This also has two parts.

Updating the HDT data structure. There are \(O(M_{\mathcal {P}})\) edge and node deletions, at an amortized cost of \(O(\log ^2 M_{\mathcal {P}})\) per deletion, yielding a total time of \(O(M_{\mathcal {P}}\log ^2 M_{\mathcal {P}})\).

Maintaining the relevant data fields for the connected components. We have seen that the total number of updates is \(O(M_{\mathcal {P}}\log M_{\mathcal {P}})\). Assume, conservatively, that each update can be done in \(O(\log M_{\mathcal {P}})\) time. Then, this part takes a total of \(O(M_{\mathcal {P}}\log ^2 M_{\mathcal {P}})\) over the entire execution of \(\mathrm{BuildNT_N}\).

Discussion
Like our earlier algorithm for compatibility of ordinary phylogenetic trees, the more general algorithm presented here, \(\mathrm{BuildNT_N}\), is a polylogarithmic factor away from optimality (a trivial lower bound is \(\Omega (M_{\mathcal {P}})\), the time to read the input). \(\mathrm{BuildNT_N}\) has a linearspace implementation, using the results of Thorup [22]. A question to be investigated next is the performance of the algorithm on real data. Another important issue is integrating our algorithm into a synthesis method that deals with incompatible profiles.
Notes
Declarations
Authors' contributions
Algorithms and proofs were developed jointly by YD and DFB. The first draft of the paper was written by DFB, with substantial contributions from YD. YD and DFB both proofread the manuscript. Both authors read and approved the final manuscript.
Acknowledgements
The authors were supported in part by the National Science Foundation under Grant CCF1422134.
Competing interests
The authors declare that they have no competing interests.
Open AccessThis article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The Creative Commons Public Domain Dedication waiver (http://creativecommons.org/publicdomain/zero/1.0/) applies to the data made available in this article, unless otherwise stated.
Authors’ Affiliations
References
 Aho AV, Sagiv Y, Szymanski TG, Ullman JD. Inferring a tree from lowest common ancestors with an application to the optimization of relational expressions. SIAM J Comput. 1981;10(3):405–21.View ArticleGoogle Scholar
 Deng Y, FernándezBaca D. Fast compatibility testing for rooted phylogenetic trees. In: Grossi R, Lewenstein M (editors) 27th annual symposium on combinatorial pattern matching (CPM 2016). Leibniz International Proceedings in Informatics. Schloss Dagstuhl—LeibnizZentrum für Informatik. Dagstuhl Publishing; 2016. p. 12. doi:10.4230/LIPIcs.CPM.2016.12.
 Henzinger MR, King V, Warnow T. Constructing a tree from homeomorphic subtrees, with applications to computational evolutionary biology. Algorithmica. 1999;24:1–13.View ArticleGoogle Scholar
 Steel MA. The complexity of reconstructing trees from qualitative characters and subtrees. J Classif. 1992;9:91–116.View ArticleGoogle Scholar
 Baum BR. Combining trees as a way of combining data sets for phylogenetic inference, and the desirability of combining gene trees. Taxon. 1992;41:3–10.View ArticleGoogle Scholar
 Ragan MA. Phylogenetic inference based on matrix representation of trees. Mol Phylogenet Evol. 1992;1:53–8.View ArticlePubMedGoogle Scholar
 BinindaEmonds ORP, Cardillo M, Jones KE, MacPhee RDE, Beck RMD, Grenyer R, Price SA, Vos RA, Gittleman JL, Purvis A. The delayed rise of presentday mammals. Nature. 2007;446:507–12.View ArticlePubMedGoogle Scholar
 Page RM. Taxonomy, supertrees, and the tree of life. In: BinindaEmonds ORP, editor. Phylogenetic supertrees: combining information to reveal the tree of life. Dordrecht: Kluwer; 2004. p. 247–65.View ArticleGoogle Scholar
 Sanderson MJ. Phylogenetic signal in the eukaryotic tree of life. Science. 2008;321(5885):121–3.View ArticlePubMedGoogle Scholar
 Sayers EW, et al. Database resources of the national center for biotechnology information. Nucl Acids Res. 2009;37(Database issue):5–15.View ArticleGoogle Scholar
 The Angiosperm Phylogeny Group. An update of the Angiosperm Phylogeny Group classification for the orders and families of flowering plants: APG IV. Bot J Linn Soc. 2016;181:1–20.View ArticleGoogle Scholar
 Hinchliff CE, Smith SA, Allman JF, Burleigh JG, Chaudhary R, Coghill LM, Crandall KA, Deng J, Drew BT, Gazis R, Gude K, Hibbett DS, Katz LA, Laughinghouse HD IV, McTavish EJ, Midford PE, Owen CL, Reed RH, Reesk JA, Soltis DE, Williams T, Cranston KA. Synthesis of phylogeny and taxonomy into a comprehensive tree of life. Proc Natl Acad Sci. 2015;112(41):12764–9. doi:10.1073/pnas.1423041112.View ArticlePubMedPubMed CentralGoogle Scholar
 Bordewich M, Evans G, Semple C. Extending the limits of supertree methods. Ann Comb. 2006;10:31–51.View ArticleGoogle Scholar
 Semple C, Steel M. Phylogenetics. Oxford lecture series in mathematics. Oxford: Oxford University Press; 2003.Google Scholar
 Daniel P, Semple C. Supertree algorithms for nested taxa. In: BinindaEmonds ORP, editor. Phylogenetic supertrees: combining information to reveal the tree of life. Dordrecht: Kluwer; 2004. p. 151–71.View ArticleGoogle Scholar
 Berry V, Semple C. Fast computation of supertrees for compatible phylogenies with nested taxa. Syst Biol. 2006;55(2):270–88.View ArticlePubMedGoogle Scholar
 Bryant D, Lagergren J. Compatibility of unrooted phylogenetic trees is FPT. Theor Comput Sci. 2006;351:296–302.View ArticleGoogle Scholar
 Smith SA, Brown JW, Hinchliff CE. Analyzing and synthesizing phylogenies using tree alignment graphs. PLoS Comput Biol. 2013;9(9):1003223.View ArticleGoogle Scholar
 Pe’er I, Pupko T, Shamir R, Sharan R. Incomplete directed perfect phylogeny. SIAM J Comput. 2004;33(3):590–607. doi:10.1137/S0097539702406510.View ArticleGoogle Scholar
 Holm J, de Lichtenberg K, Thorup M. Polylogarithmic deterministic fullydynamic algorithms for connectivity, minimum spanning tree, 2edge, and biconnectivity. J ACM. 2001;48(4):723–60. doi:10.1145/502090.502095.View ArticleGoogle Scholar
 Even S, Shiloach Y. An online edgedeletion problem. J ACM. 1981;28(1):1–4. doi:10.1145/322234.322235.View ArticleGoogle Scholar
 Thorup M. Nearoptimal fullydynamic graph connectivity. In: Proceedings of the 32nd annual ACM symposium on theory of computing. ACM; 2000. p. 343–350.Google Scholar