Journal of Graph Algorithms and Applications the Agreement Problem for Unrooted Phylogenetic Trees Is Fpt

A collection T of k unrooted phylogenetic trees on different leaf sets is said to be strictly compatible or in agreement if there exists a tree T such that each tree in T can be obtained from T by deleting leaves and suppressing degree-2 vertices. The problem of determining if a set of unrooted trees is in agreement has been proved NP-hard in 1992. Here, we show that an f (k) · n algorithm exists, for some computable function f of k, proving that strict compatibility of unrooted phylogenetic trees is fixed-parameter tractable with respect to the number k of trees. Designing a practical FPT algorithm remains an open problem. 386 Scornavacca et al. The agreement problem is FPT


Introduction
Phylogenetics is the research area that aims at reconstructing evolutionary histories from available data about present-day taxonomic units, usually called taxa.If X is a finite set of taxa, then an (unrooted) phylogenetic tree on X is a tree that has no degree-2 vertices and in which the leaves are bijectively labelled by the elements of the set X.The internal vertices of a phylogenetic tree model the divergence of lineages.A phylogenetic tree is said to be binary if each internal vertex has degree three, hence modelling the divergence of one lineage into two (sub)lineages.Non-binary phylogenetic trees, on the other hand, may have vertices of degree higher than three, which are called polytomies.There are two different interpretations of polytomies.When a polytomy is used to model uncertainty in the order of divergence events, we call it a soft polytomy, while polytomies that model simultaneous divergence of one lineage into three or more (sub)lineages are called hard polytomies.
When phylogenetic trees on several different, but overlapping, sets of taxa are available, a natural question to ask is whether there exists a single phylogenetic tree on the set X of all taxa that "agrees" with each of the input trees.The notion of "agreement" here depends on whether the polytomies of the input trees are assumed to be hard or soft.For the case of soft polytomies, one says that a set T of phylogenetic trees is compatible if there exists a phylogenetic tree T on X such that each tree in T can be obtained from a subtree of T by contracting edges.For the case of hard polytomies, one says that a set T of phylogenetic trees is in agreement or strictly compatible if there exists a phylogenetic tree T such that each tree in T can be obtained from a subtree of T by suppressing degree-2 vertices.
For binary input trees, the notions of compatibility and strict compatibility coincide.Unfortunately, it was shown that deciding whether a given set of binary phylogenetic trees is compatible (or, equivalently, strictly compatible) is NP-complete, even if each input tree contains exactly four taxa [12].On the positive side, the compatibility problem was shown to be fixed-parameter tractable (FPT) in the number of input trees (not necessarily binary) [4].However, prior to this article, it was not known whether it is fixed-parameter tractable to decide if a given set of non-binary trees is strictly compatible.
Here, we answer this question affirmatively, showing that there exists an algorithm with running time f (k) • |X| that decides whether a given set of k non-binary phylogenetic trees is strictly compatible, with X the union of the taxon sets of the input trees.We do so by formulating this problem in monadic second order logic (MSOL) on a graph of which the treewidth is bounded by k, a (non-trivial) extension of the approach by Bryant and Lagergren for the case of (non-strict) compatibility [4].
Our approach can also be extended to a more general setting where the input trees are allowed to have both hard as well as soft polytomies.Such situations occur for example in practical applications in biology [7,[9][10][11].
We note that the problem becomes polynomial-time solvable, both for compatibility as well as for strict compatibility, when the input trees are rooted [1,8] (or all contain some common taxon).However, in practical applications it is not always possible to identify the root locations, e.g.due to a lack of data [6].Hence, the unrooted variant is equally important.

Preliminaries
In this section, we give some preliminary definitions that are used throughout this paper.An unrooted phylogenetic tree T consists of vertices connected by edges, in which any two vertices are connected by exactly one path and with no degree-2 vertex.A rooted phylogenetic tree is defined similarly, except that it has exactly one vertex, called the root of the tree, that can have degree two.Leaves, defined as vertices with degree one, are labeled by the label set L(T ), while other vertices, called internal vertices, are usually not labelled.
Given an unrooted phylogenetic tree T and a subset Y ⊆ L(T ), we denote with T | Y the tree obtained from the minimal subgraph of T connecting Y when suppressing vertices of degree two.We say that T | Y is the subtree of T induced by Y .Induced subtrees are defined in the same way for rooted trees, except that the root of T | Y becomes the vertex in the minimal connecting subgraph that is closest to the root of T , and we suppress all degree-2 vertices except the new root.
Given a rooted tree T and a set of three labels {u, v, w} in L(T ), T | {u,v,w} can be any of the three possible rooted binary trees on {u, v, w} or the unique non-binary tree on {u, v, w}.The binary trees on {u, v, w} are called triplets and are denoted respectively by uv|w, uw|v and wv|u, depending on the unique nontrivial cluster in T | {u,v,w} (respectively {u, v}, {u, w}, and {v, w}).Representing rooted trees in Newick notation, we say that T displays the triplet uv|w if T | {u,v,w} = ((u, v), w), while it displays the fan (u, v, w) if T | {u,v,w} = (u, v, w).
Let T = {T 1 , T 2 , . . ., T k } be a collection of strictly compatible, unrooted phylogenetic trees, not necessarily on the same taxon set.The display graph G for T is obtained from the disjoint graph union of all trees in T by identifying vertices with the same label.We denote by R G the vertex-edge incidence relation in G.

Fixed-parameter tractability of Agreement
We say that a collection of phylogenetic trees T = {T 1 , T 2 , . . ., T k } is strictly compatible if there exists a phylogenetic tree T such that for each tree The problem we consider in this paper is thus the following:

Agreement of unrooted phylogenetic trees
Instance: A set of unrooted phylogenetic trees T = {T 1 , T 2 , . . ., T k }.Parameter: The number of trees k.
Question: Does there exist an unrooted phylogenetic tree T such that for each tree T i ∈ T we have that T | L(Ti) = T i ?
Recall that the Agreement problem is polynomial for a set of rooted phylogenetic trees [8].
Theorem 1 Let T = {T 1 , T 2 , . . ., T k } be a collection of strictly compatible, unrooted phylogenetic trees, not necessarily on the same taxon set.The display graph of T has treewidth at most k.
Proof: Theorem 1 in [4] states that, if T is compatible, then the display graph of T has treewidth at most k.Since strict compatibility implies compatibility, the theorem follows.
To root an (unrooted) phylogenetic tree T on an edge e = {u, v} consists in first creating a new node w and two new edges {w, u} and {w, v}, then deleting the edge e, and finally defining w as the root of T .
Proposition 1 A collection of unrooted phylogenetic trees T = {T 1 , T 2 , . . ., T k } is strictly compatible if and only if each tree T i ∈ T can be rooted at some edge or vertex in such a way that the resulting rooted trees are strictly compatible.
Proof: Suppose that each T i ∈ T can be rooted (at a vertex or an edge) such that the resulting forest of rooted trees T r = {T r 1 , T r 2 , . . ., T r k } is strictly compatible.This implies that there exists a rooted tree T r such that T r | L(T r i ) = T r i .Let T be the unrooted version of T r .Since, when unrooting trees the degree two vertices are suppressed, the unrooted version of T r i coincides with T i for each T i ∈ T , and thus T | L(Ti) = T i holds.Now, suppose that T is strictly compatible.Then there exists an unrooted tree T such that T | L(Ti) = T i that we can root at some vertex r ∈ V (T ) to obtain a rooted tree T r .Let T r = {T r 1 , T r 2 , . . ., T r k } be such that, . It is easy to see that each T r i is a rooted version of T i .Moreover, T r is strictly compatible by construction.This concludes the proof.
Note that in the case of compatibility, it is sufficient to root the trees in T on edges [4].This is not the case for strict compatibility.For example, the unrooted trees in Figure 1 are strictly compatible but none of the 288 possible ways of rooting them on edges gives rise to a set of strictly compatible rooted trees.In Figure 2, we also show an example for which it is not enough to root on vertices: indeed, the unrooted trees are strictly compatible but none of the 8 possible ways of rooting them on vertices gives rise to a set of strictly compatible rooted trees.
We denote by R(T ) and F(T ) respectively the set of triplets and fans displayed by a set of rooted trees T .
Lemma 1 Let T = {T 1 , T 2 , . . ., T k } be rooted phylogenetic trees on subsets of a leaf set L(T ).Then T is not strictly compatible if and only if there exists  Proof: Let [R(T ), S] be the Aho graph [1] for the triplet set R(T ) on a leaf set S, i.e. the undirected graph with vertices S such that there is an edge connecting two vertices u and v if and only if there exists uv|w ∈ R(T ) and w ∈ S. Let [R(T ), F(T ), S] be the graph obtained from the graph [R(T ), S] by repeatedly adding an edge between any pair of vertices u and v in two different connected components B i , B j if there exists w ∈ B j such that (u, v, w) ∈ F (T ).
Similarly to what has been done in [4], we can prove the claim by proving that there exists S ⊆ L(T ), |S| ≥ 3 such that [R(T ), F(T ), S] is connected if and only if T is not strictly compatible.
If T is strictly compatible, then ∃T such that R(T ) ⊆ R(T ) and F (T ) ⊆ F (T ).Let S ⊆ L(T ), |S| > 1 and consider the subtree T | S and its root x.Each direct descendant y of x in T | S determines a subset of S given by those leaves that are descendants of y.Then, the collection of these subsets partitions S into two or more blocks B 1 , . . ., B s .If u and v are in two different blocks, say B i and B j , then there exists no uv|w in R(T ), and thus in R(T ), with w ∈ S.Moreover, there exists no (u, v, w) in F (T ), and thus in F (T ), such that w ∈ (B i ∪ B j ).Thus there are no edges between the blocks B 1 , . . ., B s in [R(T ), F(T ), S], thus [R(T ), F(T ), S] cannot be connected.
Suppose now that T is not strictly compatible.Then the OneTree algorithm presented in [8] will conclude that a supertree does not exist, and this happens only if there exists a leaf set S ⊆ L(T ), |S| ≥ 3 such that the graph [R(T ), F(T ), S] is connected.
Similarly to what has been done in [4], in the following we shall translate the choice of roots, together with Lemma 1, into monadic second order logic on the display graph G.The main difference between our characterization and that presented in [4] is the fact that we need to encode the possibility of rooting trees on edges and vertices (and not only on edges as done in [4]) and condition (ii) of Lemma 1, needed only for strict compatibility.
For this, we construct the following relational structure [2,4]: for which we define a formula Φ(A) such that G |= Φ(A) if and only if A is a set of edges and vertices (one from each tree T i ∈ T ) in which we can root each tree in T to make the forest strictly compatible in its rooted version (Proposition 1).For each 1 ≤ i ≤ k, we define Ψ i (u, v, X) to express that there is a path with vertex set Y ⊆ X ⊆ V (T i ) between the vertices u and v, and similarly Ψ i (u, e, X) to express that there is a path with vertex set Y ⊆ X ⊆ V (T i ) between the vertex u and the edge e (Note that the edge e does not need to lie entirely inside X, one endpoint is sufficient).More in detail, we have: We use C i (X) to express that X ⊆ V (T i ) and that X induces a connected subgraph of G: To simplify notations, we define Ψi (u, j, X) as follows: Then we define Φ(A) as the conjunction of and We use R(u, v, w, A) to express that there is a tree T i ∈ T with {u, v, w} ⊆ V (T i ) such that, with the rooting implied by A, the path from u to v is vertex disjoint from the path from w to the root, and this is true if and only if uv|w is a rooted triple in one of the trees rooted according to A. In monadic second order logic, R(u, v, w, A) can be expressed as follows: Finally, F(u, v, w, A) is used to express that there is a tree T i ∈ T with {u, v, w} ⊆ V (T i ) such that, with the rooting implied by A, uv|w, uw|v and vw|u are not rooted triples in T i , and this is true if and only if (u, v, w) is a fan in one of the trees rooted according to A. Thus F(u, v, w, A) can be expressed as follows: Then, since the problem of determining how to root the unrooted trees to give strictly compatible rooted trees can be translated into second order monadic logic on the display graph G, and G has treewidth at most k, the following result holds: Theorem 2 Let T = {T 1 , T 2 , . . ., T k } be unrooted phylogenetic trees on subsets of a leaf set L(T ).Then it takes f (k) • n time to solve the Agreement problem for T , where f is some computable function of k.
Proof: First, note that the display graph G for T can be computed in O(n • k) time, where n = |L(T )|.Moreover, determining whether or not G has treewidth at most k requires O(n • f (k)) for some computable f function of k [3].Then, by Theorem 1, we have that if the treewidth of G is greater than k, then T cannot be strictly compatible.Then, by the result of Courcelle [5] and Arnborg et al. [2], we have that all problems in second order monadic logic can be solved in linear time (with respect to the number of vertices) on graphs with bounded treewidth.Since the number of vertices in G is O(n • k), the theorem follows.
Note that our approach can also be extended to a more general setting where the input trees are allowed to have both hard as well as soft polytomies: it suffices to use F(u, v, w, A) for hard polytomies and R(u, v, w, A) for soft polytomies.

Conclusion
In this paper we prove that deciding whether a given set of k (not necessarily binary) phylogenetic trees is strictly compatible, is fixed-parameter tractable (FPT) in k.Note, however, that our algorithm does not directly lead to an efficient implementation.Therefore, it remains an important challenge to develop a practical FPT algorithm with a running time c k • p(n) with c a small constant and p a low-degree polynomial.

Figure 1 :
Figure 1: The unrooted trees in figure (a) are strictly compatible since the tree in (b) contains them all.

Figure 2 :
Figure 2: The unrooted trees in figure (a) are strictly compatible since the tree in (b) contains them all.