Indirect Identification of Horizontal Gene Transfer

Several implicit methods to infer Horizontal Gene Transfer (HGT) focus on pairs of genes that have diverged only after the divergence of the two species in which the genes reside. This situation defines the edge set of a graph, the later-divergence-time (LDT) graph, whose vertices correspond to genes colored by their species. We investigate these graphs in the setting of relaxed evolutionary scenarios that encompass all commonly used variants of duplication-transfer-loss scenarios in the literature. We characterize LDT graphs as a subclass of properly vertex-colored cographs, and provide a polynomial-time recognition algorithm as well as an algorithm to construct an evolutionary scenario that explains a given LDT. An edge in an LDT graph implies that the two corresponding genes are separated by at least one HGT event. The conserve is not true, however. We show that the complete xenology relation is described by an rs-Fitch graph, i.e., a complete multipartite graph satisfying constraints on the vertex coloring. This class of vertex-colored graphs is also recognizable in polynomial time. We finally address the question"how much information about all HGT events is contained in LDT graphs"with the help of simulations of evolutionary scenarios with a wide range of duplication, loss, and HGT events. In particular, we show that a simple greedy graph editing scheme can be used to efficiently detect HGT events that are implicitly contained in LDT graphs.


Introduction
Horizontal gene transfer (HGT) laterally introduces foreign genetic material into a genome. The phenomenon is particularly frequent in procaryotes (Soucy et al, 2015;Nelson-Sathi et al, 2015) but also contributed to shaping eukaryotic genomes (Keeling and Palmer, 2008;Husnik and Mc-Cutcheon, 2018;Acuña et al, 2012;Li et al, 2014;Moran and Jarvik, 2010;Schönknecht et al, 2013). HGT may be additive, in which case its effect is similar to gene duplications, or lead to the replacement of a vertically inherited homolog. From a phylogenetic perspective, HGT leads to an incongruence of gene trees and species trees, thus complicating the analysis of gene family histories.
A broad spectrum of computational methods have been developed to identify horizontally transfered genes and/or HGT events, recently reviewed in (Ravenhall et al, 2015). Parametric methods use genomic signatures, i.e., sequence features specific to a (group of) species identify horizontally inserted material. Genomic signatures include e.g. GC content, k-mer distributions, sequence autocorrelation, or DNA deformability (Dufraigne et al, 2005;Becq et al, 2010). Direct (or "explicit") phylogenetic methods start from a given gene tree T and species tree S and compute a reconciliation, i.e., a mapping of the gene tree into the species tree. This problem first arose in the context of host/parasite assemblages (Page, 1994;Charleston, 1998) considering the equivalent problem of mapping a parasite tree T to a host phylogeny S such that the number of events such as host-switches, i.e., horizontal transfers, is minimized. For a review of the early literature we refer to (Charleston and Perkins, 2006). A major difficulty is to enforce time-consistency in the presence of multiple horizontal transfer events, which renders the problem of finding optimal reconciliations NP-hard (Hallett and Lagergren, 2001;Ovadia et al, 2011;Tofigh et al, 2011;Hasić and Tannier, 2019). Nevertheless several practical approaches have become available, see e.g. (Tofigh et al, 2011;Chen et al, 2012;Ma et al, 2018). Indirect (or "implicit") phylogenetic methods forego the reconstruction of trees and start from sequence similarity or evolutionary distances and use unexpectedly small or large distances between genes as indicators of HGT. The basic idea is that the evolutionary distance between orthologous genes is approximately proportional to the distances between their species. Xenologous gene pairs as well as duplicate genes thus appear as outliers (Lawrence and Hartl, 1992;Clarke et al, 2002;Novichkov et al, 2004;Dessimoz et al, 2008). While indirect methods have been used successfully in the past, reviewed by Ravenhall et al (2015), they have received very little attention from a more formal point of view. In this contribution, we focus on a particular type of implicit phylogenetic information, following the ideas of Novichkov et al (2004). Specifically, we consider those pairs of genes a and b that are more closely related than expected from the phylogenetic distance of their respective genomes. Naturally, this defines a graph (G, σ), whose vertices x (the genes) are colored by the species σ(x) in which they appear. Here, we are interested in two questions: (1) What are the mathematical properties that characterize these "later-divergence-time" (LDT ) graphs? (2) What kind of information about HGT events, the gene and species tree, and the reconciliation map between them is contained implicitly in an LDT graph?
These questions are motivated by a series of recent publications that characterized the mathematical structure of orthology (Hellmuth et al, 2013;Lafond and El-Mabrouk, 2014), the xenology relation sensu Fitch Hellmuth et al, 2018;Hellmuth and Seemann, 2019), and the (reciprocal) best match relation (Geiß et al, 2019Schaller et al, 2021). Each of these relations satisfies stringent mathematical conditions that -at least in principle -can be used to correct empirical estimates and thus serve as a potential means of noise reduction (Hellmuth et al, 2015;Stadler et al, 2020). This approach has also lead to efficient algorithms to extract gene-trees, species trees, and reconciliations from the relation data. Although the resulting representations of gene family histories are usually not fully resolved, they can provide important constraints for subsequent refinements. The advantage of the relation-based approach is primarily robustness. While the inference of phylogenetic trees relies on detailed probability models or the additivity of distance metrics, our approach starts from yes/no answers to simple, pairwise comparisons. These data can therefore be represented as edges in a graph, possibly augmented by a measure of confidence. Noise and inaccuracies in the initial estimates then translate into violations of the required mathematical properties of the graphs in question. Graph editing approaches can therefore be harnessed as a means of noise reduction (Hellmuth et al, 2015;Dondi et al, 2017;Lafond and El-Mabrouk, 2014;Lafond et al, 2016;Hellmuth et al, 2020b,a;Schaller et al, 2020).
Previous work following this paradigm has largely been confined to duplication-loss (DL) scenarios, excluding horizontal transfer. As shown in (Hellmuth, 2017), it is possible to partition a gene set into HGT-free classes separated by HGTs. Within each class, the reconstruction problems then simplify to the much easier DL scenarios. It is of utmost interest, therefore, to find robust methods to infer this partition directly from (dis)similarity data. Here, we explore the usefulness and limitations of LDT graphs for this purpose.
This contribution is organized as follows. After introducing the necessary notation, we introduce a very general framework to describe evolutionary scenarios that emphasizes time-consistency of reconciliation rather than particular types of evolutionary events. In Sec. 4, LDT graphs are defined formally and characterized as those properly colored cographs for which a set of accompanying rooted triples is consistent (Thm. 3). The proof is constructive and provides a method (Algorithm 1) to compute an evolutionary scenario for a given LDT-graph. Sec. 5 defines HGT events, shows that every edge in a LDT graph corresponds to an HGT event, and characterizes those LDT graphs that already capture all HGT events. In addition, we provide a characterization of "rs-Fitch graphs" (general vertex-colored graphs that capture all HGT events) in terms of their coloring. These properties can be verified in polynomial time. Since LDT graphs do not usually capture all HGT events, we discuss in Sec. C several ways to obtain a plausible set of HGT canditates from LDT graphs. In Sec. 7, we address the question "how much information about all HGT events is contained in LDT graphs" with the help of simulations of evolutionary scenarios with a wide range of duplication, loss, and HGT events. We find that LDT graphs cover roughly a third of xenologous pairs, while a simple greedy graph editing scheme can more than double the recall at moderate false positive rates. This greedy approach already yields a median accuracy of 89%, and in 99.8% of the cases produces biologically feasible solutions in the sense that the inferred graphs are rs-Fitch graphs. We close with a discussion of several open problems and directions for future research in Sec. 8.
The material of this contribution is extensive and contains several lengthy, very technical proofs. We therefore divided the presentation into a Narrative Part that contains only those mathematical results that contribute to our main conclusions, and a Technical Part providing additional results and all proofs. To facilitate cross-referencing between the two parts, the same numbering of Definitions, Lemmas, Theorems, etc., is used. Sections A, B, and C contain the technical material corresponding to Sections 4, 5, and 6, respectively.

Notation
Graphs. We consider undirected graphs G = (V, E) and denote edges connecting vertices x, y ∈ V by xy. We write H ⊆ G if V (H) ⊆ V (G) and E(H) ⊆ E(G), in which case H is called a subgraph of G. Given a graph G = (V, E), we write G[W ] for the graph induced by W ⊆ V . A connected component C of G is an inclusion-maximal vertex set such that G[C] is connected. A (maximal) clique C in an undirected graph G is an (inclusion-maximal) vertex set such that, for all vertices x, y ∈ C, it holds that xy ∈ E(G), i.e., G[C] is complete. A subset W ⊆ V is a (maximal) independent set if G[W ] is edgeless (and W is maximal w.r.t. inclusion). A graph G = (V, E) is complete multipartite if V consists of k ≥ 1 pairwise disjoint independent sets I 1 , . . . , I k and xy ∈ E if and only if x ∈ I i and y ∈ I j with i = j.
A graph G together with a vertex coloring σ, denoted by (G, σ), is properly colored if uv ∈ E(G) implies σ(u) = σ(v). For a coloring σ : V → M and a subset W ⊆ V , we write σ(W ) := {σ(w) | w ∈ W } for the set of colors that appear on the vertices in W . Throughout, we will need restrictions of the coloring map σ. We do neither assume that σ nor that its restriction σ |L ,M is surjective.
Rooted Trees. All trees appearing in this contribution are rooted in one of their vertices. We write x T y if y lies on the unique path from the root to x, in which case y is called an ancestor of x, and x is called a descendant of y. We may also write y T x instead of x T y. We use x ≺ T y for x T y and x = y. In the latter case, y is a strict ancestor of x. If x T y or y T x, the vertices x and y are comparable and, otherwise, incomparable. We write L(T ) for the set of leaves of the tree T , i.e., the T -minimal vertices and say that T is a tree on L(T ). We write T (u) for the subtree of T rooted in u. The last common ancestor of a vertex set W ⊆ V (T ) is the T -minimal vertex u := lca T (W ) for which w T u for all w ∈ W . For brevity we write lca T (x, y) = lca T ({x, y}).
We employ the convention that edges (x, y) in a tree are always written such that y T x is satisfied. If (x, y) is an edge in T , then par(y) := x is the parent of y, and y the child of x. We denote with child T (x) the set of all children of x in T . It will be convenient for the discussion below to extend the ancestor relation T on V to the union of the edge and vertex sets of T . More precisely, for a vertex x ∈ V (T ) and an edge e = (u, v) ∈ E(T ) we put x ≺ T e if and only if x T v; and e ≺ T x if and only if u T x. In addition, for edges e = (u, v) and f = (a, b) in T we put e T f if and only if v T b.
A rooted tree is phylogenetic if all vertices that are adjacent to at least two vertices have at least two children. Throughout, we will assume that all trees are rooted and phylogenetic unless explicitly stated otherwise. A tree T is planted if its root has degree 1. In this case, we denote the "planted root" by 0 T . In planted phylogenetic trees there is a unique "planted edge" (0 T , ρ T ) where ρ T := lca T (L(T )). Note that by definition 0 T / ∈ L(T ). Whenever there is no danger of confusion, we will refer to both rooted phylogenetic trees and planted phylogenetic trees simply as trees.
The set of inner vertices is given by V 0 (T ) := V (T ) \ (L(T ) ∪ {0 T }). An edge (u, v) is an inner edge if both vertices u and v are inner vertices and, otherwise, an outer edge. The restiction of T to a subset L ⊆ L(T ) of leaves, denoted by T |L is obtained by identifying the (unique) minimal subtree of T that connects all leaves in L , and suppressing all vertices with degree two except possibly the root ρ T L = lca T (L ). T displays a tree T , in symbols T ≤ T , if T can be obtained from a restriction T |L of T by a series of inner edge contractions (Bryant and Steel, 1995). If, in addition, L(T ) = L(T ), then T is a refinement of T . Throughout this contribution, we will consider leaf-colored trees (T, σ) with σ being defined for L(T ) only.
Rooted Triples. A rooted triple is a tree T on three leaves and two internal vertices. We write ab|c for the triple with lca T (a, b) ≺ lca T (a, c) = lca T (b, c). For a set T of triples we write L(T) := t∈T L(t). The set T is compatible if there is a tree T with L(T) ⊆ L(T ) that displays every triple t ∈ T. The construction of such a tree T from a triple set T on L makes use of an auxiliary graph that will play a prominent role in this contribution.
Definition 2. (Aho et al, 1981) Let T be a set of rooted triples on the vertex set L. The Aho graph [T, L] has vertex set L and edge set {xy | ∃z ∈ L : xy|z ∈ T}.
The algorithm BUILD (Aho et al, 1981) uses Aho graphs in a top-down recursion starting from a given set of triples T and returns for compatible triple sets T on L an unambiguously defined tree Aho(T) on L, which is known as the Aho tree. BUILD runs in polynomial time. The key property of the Aho graph that ensures the correctness of BUILD can be stated as follows: Proposition 1. (Aho et al, 1981;Bryant and Steel, 1995) A set of triples T is compatible if and only if for each subset L ⊆ L(T) with |L| > 1 the graph [T, L] is disconnected.
Cographs are recursively defined as undirected graphs that can be generated as joins or disjoint unions of cographs, starting from single-vertex graphs K 1 . The recursive construction defines a rooted tree (T, t), called cotree, whose leaves are the vertices of the cograph G, i.e., the K 1 s, while each of its inner vertices u of T represent the join or disjoint union operations, labeled as t(u) = 1 and t(u) = 0, respectively. Hence, for a given cograph G and its cotree (T, t), we have xy ∈ E(G) if and only if t(lca T (x, y)) = 1. Contraction of all tree edges (u, v) ∈ E(T ) with t(u) = t(v) results in the discriminating cotree (T G ,t) of G with cotree-labelingt such thatt(u) =t(v) for any two adjacent interior vertices of T G . The discriminating cotree (T G ,t) is uniquely determined by G (Corneil et al, 1981a). Cographs have a large number of equivalent characerizations. In this contribution, we will need the following classical results: Proposition 2. (Corneil et al, 1981a) Given an undirected graph G, the following statements are equivalent: 1. G is cograph.
2. G does not contain a P 4 , i.e., a path on four vertices, as an induced subgraph.
3. diam(H) ≤ 2 for all connected induced subgraphs H of G. Tofigh et al (2011) and Bansal et al (2012) define "Duplication-Transfer-Loss" (DTL) scenarios in terms of a vertex-only map γ : V (T ) → V (S). A definition of a DTL-like class of scenarios in terms of a reconciliation map µ : V (T ) → V (S) ∪ E(S) was analyzed by Nøjgaard et al (2018). For binary trees, the two definitions are equivalent; for non-binary trees, however, the DTL-scenarios are a proper subset, see (Nøjgaard et al, 2018, Fig. 1) for an example. Several other mathematical frameworks have been used in the literature to specify evolutionary scenarios. Examples include the DLS-trees of Górecki and Tiuryn (2006), which can be seen as event-labeled gene trees with leaves denoting both surviving genes and loss-events, maps g : V (S ) → 2 V (T ) from a suitable subdivision S of the species tree S to the gene tree as used by Hallett and Lagergren (2001), and associations of edges, i.e., subsets of E(T ) × E(S) .

Relaxed Reconciliation Maps
In the presence of HGT, the relationships of gene trees and species are not only constrained by local conditions corresponding to the admissible local evolutionary events (duplication, speciation, gene loss, and HGT) but also by the global condition that the HGT events within each lineage admit a temporal order (Merkle and Middendorf, 2005;Gorbunov and Lyubetsky, 2009;Tofigh et al, 2011). In order to capture time-concistency from the outset and to establish the mathematical framework, we consider here trees with explicit timing information (Merkle and Middendorf, 2005).
For later reference, we provide the following simple result.
Lemma 1. Given a rooted tree T , a time map τ T for T satisfying τ T (x) = τ 0 (x) with arbitrary choices of τ 0 (x) for all x ∈ L(T ) can be constructed a linear time.
Proof. We traverse T in postorder. If x is a leaf, we set τ T (x) = τ 0 (x), and otherwise compute t := max u∈child(x) τ T (u) and set τ T (x) = t with an arbitrary value t > t. Clearly the total effort is O(|V (T )| + |E(T )|), and thus also linear in the number of leaves L(T ).
Lemma 1 will be useful for the construction of time maps as it, in particular, allows us to put τ T (x) = τ T (y) for all x, y ∈ L(T ).
Definition 4 (Time Consistency). Let T and S be two planted trees. A map µ : V (T ) → V (S) ∪ E(S) is called time-consistent if there are time maps τ T for T and τ S for S satisfying the following conditions for all u ∈ V (T ): The following definition of reconciliation is designed (1) to be general enough to encompass the notions of reconciliation that have been studied in the literature, and (2) to separate the mapping between gene tree and species tree from specific types of events. Event types such as duplication or horizontal transfer therefore are considered here as a matter of interpreting scenarios, not as part of their definition.
Definition 5 (Relaxed Reconciliation Map and Evolutionary Scenario). Let T = (V, E) and S = (W, F ) be two phylogenetic trees with leaf sets L(T ) and L(S), respectively and let σ : L(T ) → L(S) be a map. A map µ : V → W ∪ F is a relaxed (time-consistent) reconciliation map for (T, S, σ) if the following conditions are satisfied: (G2) Time Consistency Constraint. The map µ is time-consistent with corresponding time maps τ T and τ S such that τ T (x) = τ S (σ(x)) holds for all x ∈ L(T ).
In the following we will refer to the map σ : L(T ) → L(S) as the coloring of S.

LDT Graphs and Evolutionary Scenarios
In the absence of horizontal gene transfer, the last common ancestor of two species A and B should mark the latest possible time point at which two genes a and b residing in σ(a) = A and σ(b) = B, respectively, may have diverged. Situations in which this constraint is violated are therefore indicative of HGT. To address this issue in some more detail, we next define "µ-free scenarios" that eventually will lead us to the class of "LDT graphs" that contain all information about genes that diverged after the species in which they reside.
Definition 6 (µ-free scenario). Let T and S be planted trees, σ : L(T ) → L(S) be a map, and τ T and τ S be time maps of T and S, respectively, such that τ T (x) = τ S (σ(x)) for all x ∈ L(T ). Then, T = (T, S, σ, τ T , τ S ) is called a µ-free scenario.
The condition that τ T (x) = τ S (σ(x)) for all x ∈ L(T ) is mostly a technical convenience that makes µ-free scenarios easier to interpret. Nevertheless, by Lemma 1, given the time map τ S , one can easily construct a time map τ T such that τ T (x) = τ S (σ(x)) for all x ∈ L(T ). In particular, when constructing relaxed scenarios explicitly, we may simply choose τ T (u) = 0 and τ S (x) = 0 as common time for all leaves u ∈ L(T ) and x ∈ L(S).
It is easy to see that the edge set of G < (T) defines an undirected graph and that there are no edges of the form aa, since τ T (lca T (a, a)) = τ T (a) = τ S (σ(a)) = τ S (lca S (σ(a), σ(a))). Hence G < (T) is a simple graph.
The next two results show that the existence of a reconciliation map µ does not impose additional constraints on LDT graphs.
Remark 1. From here on, we omit the explicit reference to Lemma 2 and Thm. 1 and assume that the reader is aware of the fact that every LDT graph is explained by some relaxed scenario S and that for every µ-free scenario T = (T, S, σ, τ T , τ S ), there is a relaxed scenario S for T, S and σ such that (G < (T), σ) = (G < (S), σ).

Properties of LDT Graphs
We continue by deriving several interesting characteristics LDT graphs.
As we shall see below, LDT graphs (G, σ) contain detailed information about both the underlying gene trees T and species trees S for all µ-scenarios that explain (G, σ), and thus by Lemma 2 and Thm. 1 also about every relaxed scenario S satisfying G = G < (S). This information is encoded in the form of certain rooted triples that can be retrieved directly from local features in the colored graphs (G, σ).
Definition 9. For a graph G = (L, E), we define the set of triples on L as T(G) := {xy|z : x, y, z ∈ L are pairwise distinct, xy ∈ E, xz, yz / ∈ E} .
The graphs K 1 and K 2 denote the complete graphs on one and two vertices, respectively. The graph K 2 +K 1 is the disjoint union of a K 2 and a K 1 . The next lemma shows that induced K 2 +K 1 subgraphs in LDT graphs imply triples that must be displayed by the gene tree T .
Figure 1: Top row: A relaxed scenario S = (T, S, σ, µ, τT , τS) (left) with its LDT graph (G < (S), σ) (right). The reconciliation map µ is shown implicitly by the embedding of the gene tree T into the species tree S. The times τT and τS are indicated by the position on the vertical axis, i.e., if a vertex x is drawn higher than a vertex y, this implies τT (y) < τT (x). In subsequent figures we will not show the time maps explicitly. Bottom row: Another relaxed scenario S = (T , S , σ , µ , τ T , τ S ) with a connected LDT graph (G < (S ), σ ). As we shall see, connectedness of an LDT graph depends on the relative timing of the roots of the gene and species tree (cf. Lemma 11).
The next results shows that LDT graphs cannot contain induced P 4 s.
The converse of Lemma 8 is not true is in general. To see this, consider the properly-colored cograph (G, σ) with vertex V (G) = {a, a , b, b , c, c }, edges ab, bc, a b , a c and coloring σ(a) = σ(a ) = A, σ(b) = σ(b ) = B, and σ(c) = σ(c ) = C with A, B, C being pairwise distinct. In this case, S(G, σ) contains the triples AC|B and BC|A. By Lemma 6, the tree S in every µ-free scenario T = (T, S, σ, τ T , τ S ) or relaxed scenario S = (T, S, σ, µ, τ T , τ S ) explaining (G, σ) displays AC|B and BC|A. Since no such scenario can exist, (G, σ) is not an LDT graph.

Recognition and Characterization of LDT Graphs
Definition 11. Let (G = (L, E), σ) be a graph with coloring σ : L → M . Let C be a partition of M , and C be the set of connected components of G. We define the following binary relation R(G, σ, C) by setting (x, y) ∈ R(G, σ, C) ⇐⇒ x, y ∈ L, σ(x), σ(y) ∈ C for some C ∈ C, and x, y ∈ C for some C ∈ C .
In words, two vertices x, y ∈ L are in relation R(G, σ, C) whenever they are in the same connected component of G and their colors σ(x), σ(y) are contained in the same set of the partition of M . As shown in Lemma 9 in the Technical Part, the relation R := R(G, σ, C) is an equivalence relation and every equivalence class of R is contained in some connected component of G. In particular, each connected component of G is the disjoint union of R-classes.  (E) The vertex uT and the vertices vT are created in this recursion step. The vertices wK corresponding to the R-classes K are created in the next-deeper steps. Note that some vertices have only a single child, and thus get suppressed in Line 25.
The following partition of the leaf sets of subtrees of a tree S rooted at some vertex u ∈ V (S) will be useful: If u is not a leaf, then C S (u) := {L(S(v))) | v ∈ child S (u)} and, otherwise, C S (u) := {{u}}.
One easily verifies that, in both cases, C S (u) yields a valid partition of the leaf set L(S(u)). Recall that σ |L ,M : L → M was defined as the "submap" of σ with L ⊆ L and σ(L ) ⊆ M ⊆ M .
Then, for all distinct R-classes K and K , either xy ∈ E for all x ∈ K and y ∈ K , or xy / ∈ E for all x ∈ K and y ∈ K . In particular, for x ∈ K and y ∈ K , it holds that Lemma 10 suggests a recursive strategy to construct a scenario S = (T, S, σ, µ, τ T , τ S ) for a given properly-colored cograph (G, σ), which is illustrated in Fig. 2. The starting point is a species tree S displaying all the triples in S(G, σ) that are required by Lemma 6. We show below that there are no further contraints on S and thus we may choose S = Aho(S(G, σ), L) and endow it with an arbitrary time map τ S . Given (S, τ S ), we construct (T, τ T ) in top-down order. In order to reduce the complexity of the presentation and to make the algorithm more compact and readable, we will not distinguish the cases in which (G, σ) is connected or disconnected, nor whether a connected component is a superset of one or more R-classes. The tree T therefore will not be phylogenetic in general. We shall see, however, that this issue can be alleviated by simply suppressing all inner vertices with a single child.
The root u T is placed above ρ S to ensure that no two vertices from distinct connected components of G will be connected by an edge in G < (S). The vertices v T representing the connected components C of G are each placed within an edge of S below ρ S . W.l.o.g., the edges (ρ S , v S ) are Algorithm 1: Construction of a relaxed scenario S for a properly colored cograph (G, σ) with compatible triple set S(G, σ).
connect w K as a child of v T 23 return u T 24 T ← tree with root BuildGeneTree(L, ρ S ) 25 T ← T with (i) a planted root 0 T added, and (ii) all inner degree-2 vertices (except 0 T ) suppressed 26 τ T (0 T ) ← τ S (0 S ) and µ(0 T ) ← 0 S 27 return (T, S, σ, µ |V (T ) , τ T |V (T ) , τ S ) chosen such that the colors of the corresponding connected component C and the colors in L(S(v S )) overlap. Next we compute the relation R := R(G, σ, C S (ρ S )) and determine, for each connected component C, the R-classes K that are a subset of C. For each of them, a child w K is appended to the tree vertex v T . The subtree T (w K ) will have leaf set L(T (w K )) = K. Since R is defined on C S (ρ S ) in this first step, G(S) will have all edges between vertices that are in the same connected component C but in distinct R-classes (cf. Lemma 10). The definition of R also implies that we always find a vertex v S ∈ child S (ρ S ) such that σ(K) ⊆ L(S(v S )) (more detailed arguments for this are given in the proof of Claim 4 in the proof of Thm. 2 below). Thus we can place w K into this edge (ρ S , v S ), and proceed recursively on the R-classes L := K, the induced subgraphs G[L ] and their corresponding vertices v S ∈ V (S), which then serve as the root of the species trees. More precisely, we identify w K with the root u T created in the "next-deeper" recursion step. Since we alternate between vertices u T for which no edges between vertices of distinct subtrees exist, and vertices v T for which all such edges exist, we can label the vertices u T with "0" and the vertices v T with "1" and obtain a cotree for the cograph G. This recursive procedure is described more formally in Algorithm 1 which also describes the constructions of an appropriate time map τ T for T and a reconciliation map µ. We note that we find it convenient to use as trivial case in the recursion the situation in which the current root u S of the species tree is a leaf rather than the condition |L | = 1. In this manner we avoid the distinction beween the cases u S ∈ L(S) and u S / ∈ L(S) in the else-condition starting in Line 12. This results in a shorter presentation at the expense of more inner vertices that need to be suppressed at the end in order to obtain the final tree T . We proceed by proving the correctness of Algorithm 1.
Theorem 2. Let (G, σ) be a properly colored cograph, and assume that the triple set S(M, G) is compatible. Then Algorithm 1 returns a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) with coloring σ such that G < (S) = G in polynomial time.
As a consequence of Lemma 6 and 8, and the fact that Algorithm 1 returns a relaxed scenario S for a given properly colored cograph with compatible triple set S(G, σ), we obtain Theorem 3. A graph (G, σ) is an LDT graph if and only if it is a properly colored cograph and S(G, σ) is compatible.
Theorem 3 has two consequences that are of immediate interest: Corollary 2. LDT graphs can be recognized in polynomial time.
Corollary 3. The property of being an LDT graph is hereditary, that is, if (G, σ) is an LDT graph then each of its vertex induced sugraphs is an LDT graph.
The relaxed scenarios S explaining an LDT graph (G, σ) are far from being unique. In fact, we can choose from a large set of trees (S, τ S ) that is determined only by the triple set S(G, σ): Corollary 4. If (G, σ) is an LDT graph with coloring σ : L → M , then for all planted trees S on M that display S(G, σ) there is a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) that contains σ and S and that explains (G, σ).
As shown in the Technical Part, for every LDT graph (G, σ) there is a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) explaining (G, σ) such that T displays the discriminating cotree T G of G (cf. Cor. 5 in the Technical Part). However, this property is not satisfied by all relaxed scenarios that explain an (G, σ). Nevertheless, the latter results enable us to relate connectedness of LDT graphs to properties of the relaxed scenarios by which it can be explained (cf. Lemma 11 in Technical Part).

Least Resolved Trees for LDT graphs
As we have seen e.g. in Cor. 4, there are in general many trees S and T forming scenarios S that explain a given LDT graph (G, σ). This begs the question to what extent these trees are determined by "representatives". For S, we have seen that S always displays S(G, σ), suggesting to consider the role of S = Aho(S(G, σ), M ), where M is the codomain of σ. This tree is least resolved in the sense that there is no scenario explaining the LDT graph (G, σ) with a tree S that is obtained from S by edge-contractions. The latter is due to the fact that any edge contraction in Aho(S(G, σ), M ) yields a tree S that does not display S(G, σ) any more (Jansson et al, 2012). By Prop. 6, none of the scenarios containing S explain the LDT graph (G, σ).
In other words, T is least resolved for (G, σ) if no scenario with a gene tree T obtained from T by a series of edge contractions explains (G, σ).
The examples in Fig. 3 show that LDT graphs are in general not accompanied by unique least resolved trees. In the top row, scenarios with different least resolved gene trees T and the same least resolved species tree S explain the LDT graph (G, σ). In the example below, two distinct least resolved species trees exist for a given least-resolved gene tree.

HGT-Labeled Trees and rs-Fitch Graphs
As alluded to in the introduction, the LDT graphs are intimately related with horizontal gene transfer. To formalize this connection we first define transfer edges. These will then be used to . The species tree is also least resolved since contraction of its single inner edge leads to loss of the species triples σ(a)σ(c)|σ(d), σ(b)σ(c)|σ(d) ∈ S(G, σ) (cf. Lemma 6). Bottom row: No unique least resolved species tree. Both trees display the two necessary triples AB|E, CD|E ∈ S(G, σ), and are again least resolved w.r.t. these triples. The gene trees are also least resolved since contraction of either of its two inner edges leads e.g. to loss of one of the triples ae|c, ce |a ∈ T(G). Figure 4: Example of an LDT graph (G, σ) that cannot be explained by a relaxed scenario S = (T, S, σ, µ, τT , τS) such that T is the unique discriminating cotree (shown in panel C) for the cograph G.
encode Walter Fitch's concept of xenologous gene pairs (Fitch, 2000;Darby et al, 2017) as a binary relation, and thus, the edge set of a graph.
Definition 13. Let S = (T, S, σ, µ, τ T , τ S ) be a relaxed scenario. An edge (u, v) in T is a transfer edge if µ(u) and µ(v) are incomparable in S. The HGT-labeling of T in S is the edge labeling λ S : E(T ) → {0, 1} with λ(e) = 1 iff e is a transfer edge.
The vertex u in T thus corresponds to an HGT event, with v denoting the subsequent event, which now takes place in the "recipient" branch of the species tree. Note that λ S is completely determined by S. In general, for a given a gene tree T , HGT events correspond to a labeling or coloring of the edges of T . By definition, Fitch graphs of 0/1-edge-labeled trees are loopless and undirected. We call edges e of (T, λ) with label λ(e) = 1 also 1-edges and, otherwise, 0-edges.
Remark 2. Fitch graphs as defined here have been termed undirected Fitch graphs , in contrast to the notion of the directed Fitch graphs of 0/1-edge-labeled trees studied e.g. in Hellmuth and Seemann, 2019).
1. G is the Fitch graph of a 0/1-edge-labeled tree. 2. G is a complete multipartite graph. 3. G does not contain K 2 + K 1 as an induced subgraph.
Definition 15 (rs-Fitch graph). Let S = (T, S, σ, µ, τ T , τ S ) be a relaxed scenario with HGT-labeling λ S . We call the vertex colored graph ( (S), σ) := ( (T, λ S ), σ) the Fitch graph of the scenario S. A vertex colored graph (G, σ) is a relaxed scenario Fitch graph ( rs-Fitch graph) if there is a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) with coloring σ such that G = (S). Fig. 5 shows that rs-Fitch graphs are not necessarily properly colored. A subtle difficulty arises from the fact that Fitch graphs of 0/1-edge-labeled trees are defined without a reference to the vertex coloring σ, while the rs-Fitch graph is vertex colored. This together with Prop. 5 implies Observation 1. If (G, σ) is an rs-Fitch graph then G is a complete multipartite graph.
The "converse" of Obs. 1 is not true in general, as we shall see in Thm. 6 below. If, however, the coloring σ can be chosen arbitrarily, then every complete multipartite graph G can be turned into an rs-Fitch graph (G, σ) as shown in Prop. 6. Proposition 6. If G is a complete multipartite graph, then there exists a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) such that (G, σ) is an rs-Fitch graph.
Although every complete multipartite graph can be colored in such a way that it becomes an rs-Fitch graph (cf. Prop. 6), there are colored, complete multipartite graphs (G, σ) that are not rs-Fitch graphs, i.e., that do not derive from a relaxed scenario (cf. Thm. 6). We summarize this discussion in the following Observation 2. There are 0/1-edge labeled trees (T, λ) and colorings σ : A subtle -but important -observation is that trees (T, λ) with coloring σ for which Obs. 2 applies may still encode an rs-Fitch graph ( (T, λ), σ), see Example 1 and Fig. 6. The latter is due to the fact that (T, λ) = (T , λ ) may be possible for a different tree (T , λ ) for which there is a relaxed scenario S = (T , S, σ, µ, τ T , τ S ) with λ = λ S . In this case, ( (T, λ), σ) = ( (S ), σ) is an rs-Fitch graph. We shall briefly return to these issues in the discussion section 8. Example 1. Consider the edge-labeled tree (T, λ) shown in Fig. 6 with leaf set Therefore, µ(u) and µ(v) must both be comparable to σ(b) and thus, they are located on the path from ρ S to σ(b). But this implies that µ(u) and µ(v) are comparable in S; a contradiction, since then λ S (u, v) = 0 = λ(u, v) = 1.

LDT Graphs and rs-Fitch Graphs
We proceed to investigate to what extent an LDT graph provides information about an rs-Fitch graph. As we shall see in Thm. 5 there is indeed a close connection between rs-Fitch graphs and LDT graphs. We start with a useful relation between the edges of rs-Fitch graphs and the reconciliation maps µ of their scenarios.
The next result shows that a subset of transfer edges can be inferred immediately from LDT graphs: Theorem 4. If (G, σ) is an LDT graph, then G ⊆ (S) for all relaxed scenarios S that explain (G, σ).
Since we only have that xy is an edge in (S) if the path connecting x and y in the tree T of S contains a transfer edge, Theorem 4 immediately implies Corollary 6. For every relaxed scenario S = (T, S, σ, µ, τ T , τ S ) without transfer edges, it holds that E(G < (S)) = ∅.
Thm. 4 provides the formal justification for indirect phylogenetic approaches to HGT inference that are based on the work of Lawrence and Hartl (1992), Clarke et al (2002), and Novichkov et al (2004) by showing that (x, y) ∈ E(G < (S)) can be explained only by HGT, irrespective of how complex the true biological scenario might have been. However, it does not cover all HGT events. Fig. 7 shows that there are relaxed scenarios S for which G < (S) = (S) even though (S) is properly colored. Moreover, it is possible that an rs-Fitch graph (G, σ) contains edges xy ∈ E(G) with σ(x) = σ(y). In particular, therefore, an rs-Fitch graph is not always an LDT graph.
It is natural, therefore, to ask whether for every properly colored Fitch graph there is a relaxed scenario S such that G < (S) = (S). An affirmative answer is provided by Theorem 5. The following statements are equivalent.

(G, σ) is properly colored and an rs-Fitch graph.
In particular, for every properly colored complete multipartite graph (G, σ) the triple set S(G, σ) is compatible.
Evolutionary scenarios for which ( (S), σ) is properly colored do not admit two members of the same gene family that are separated by a HGT event. While restrictive, such models are not altogether unrealistic. Proper coloring of ( (S), σ) is, in particular, the case if every horizontal transfer is replacing, i.e., if the original copy is effectively overwritten by homologous recombination (Thomas and Nielsen, 2005), see also (Choi et al, 2012) for a detailed case study in Streptococcus. As a consequence of Thm. 5, LDT graphs are sufficient to describe replacing HGT. However, the incidence rate of replacing HGT decreases exponentially with phylogenetic distance between source and target (Williams et al, 2012), and additive HGT becomes the dominant mechanism between phylogenetically distant organism. Still, replacing HGTs may also be the result of additive HGT followed by a loss of the (functionally redundant) vertically inherited gene.

rs-Fitch Graphs with General Colorings
In scenarios with additive HGT, the rs-Fitch graph is no longer properly colored and no-longer coincides with the LDT graph. Since not every vertex-colored complete multipartite graph (G, σ) is an rs-Fitch graph (cf. Thm. 6), we ask whether an LDT (G, σ) that is not itself already an rs-Fitch graph imposes constraints on the rs-Fitch graphs ( (S), σ) that derive from scenarios S that explain (G, σ). As a first step towards this goal, we aim to characterize rs-Fitch graphs, i.e., to understand the conditions imposed by the existence of an underlying scenario S on the compatibility of the collection of independent sets I of G and the coloring σ. As we shall see, these conditions can be explained in terms of an auxiliary graph that we introduce in a very general setting: Definition 16. Let L be a set, σ : L → M a map and I = {I 1 , . . . , I k } a set of subsets of L. Then the graph A (σ, I) has vertex set M and edges xy if and only if x = y and x, y ∈ σ(I ) for some I ∈ I.
By construction A (σ, I ) is a subgraph of A (σ, I) whenever I ⊆ I. An extended version of Def. 16 that contains also an edge-labeling of A (σ, I) can be found in the Technical Partthis technical detail is not needed here. As it turns out, rs-Fitch graphs are characterized by the structure of their auxiliary graphs A as shown in the next Theorem 6. A graph (G, σ) is an rs-Fitch graph if and only if (i) it is complete multipartite with independent sets I = {I 1 , . . . , I k }, and (ii) if k > 1, there is an independent set I ∈ I such that A (σ, I \ {I }) is disconnected.
As a consequence of Theorem 6, we obtain Corollary 9. rs-Fitch graphs can be recognized in polynomial time.
As for LDT graphs, the property of being an rs-Fitch graph is hereditary. Figure  Note, however, that Cor. 14 is not satisfied if we restrict the codomain of σ to the observable part of colors, i.e., if we consider Fig. 8 Fig. 8(C)) that consists of the single edge (0 T , A) and thus, µ(v) and µ(a) as well as µ(v) and µ(a ) must be comparable in this scenario.

Least Resolved Trees for Fitch graphs
It is important to note that the characterization of rs-Fitch graphs in Thm. 6 does not provide us with a characterization of rs-Fitch graphs that share a common scenario with a given LDT graph. As a potential avenue to address this problem we investigate the structure of least-resolved trees for Fitch graphs as possible source of additional contraints.
Definition 17. The edge-labeled tree (T, λ) is Fitch-least-resolved w.r.t. (T, λ), if for all trees T = T that are displayed by T and every labeling λ of T it holds that (T, λ) = (T , λ ).
As shown in the Technical Part (Thm. 7), Fitch-least-resolved trees can be characterized in terms of their edge-labeling, a result that is very similar to the results for "directed" Fitch graphs of 0/1-edge-labeled trees in . As a consequence of this characterization, Fitchleast-resolved trees can be constructed in polynomial time. However, Fitch-least-resolved trees are far from being unique. In particular, Fitch-least-resolved trees are only of very limited use for the construction of relaxed scenarios S = (T, S, σ, µ, τ T , τ S ) from an underlying Fitch graph. In fact, even though (G, σ) is an rs-Fitch graph, Example 3 in the Technical Part shows that it is possible that there is no relaxed scenario S = (T, S, σ, µ, τ T , τ S ) with HGT-labeling λ S such that (T, λ) = (T, λ S ) for any of its Fitch-least-resolved trees (T, λ).

Editing LDT Graphs to Fitch Graphs
Putative LDT graphs (G, σ) can be estimated directly from sequence (dis)similarity data. The most direct approach was introduced by Novichkov et al (2004), where, for (reciprocally) most similar genes x and y from two distinct species σ(x) = A and σ(x) = B, dissimilarities δ(x, y) between genes and dissimilarities ∆(A, B) of the underlying species are compared under the assumption of a (gene family specific) clock-rate r, i.e., the expectation that orthologous gene pairs satisfy δ(x, y) ≈ r∆(A, B). In this setting, (x, y) ∈ E(G) if δ(x, y) < r∆(A, B) at some level of statistical significance. The rate assumption can be relaxed to consider rank-order statistics. For fixed x, differences in the orders of δ(x, y) and ∆(σ(x), σ(y)) assessed by rank-order correlation measures have been used to identify x as HGT candidate e.g. (Lawrence and Hartl, 1992;Clarke et al, 2002). An interesting variation on the theme is described by Sevillya et al (2020), who use relative synteny rather than sequence similarity for the same purpose. A more detailed account on estimating (G, σ) will be given elsewhere.
In contrast, it seems much more difficult to infer a Fitch graph ( , σ) directly from data. To our knowledge, no method for this purpose has been proposed in the literature. However, ( , σ) is of much more direct practical interest because the independent sets of determine the maximal HGT-free subsets of genes, which could be analyzed separately by better-understood techniques. In this section, we therefore focus on the aspects of ( , σ) that are not captured by LDT graphs (G, σ). In the light of the previous section, these are in particular non-replacing HGTs, i.e., HTGs that result in genes x and y in the same species σ(x) = σ(y). In this case, ( , σ) is no longer properly colored and thus G = . To get a better intuition on this case consider three genes a, a , and b with σ(a) = σ(a ) = σ(b) with ab / ∈ E(G) and a b ∈ E(G). By Lemma 7, the gene tree T of any explaining relaxed scenario displays the triple a b|a. Fig. 9 shows two relaxed scenarios with a single HGT that explain this situation: In the first, we have (a, a ) ∈ E( ), while the other implies T T Figure 9: Two relaxed scenarios with T displaying the triple a b|a and explaining the same graph (G, σ).
(a, a ) / ∈ E( ). Neither scenario is a priori less plausible than the other. Although the frequency of true homologous replacement via crossover decreases exponentially with the phylogenetic distance of donor and acceptor species (Williams et al, 2012), additive HGT with subsequent loss of one copy is an entirely plausible scenario.
A pragmatic approach to approximate ( , σ) is therefore to consider the step from an LDT graph (G, σ) to ( , σ) as a graph modification problem. First we note that Algorithm 1 explicitly produces a scenario S and thus implies a corresponding gene tree T S with HGT-labeling λ S , and thus an rs-Fitch graph ( (S), σ). However, Algorithm 1 was designed primarily as proof device. It produces neither a unique scenario nor necessarily the most plausible or a most parsimonious one. Furthermore, both the LDT graph (G, σ) and the desired rs-Fitch graph ( , σ) are consistent with a potentially very large number of scenarios. It thus appears preferable to altogether avoid the explicit construction of scenarios at this stage.
Since every LDT graph (G, σ) is explained by some S, it is also a spanning subgraph of the corresponding rs-Fitch graph ( (S), σ). The step from an LDT graph (G, σ) to an rs-Fitch graph ( , σ) can therefore be viewed as an edge-completion problem. The simplest variation of the problem is Problem 1 (Fitch graph completion). Given an LDT graph (G, σ), find a minimum cardinality set Q of possible edges such that ((V (G), E(G) ∪ Q), σ) is a complete multipartite graph.
A close inspection of Problem 1 shows that the coloring is irrelevant in this version, and the actual problem to be solved is the problem Complete Multipartite Graph Completion with a cograph as input. We next show that this task can be performed in linear time. The key idea is to consider the complementary problem, i.e., the problem of deleting a minimum set of edges from the complementary cograph G such that the end result is a disjoint union of complete graphs. This is known as Cluster Deletion problem (Shamir et al, 2004), and is known to have a greedy solution for cographs (Gao et al, 2013).
Lemma 18. There is a linear-time algorithm to solve Problem 1 for every cograph G.
All maximum clique partitions of a cograph G have the same sequence of cluster sizes (Gao et al, 2013, Thm. 1). However, they are not unique as partitions of the vertex set V (G). Thus the minimal editing set Q that needs to be inserted into a cograph to reach a complete multipartite graphs will not be unique in general. In the Technical Part, we briefly sketch a recursive algorithm operating on the cotree of G.
However, an optimal solution to Problem 1 with input (G, σ) does not necessarily yield an rs-Fitch graph or an rs-Fitch graph ( (S), σ) such that G = G < (S), see Fig. 10. In particular, there are LDT graphs (G, σ) for which more edges need to be added to obtain an rs-Fitch graph than the minimum required to obtain a complete multipartite graph, see Fig. 11. Figure 10: Upper panel: a scenario S with LDT graph (G < (S), σ) and rs-Fitch graph ( (S), σ). There are two minimum edge completion sets that yield the complete multipartite graphs ( 1, σ) and ( 2, σ) (lower part). By Thm. 6, ( 2, σ) is not an rs-Fitch graph. The graph ( 1, σ) is an rs-Fitch graph for the scenario S . However, G < (S) = G < (S ) for all scenarios S with ( (S ), σ) = ( 1, σ). To see this, note that the gene tree T = ((a, b), (a , b )) in S is uniquely determined by application of Lemma 5 and 7. Assume that there is any edge-labeling λ such that (T, λ) = 1. The none-edges in 1 imply that along the two paths from a to a and b to b there is no transfer edge, that is, there cannot be any transfer edge in T ; a contradiction. Figure 11: The LDT graph (G < (S), σ) for scenario S has a unique minimum edge completion set (as determined by full enumeration), resulting in the complete multipartite graph ( 1, σ). However, Thm. 6 implies that ( 1, σ) is not rs-Fitch graph. An edge completion set with more edges must be used to obtain an rs-Fitch graph, for instance ( 2, σ), which is explained by the scenario S .
A more relevant problems for our purposes, therefore is Problem 2 (rs-Fitch graph completion). Given an LDT graph (G, σ) find a minimum cardinality set Q of possible edges such that ((V (G), E(G) ∪ Q), σ) is an rs-Fitch graph.
The following, stronger version is what we ideally would like to solve: Problem 3 (strong rs-Fitch graph completion). Given an LDT graph (G, σ) find a minimum cardinality set Q of possible edges such that = ((V (G), E(G) ∪ Q), σ) is an rs-Fitch graph and there is a common scenario S, that is, S satisfies G = G < (S) and = (S).
The computational complexity of Problems 2 and 3 is unknown. We conjecture, however, that both are NP-hard. In contrast to the application of graph modification problems to correct possible errors in the originally estimated data, the minimization of inserted edges into an LDT graph lacks a direct biological interpretation. Instead, most-parsimonious solutions in terms of evolutionary events are usually of interest in biology. In our framework, this translates to Problem 4 (Min Transfer Completion). Let (G, σ) be an LDT graph and S be the set of all scenarios S with G = G < (S). Find a scenario S ∈ S that has a minimal number of transfer edges among all elements in S and the corresponding rs-Fitch graph (S ).
One way to address this problem might be as follows: Find edge-completion sets for the given LDT graph (G, σ) that minimize the number of independent sets in the resulting rs-Fitch graph = ((V (G), E(G) ∪ Q), σ). The intuition behind this idea is that, in this case, the number of pairs within the individual independent sets is maximized and thus, we get a maximized set of gene pairs without transfer along their connecting path in the gene tree. It remains an open question whether this idea always yields a solution for Problem 4.

Simulation Results
Evolutionary scenarios covering a wide range of HGT frequencies were generated with the simulation library AsymmeTree . The tool generates a planted species tree S with time map τ S . A constant-rate birth-death process then generates a gene tree ( T , τ T ) with additional branching events producing copies at inner vertex u of S propagating to each descendant lineage of u. To model HGT events, a recipient branch of S is selected at random. The simulation is event-based in the sense that each node of the "true" gene tree other than the planted root is one of speciation, gene duplication, horizontal gene transfer, gene loss, or a surviving gene with the latter two forming the leaf set of T .
We used the following parameter settings for AsymmeTree: Planted species trees with a number of leaves between 10 and 50 (randomly drawn in each scenario) were generated using the Innovation Model (Keller-Schmidt and Klemm, 2012) and equipped with a time map as described in . Multifurcations were introduced into the species tree by contraction of inner edges with a common probability p = 0.2 per edge to simulate. Gene trees therefore are also not binary in general. We used multifurcations to model the effects of limited phylogenetic resolution. Duplication and HGT events, however, always result in bifurcations in the gene tree T . We considered different combinations of duplication, loss, and HGT event rates (indicated on the horizontal axis in Figs. 12-14). For each combination of event rates, we simulated 1000 scenarios per event rate combination. Fig. 12 summarizes basic statistics of the simulated data sets.
The simulation also determines the set of surviving genes L ⊆ L( T ), the reconciliation map µ : V ( T ) → V (S) ∪ E(S) and the coloring σ : L → L(S) representing the species in which each surviving gene resides. From the true tree T , the observable gene tree T = T |L is obtained by recursively removing leaves that correspond to loss events, i.e. L( T ) \ L, and suppressing inner vertices with a single child and setting τ T (x) = τ T (x) and µ(x) = µ(x) for all x ∈ V (T ). This defines a relaxed scenario S = (T, S, σ, µ, τ T , τ S ). From the scenario S, we can immediately determine the associated HGT map λ S , the Fitch graph (S), and the LDT graph G < (S). We also consider S = ( T , S, σ, µ, τ T , τ S ) which, from a formal point of view, is not a relaxed scenario, see Fig. 13. In this example, the gene-species association σ : L → L(S) is not a map for the entire leaf set L( T ). Still, we can define the true LDT graph G < ( S) and the true Fitch graph ( S) of S in the same way as LDT graphs using Defs. 7, 8, and 15, respectively. Note that this does not guarantee that every true Fitch graph is also an rs-Fitch graph. The example in Fig. 13 shows, furthermore, that ( S)[L] = (S) is possible. For the LDT graphs, on the other hand, we have G < (S) = G < ( S) because S and S are based on the same time maps.
The distinction between the true graph ( S)[L] and the rs-Fitch graph (S) is closely related to the definition of transfer edges. So far, we only took into account transfer edges (u, v) in the (observable) gene trees T , for which u and v are mapped to incomparable vertices or edges of the species trees S (cf. Def. 13). Thus, given the knowledge of the scenario S = (T, S, σ, µ, τ T , τ S ), these transfer edges are in that sense "visible". However, given S = ( T , S, σ, µ, τ T , τ S ), which still contains all loss branches, it is possible that a non-transfer edge in T corresponds to a path in T which contains a transfer edge w.r.t. S, i.e., some edge (u, v) ∈ E( T ) such that µ(u) and µ(v) are incomparable in S. In particular, this is the case whenever a gene is transferred into some recipient  branch followed by a back-transfer into the original branch and a loss in the recipient branch (see Fig. 13, right). Fig. 13 shows that, in the majority of the simulated scenarios, the HGT informa-tion is preserved in the observable data. In fact, (S) = ( S) in 86.7% of simulated scenarios. Occasionally, however, we also encounter scenarios in which large fractions of the xenologous pairs are hidden from inference by the LDT-based approach.
In the following, we will only be concerned with estimating a Fitch graph (S), i.e., the graph resulting from the "visible" transfer edges. These were edgeless in about 17.7% of the observable scenarios S (all parameter combinations taken into account). In these cases the LDT and thus also the inferred Fitch graphs are edgeless. These scenarios were excluded from further analysis.
We first ask how well the LDT graph G < (S) approximates the Fitch graph (S). As shown in Fig. 14, the recall is limited. Over a broad range of parameters, the LDT graph contains about a third of the xenologous pairs. This begs the question whether the solution of the editing Problem 1, obtained using the exact recursive algorithm detailed in Sec. C in the Technical Part, leads to a substantial improvement. We find that recall indeed increases substantially, at very moderate levels of false positives. The editing approach achieves a median precision of well above 90% in most cases and a median recall of at least 60%, it provides results that are at the very least encouraging. We find that minimal edge completion (Problem 1) already yields an rs-Fitch graph in the vast majority of cases (99.8%, scenarios of all parameter combinations taken into account), even if we restrict the color set to M := σ(L) (instead of L(S)) and thus force surjectivity of the coloring σ. We note that the orginal LDT graph and the minimal edge completion may not always be explained by a common scenario. This suggests that it will be worthwhile to consider the more difficult editing problems for rs-Fitch graphs with a scenario S that at the same time explains the LDT graph.
Alg. 1 provides a means to obtain an rs-Fitch graph satisfying the latter constraint but without giving any guarantees for optimality in terms of a minimal edge completion. An implementation is available in the current release of the Asymmetree package. For the rs-Fitch graphs (S ) of the scenarios S constructed by Alg. 1 with (G < (S), σ) as input, we observe another moderate increase of recall when compared with the minimal edge completion results. This comes, however, at the expense of a loss in precision. This is not surprising, since (S ) by construction contains at least as many edges as any minimal edge completion of G < (S). Therefore, the number of both true positive and false positive edges in (S ) can be expected to be higher, resulting in a higher recall and lower precision, respectively.
The recall is given by T P/(T P + F N ), and |E( (S))| = T P + F N in terms of true positives T P and false negatives F N . Moreover, G < (S) is a subgraph of the Fitch graphs m.e.c. and (S ) inferred with editing or with Alg. 1, respectively. The ratio |E( (S))∩E( * )|/|E( (S)∩E(G < (S)))| with * ∈ { m.e.c. , (S )} therefore directly measures the increase in the number of correctly predicted xenologous pairs relative to the LDT. It is equivalent to the ratio of the respective recalls. By construction, the ratio is always ≥ 1. This is summarized as the second panel in Fig. 14.

Discussion and Future Directions
In this contribution, we have introducedĺater-divergence-time (LDT) graphs as a model capturing the subset of horizontal transfer dectable through the pairs of genes that have diverged later than their respective species. Within the setting of relaxed evolutionary scenarios, LDT graphs (G, σ) are exactly the properly colored cographs with a consistent triple set S(G, σ). We further showed that LDT graphs describe a sufficient set of HGT events if and only if they are complete multipartite graphs. This corresponds to scenarios in which all HGT events are replacing. Otherwise, additional HGT events exist that separate genes from the same species. To better understand these, we investigated scenario-derived rs-Fitch graphs and characterized them as those complete multipartite graphs that satisfy an additional constraint on the coloring (expressed in terms of an auxiliary graph). Although the information contained in LDT graphs is not sufficient to unambiguously determine the missing HGT edges, we arrive at an efficiently solvable graph editing problem from which a "best guess" can be obtained. To our knowledge, this is the first detailed mathematical investigation into the power and limitation of an implicit phylogenetic method for HGT inference.
From a data analysis point of view, LDT graphs appear to be an attractive avenue to infer HGT in practise. While existing methods to estimate them from (dis)similarity data certainly can be improved, it is possible to use their cograph structure to correct the initial estimate in the same way as orthology data (Hellmuth et al, 2015). In particular, it does not appear too difficult to modify efficient cograph editing heuristics (Crespelle, 2019;Hellmuth et al, 2020a) to accomodate the additional coloring constraints. Several alternative routes could then be followed to obtain Fitch graphs from the LDT graphs. The most straightforward way is to elaborate on the editing problems briefly discussed in Sec. 6. A natural question arising in this context is whether there are non-LDT  Figure 14: Xenologs inferred from LDT graphs. Only observable scenarios S whose LDT graph (G < (S), σ) contains at least one edge are included (82.3% of all scenarios). The tuples on the horizontal axis give the rates for duplication, loss, and horizontal transfer. Top panel: Recall. Fraction of edges in (S) represented in G < (S) (light blue). As an alternative, the fraction of edges in a "minimum edge completion" (m.e.c.) to the "closest" complete multipartite graph is shown in dark blue. We observe a substantial increase in the fraction of inferred edges. The Fitch graph (S ) obtained from the scenario S produced by Alg. 1 with input (G < (S), σ) yields an even better recall (light green). Second panel: Increase in the number of correctly inferred edges relative to the LDT graph G < (S). Third panel: Precision. In contrast to LDT graphs, which by Thm. 4 cannot contain false positive edges, this is not the case for the estimated Fitch graphs obtained as m.e.c. and by Alg. 1. While false positive edges are typically rare, occasionally very poor estimates are observed. Bottom panel: Accuracy.
edges that are shared by all minimal completion sets Q, and whether these "obligatory Fitchedges" can be determined efficiently. A natural alternative is to modify Algorithm 1 to incorporate some form of cost function to favor the construction of biologically plausible scenarios. In a very different approach, one might also consider to use LDT graphs as constraints in probabilistic models to reconstruct scenarios, see e.g. (Sjöstrand et al, 2014;Khan et al, 2016).
Although we have obtained characterizations of both LDT graphs and rs-Fitch graphs, many open questions and avenues for future research remain.
Reconciliation maps. The notion of relaxed reconciliation maps used here appears to be at least as general as alternatives that have been explored in the literature. It avoids the concurrent definition of event types and thus allows situations that may be excluded in a more restrictive setting. For example, relaxed scenarios may have two or more vertically inherited genes x and y in the same species with u := lca T (x, y) mapping to a vertex of the species trees. In the usual interpretation, u correspond to a speciation event (by virtue of µ(u) ∈ V 0 (S)); on the other hand, the descendants x and y constitute paralogs in most interpretations. Such scenarios are explicitly excluded e.g. in . Lemma 3 suggests that relaxed scenarios are sufficiently flexible to make it possible to replace a scenario S that is "forbidden" in response to such inconsistent interpretations of events by an "allowed" scenario S with the same σ such that G < (S) = G < (S ). Whether this is indeed true, or whether a more restrictive definition of reconciliation imposes additional constraints of LDT graphs will of course need to be checked in each case.
The restriction of a µ-free scenario to a subset L of leaves of T and to a subset M of leaves of S is well defined as long as σ(L ) ⊆ M . One can also define a corresponding restriction of the reconciliation map µ. Most importantly, the deletion of some leaves of T may leave interval vertices in T with only a single child, which are then removed to recover a phylogenetic tree. This replaces paths in T by single edges and thus affects the definition of the HGT map λ S since a path in T that contains two adjacent vertices u 1 , u 2 with incomparable images µ(u 1 ) and µ(u 2 ) may be replaced by an edge with comparable end points in the restricted scenario S . This means that HGT events may become invisible, and thus (S ) is not necessarily an induced subgraph of (S), but a subgraph that may lack additional edges. Note that this is in contrast to the assumptions made in the analysis of (directed) Fitch graphs of 0/1-edge-labeled graphs Hellmuth and Seemann, 2019), where the information on horizontal transfers is inherited upon restriction of (T, λ).
Observability. The latter issue is a special case of the more general problem with observability of events. Conceptually, we assume that evolution followed a true scenario comprising discrete events (speciations, duplications, horizontal transfer, gene losses, and possibly other events such as hybridization which are not considered here). In computer simulations, of course we know this true scenario, as well as all event types. Gene loss not only renders some leaves invisible but also erases the evidence of all subtrees without surviving leaves. Removal of these vertices in general results in a non-phylogenetic gene tree that contains inner vertices with a single child. In the absence of horizontal transfer, this causes little problems and the unobservable vertices can be be removed as described in the previous paragraph, see e.g. (Hernández-Rosales et al, 2012). The situation is more complicated with HGT. In (Nøjgaard et al, 2018), an HGT-vertex is deemed observable if it has both a horizontally and a vertically inherited descendant. In our present setting, the scenario retains an HGT-edge by virtue of consecutive vertices in T with incomparable µ-images, irrespective of whether an HGT-vertex is retained. This type of "vertex-centered" notion of xenology is explored further in . We suspect that these different points of view can be unified only when gene losses are represented explicitly or when gene and species tree trees are not required to be phylogenetic (with single-child vertices implicating losses). Either extension of the theory, however, requires a more systematic understanding of which losses need to be represented and what evidence can be acquired to "observe" them. Impact of Orthology. Pragmatically, one would define two genes x and y to be orthologs if µ(lca T (x, y)) ∈ V 0 (S), i.e., if x and y are the product of a speciation event. Lemma 3 implies that there is a always a scenario without any orthologs that explains a given LDT graph (G, σ). In particular, therefore, (G, σ) makes no implications on orthology. Conversely, however, orthology information is available and additional information on HGT might become available. In a situation akin to Fig. 9 (with the ancestral duplication moved down to the speciation), knowing that a and b are orthologs in the more restrictive sense that µ(lca T (a, b)) = lca S (σ(a), σ(b)) excludes the r.h.s. scenario and implies that a is the horizontally inherited child, and therefore also that a and a are xenologs. This connection of orthology and xenology will be explored elsewhere.
Other types of implicit phylogenetic information. LDT graphs are not the only conceivable type of accessible xenology information. A large class of methods is designed to assess whether a single gene is a xenolog, i.e., whether there is evidence that it has been horizontally inserted into the genome of the recipient species. The main subclasses evaluate nucleotide composition patterns, the phyletic distribution of best-matching genes, or combination thereof. A recent overview can be found e.g. in (Sánchez-Soto et al, 2020). It remains an open question how this information can be utilized in conjunction with other types of HGT information, such as LDT graphs. It seems reasonable to expect that it can provide not only additional constraints to infer rs-Fitch graphs but also provides directional information that may help to infer the directed Fitch graphs studied by Hellmuth and Seemann, 2019). Complementarily, we may ask whether it is possible to gain direct information on HGT edges between pairs of genes in the same genome, and if so, what needs to be measured to extract this information efficiently.
We also have to leave open several mathematical questions. Regarding 0/1-edge labeled trees (T, λ), it would be of interest to know whether there is always a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) such that (T, λ) = (T, λ S ) for a suitable choice of σ. Elaborating on Theorem 5, it would be interesting to characterize the leaf colorings σ for (T, λ) such that there is a relaxed scenario S with (T, λ) = (S). This work was funded in part by the Deutsche Forschungsgemeinschaft (proj. CO1 within CRG 1423, no. 421152132 and proj. MI439/14-2), and by the Natural Sciences and Engineering Research Council of Canada (NSERC).

A.1 LDT Graphs and Evolutionary Scenarios
In the absence of horizontal gene transfer, the last common ancestor of two species A and B should mark the latest possible time point at which two genes a and b residing in σ(a) = A and σ(b) = B, respectively, may have diverged. Situations in which this constraint is violated are therefore indicative of HGT.
Definition 6 (µ-free scenario). Let T and S be planted trees, σ : L(T ) → L(S) be a map and τ T and τ S be time maps of T and S, respectively, such that τ T (x) = τ S (σ(x)) for all x ∈ L(T ). Then, T = (T, S, σ, τ T , τ S ) is called a µ-free scenario.
The condition that τ T (x) = τ S (σ(x)) for all x ∈ L(T ) is mostly a technical convenience that makes µ-free scenarios easier to interpret. Nevertheless, by Lemma 1, given the time map τ S , one can easily construct a time map τ T such that τ T (x) = τ S (σ(x)) for all x ∈ L(T ). In particular, when constructing relaxed scenarios explicitly, we may simply choose τ T (u) = 0 and τ S (x) = 0 as common time for all leaves u ∈ L(T ) and x ∈ L(S).
It is easy to see that the edge set of G < (T) defines an undirected graph and that there are no edges of the form aa, since τ T (lca T (a, a)) = τ T (a) = τ S (σ(a)) = τ S (lca S (σ(a), σ(a))). Hence G < (T) is a simple graph.
Proof. Let T = (T, S, σ, τ T , τ S ) be a µ-free scenario. In order to construct a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) that satisfies G < (S) = G < (T), we start with a time map τ T for T satisfying To see this, we can choose x ∈ V (T ) such that τ T (v) = t min,T . By the definition of time maps and minimality of τ T (v), the vertex x must be a leaf. Hence, since T is a µ-free scenario, we have τ T (x) = τ S (σ(x)) with X := σ(x) ∈ L(S) ⊂ V (S). Therefore, it must hold that t min,S ≤ t min,T . We now define P := {p ∈ V (S) ∪ E(S) | X S p}, i.e., the set of all vertices and edges on the unique path in S from 0 S to the leaf X. Since τ S (X) = t min,T < t max,T = τ S (0 S ), we find, for each v ∈ V (T ), either a vertex u ∈ P such that τ T (v) = τ S (u) or an edge (u, w) ∈ P such that τ S (w) < τ T (v) < τ S (u). Hence, we can specify the reconciliation map µ by defining, for every v ∈ V (T ), For each v ∈ V 0 (T ), exactly one of the two alternatives for P applies, hence µ is well-defined. It is now an easy task to verify that all conditions in Definitions 4 and 5 are satisfied for S = (T, S, σ, µ, τ T , τ S ) by construction. Hence, S is a relaxed scenario.
Remark 3. From here on, we omit the explicit reference to Lemma 2 and Thm 1 and assume that the reader is aware of the fact that every LDT graph is explained by some relaxed scenario S and that for every µ-free scenario T = (T, S, σ, τ T , τ S ), there is a relaxed scenario S for T, S and σ such that (G < (T), σ) = (G < (S), σ).
We now derive some simple properties of µ-free and relaxed evolutionary scenarios. It may be surprising at first glance that "the speciation nodes", i.e., vertices u ∈ V 0 (T ) with µ(u) ∈ V (S) do not play a special role in determining LDT graphs.
Lemma 3. For every relaxed scenario S = (T, S, σ, µ, τ T , τ S ) there exists a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) such that G < ( S) = G < (S) and for all distinct x, y ∈ L(T ) with xy / ∈ E(G < (S)) holds τ T (lca T (x, y)) > τ S (lca S (σ(x), σ(y))). We have D S = ∅ and D T = ∅ since we do not consider empty trees, and thus, at least the "planted" edges 0 S ρ S and 0 T ρ T always exist. By construction, all values in D T , D S , and D T S are strictly positive. Now define Since D S and D T are not empty, is well-defined and, by construction, > 0. Next we set, for all v ∈ V (T ), Claim 1. S := (T, S, σ, µ, τ T , τ S ) is a relaxed scenario.
Proof: Let xy be an edge in G < (S) and thus x = y, and set v T := lca T (x, y) and v S := lca S (σ(x), σ(y)). By definition, we have τ T is an inner vertex of T . By construction, therefore, τ T (v T ) = τ T (v T ) + . The latter arguments together with the fact that τ S remains unchanged imply that τ S (v S ) − τ T (v T ) ≥ > 0, and thus, τ T (v T ) < τ S (v S ). Therefore, we conclude that xy is an edge in G < ( S).
Proof: Suppose xy / ∈ E(G < (S)) for two distinct x, y ∈ L(T ), and set v T := lca T (x, y) and v S := lca S (σ(x), σ(y)). By definition, this implies τ T (v T ) ≥ τ S (v S ). Since x = y, we clearly have that v T = lca T (x, y) is an inner vertex of T , and hence, τ T (v T ) = τ T (v T ) + . The latter two argument together with > 0 and the fact that τ S remains unchanged imply that τ T (v T ) > τ S (v S ).
Lemma 3, however, does not imply that one can always find a relaxed scenario with a reconciliation map µ for given trees T and S satisfying µ(lca T (x, y)) S lca S (σ(x), σ(y)) for all distinct x, y ∈ L(T ) with (x, y) / ∈ E(G < (S)), as shown in Example 2.
For the special case that the graph under consideration has no edges we have Proof. Given T and S we construct a relaxed scenario as follows. Let τ S be an arbitrary time map on S. Then we can choose τ T such that τ S (ρ S ) < τ T (u) < τ S (0 S ) for all u ∈ V 0 (T ). Each leaf u ∈ L(T ) then has a parent in T located above the last common ancestor ρ S of all species in which case G < (S) is edgeless.
Lemma 4 is reminiscent of the fact that for DL-only scenarios any given gene tree T can be reconciled with an arbitrary species tree as long as σ(L(T )) = L(S) (Guigó et al, 1996;Geiß et al, 2020a).
Extending earlier work of Dekker (1986), Bryant and Steel (1995) derived conditions under which two triples r 1 , r 2 imply a third triple r 3 that must be displayed by any tree that displays r 1 , r 2 . In particular, we make frequent use of the following Lemma 5. If a tree T displays xy|z and zw|y then T displays xy|w and zw|x. In particular T |{x,y,z,w} = ((x, y), (z, w)) (in Newick format).
Therefore we have to consider the following four cases: (1) c). Note, for any three vertices x, y, z in T , lca T (x, y) = lca T (x, z) = lca T (y, z) implies that lca T (x, y) ≺ T lca T (x, z) = lca T (y, z). In Cases (1) and (2), we find τ S (lca S (A, C)) > τ T (u) ≥ τ S (lca S (A, B)). Together with the fact that lca S (A, C)) and lca S (A, B) are comparable in S, this implies that AB|C is displayed by S. In Case (3), we obtain τ S (lca S (B, C)) > τ T (u) ≥ τ S (lca S (A, B)) and, by analogous arguments, AB|C is displayed by S. Finally, in Case (4), the tree T displays the triple ab|c. Thus, τ S (lca S (A, B)) ≤ τ T (lca T (a, b)) < τ T (u) < τ S (lca S (A, C)). Again, AB|C is displayed by S.
The next lemma shows that induced K 2 + K 1 subgraphs in LDT graphs implies triples that must be displayed by T .
Proof. Suppose that (G = (L, E), σ) is an LDT graph and let T = (T, S, σ, τ T , τ S ) be a µ-free scenario that explains (G, σ). In order to show that T(G) is compatible it suffices to show that T displays every triple in T(G, σ).
There are two cases, either σ(c) ∈ {A, B} or not. Suppose first that w.l.o.g. σ(c) = A. In this case, ab ∈ E and bc / ∈ E together imply τ T (lca T (a, b)) < τ S (lca S (A, B)) ≤ τ T (lca T (b, c)). This and the fact that lca T (a, b) and lca T (b, c) are comparable in T implies that T displays ab|c.
We note, finally, that the Aho graph of the triple set [T(G), L] in a sense recapitulates G. More precisely, we have: Proposition 4. Let (G = (L, E), σ) be a vertex-colored graph. If for all edges xy ∈ E there is a vertex z such that xz, yz / ∈ E (and thus, in particular, in case that G is disconnected), then [T(G), L] = G.
Proof. Clearly, the vertex sets of [T(G), L] and G are the same, that is, L. Let xy ∈ E and thus, we have x = y. There is a vertex z = x, y in G with xz, yz / ∈ E if and only if xy|z ∈ T(G) and thus, if and only if xy is an edge in [T(G), L] = G.
Definition 10. For a vertex-colored graph (G, σ), we will use the shorter notation x 1 −x 2 −· · ·−x n and X 1 − X 2 − · · · − X n for a path P n that is induced by the vertices {x i | 1 ≤ i ≤ n} with colors σ(x i ) = X i , 1 ≤ i ≤ n and edges x i x i+1 , 1 ≤ i ≤ n − 1.
Proof. Let T = (T, S, σ, τ T , τ S ) be a µ-free scenario that explains (G, σ). By Prop. 3, (G, σ) is properly colored. To show that G = (L, E) is a cograph it suffices to show that G does not contain an induced path on four vertices (cf. Prop 2). Hence, assume for contradiction that G contains an induced P 4 .
First we observe that for each edge ab in this P 4 it holds that σ(a) = σ(b) since, otherwise, by Prop. 3, ab / ∈ E. Based on possible colorings of the P 4 w.r.t. σ and up to symmetry, we have to consider four cases: In Case (1) a, d)). This and the fact that lca T (a, b) and lca T (a, d) are comparable in T implies that T displays ab|d. Similarly, cd ∈ E and ad / ∈ E implies that T displays cd|a is displayed by T . By Lemma 5, T |abcd = ((a, b), (c, d)). Let y := lca T (a, b, c, d) = ρ T |abcd . Now, bc ∈ E, lca T (b, c) = y, and lca S (B, C) = x implies τ T (y) < τ S (x). This and lca T (a, d) = y and lca S (A, D) = x imply that ad ∈ E, and thus a, b, c, d do not induce a P 4 in G; a contradiction.
Case (2) can be directly excluded, since Lemma 6 implies that, in this case, S must display AC|B and AB|C; a contradiction. Now consider Case (3), that is, the P 4 is of the form a − b − a − c with σ(a) = σ(a ) = A, σ(b) = B and σ(c) = C. By Lemma 6, the species tree S must display BC|A and thus x := lca S (A, B) = lca S (A, C). Since ab ∈ E and ac / ∈ E we observe τ T (lca T (a, b)) < τ S (x) ≤ lca T (a, c) and, as in Case (1) we infer that T displays ab|c. By similar arguments, a c ∈ E and ac / ∈ E implies that T displays a c|a. By Lemma 5, T |abcd = ((a, b), (a , c)) and thus, y := lca T (a , b) = lca T (a, c) and a b ∈ E implies that τ T (y) < τ S (x). Since y = lca T (a, c) and τ T (y) < τ S (x) = τ S (lca S (A, C)), we can conclude that ac ∈ E. Hence, a, b, c, d do not induce a P 4 in G; a contradiction.
The converse of Lemma 8 is not true in general. To see this, consider the properly-colored cograph (G, σ) with vertex V (G) = {a, a , b, b , c, c }, edges ab, bc, a b , a c and coloring σ(a) = σ(a ) = A σ(b) = σ(b ) = B, σ(c) = σ(c ) = C with A, B, C being pairwise distinct. In this case, S(G, σ) contains the triples AC|B and BC|A. By Lemma 6, the tree S in every µ-free scenario T = (T, S, σ, τ T , τ S ) or relaxed scenario S = (T, S, σ, µ, τ T , τ S ) explaining (G, σ) displays AC|B and BC|A. Since no such scenario can exist, (G, σ) is not an LDT graph.

A.3 Recognition and Characterization of LDT Graphs
Definition 11. Let (G = (L, E), σ) be a graph with coloring σ : L → M . Let C be a partition of M , and C be the set of connected components of G. We define the following binary relation R(G, σ, C) by setting (x, y) ∈ R(G, σ, C) ⇐⇒ x, y ∈ L, σ(x), σ(y) ∈ C for some C ∈ C, and x, y ∈ C for some C ∈ C .
In words, two vertices x, y ∈ L are in relation R(G, σ, C) whenever they are in the same connected component of G and their colors σ(x), σ(y) are contained in the same set of the partition of M .
Lemma 9. Let (G = (L, E), σ) be a graph with coloring σ : L → M and C be a partition of M . Then, R := R(G, σ, C) is an equivalence relation and every equivalence class of R, or short R-class, is contained in some connected component of G. In particular, each connected component of G is the disjoint union of R-classes.
Proof. It is easy to see that R is reflexive and symmetric. Moreover, xy, yz ∈ R implies that σ(x), σ(y), σ(z) must be contained in the same set of the partition C, and x, y, z must be contained in the same connected component of G. Therefore, xy ∈ R and thus, R is transitive. In summary, R is an equivalence relation.
We continue with showing that every R-class K is entirely contained in some connected component of G. Clearly, there is a connected component C of G such that C ∩ K = ∅. Assume, for contradiction, that K ⊆ C. Hence, G must be disconnected and, in particular, there is a second connected component C of G such that C ∩ K = ∅. Hence, there is a pair xy ∈ K such that x ∈ C ∩ K and y ∈ C ∩ K. But then x and y are in different connected components of G violating the definition of R; a contradiction. Hence, every R-class is entirely contained in some connected component of G. This and the fact the R-classes are disjoint implies that each connected component of G is the disjoint union of R-classes.
The following partition of the leaf sets of subtrees of a tree S rooted at some vertex u ∈ V (S) will be useful: Then, for all distinct R-classes K and K , either xy ∈ E for all x ∈ K and y ∈ K , or xy / ∈ E for all x ∈ K and y ∈ K . In particular, for x ∈ K and y ∈ K , it holds that xy ∈ E ⇐⇒ K, K are contained in the same connected component of G[L ].
Proof. Let σ : L → M and put S = S(G, σ). Since S is a compatible triple set on M , there is a tree S on M that displays S. Moreover, the condition σ(L ) ⊆ L(S(u)) ⊆ M together with the fact that C S (u) is a partition of L(S(u)) ensures that R is well-defined. Now suppose that K and K are distinct R-classes. As a consequence of Lemma 9, we have exactly the two cases: either (i) K and K are contained in the same connected component C of G[L ] or (ii) K ⊆ C and K ⊆ C for distinct components C and C of G[L ].
Case (i). Assume, for contradiction, that there are two vertices x ∈ K and y ∈ K with xy / ∈ E. Note that C ⊆ L and thus, G[C] is an induced subgraph of G[L ]. By Prop. 2, both induced subgraphs G[L ] and G[C] are cographs. Now we can again apply Prop. 2 to conclude that diam(G[C]) ≤ 2. Hence, there is a vertex z ∈ C such that xz, zy ∈ E. Since x and y are in distinct classes of R but in the same connected component C of G[L ], σ(x) and σ(y) must lie in distinct sets of C S (u). In particular, it must hold that σ(x) = σ(y). The fact that G[L ] is properly colored together with xz, yz ∈ E implies that σ(z) = σ(x), σ(y). By definition and since G[L ] is an induced subgraph of G, we obtain that σ(x)σ(y)|σ(z) ∈ S. In particular, σ(x)σ(y)|σ(z) is displayed by S. Since σ(x) and σ(y) lie in distinct sets of C S (u), u must be an inner vertex, and we have σ(x) ∈ L(S(v)) and σ(y) ∈ L(S(v )) for distinct v, v ∈ child S (u). In particular, it must hold that lca S (σ(x), σ(y)) = u. Moreover, z ∈ C ⊆ L and σ(L ) ⊆ L(S(u)) imply that σ(z) ∈ L(S(u)). Taken together, the latter two arguments imply that S cannot display the triple σ(x)σ(y)|σ(z); a contradiction.
Case (ii). By assumption, the R-classes K and K are in distinct connected components of G[L ], which immediately implies xy / ∈ E for all x ∈ K, y ∈ K . In summary, either xy ∈ E for all x ∈ K and y ∈ K , or xy / ∈ E for all x ∈ K and y ∈ K . Moreover, Case (i) establishes the if -direction and Case (ii) establishes, by means of contraposition, the only-if -direction of the final statement.
Lemma 10 suggests a recursive strategy to construct a scenario S = (T, S, σ, µ, τ T , τ S ) for a given properly-colored cograph (G, σ), which is outlined in the main part of this paper and described more formally in Algorithm 1. We proceed by proving the correctness of Algorithm 1.
Theorem 2. Let (G, σ) be a properly colored cograph, and assume that the triple set S(M, G) is compatible. Then Algorithm 1 returns a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) with coloring σ such that G < (S) = G in polynomial time.
Proof. Let σ : L → M and put S := S(G, σ). By a slight abuse of notation, we will simply write µ and τ T also for restrictions to subsets of V (T ). Observe first that due to Line 1, the algorithm continues only if (G, σ) is a properly colored cograph and S is compatible, and returns a tuple S = (T, S, σ, µ, τ T , τ S ) in this case. In particular, a tree S on M that displays S exists, and can e.g. be constructed using BUILD (Line 1). By Lemma 1, we can always construct a time map τ S for S satisfying τ S (x) = 0 for all x ∈ L(S) (Line 2). By definition, τ S (y) > τ S (x) must hold for every edge (y, x) ∈ E(S), and thus, we obtain > 0 in Line 3. Moreover, the recursive function BuildGeneTree maintains the following invariant: Claim 4. In every recursion step of the function BuildGeneTree, we have σ(L ) ⊆ L(S(u S )).
Proof: Since S (with root ρ S ) is a tree on M by construction and thus L(S(ρ S )) = M , the statement holds for the top-level recursion step on L and ρ S . Now assume that the statement holds for an arbitrary step on L and u S . If u S is a leaf, there are no deeper recursion steps. Thus assume that u S is an inner vertex. Recall that C S (u S ) is a partition of L(S(u S )) (by construction), and that R = R(G[L ], σ |L ,L(S(u)) , C S (u S )) is an equivalence relation (by Lemma 9). This together with the definition of R and σ(L ) ⊆ L(S(u S )), implies that there is a child v S ∈ child S (u S ) such that σ(K) ⊆ L(S(v S )) for all R-classes K. In particular, therefore, the statement is true for all recursive calls on K and v S in Line 21. Repeating this argument top-down along the recursion hierarchy proves the claim.
Note, that we are in the else-condition in Line 13 only if u S is not a leaf. Therefore and as a consequence of Claim 4 and by similar arguments as in its proof, there is a vertex v * S ∈ child S (u S ) such that σ(C) ∩ L(S(v * S )) = ∅ for every connected component C of G [L ] in Line 17, and a vertex v S ∈ child S (u S ) such that σ(K) ⊆ L(S(v S )) for every R-class K in Line 20. Moreover, par S (u S ) is always defined since we have u S = ρ S and thus par S (u S ) = 0 S in the top-level recursion step, and recursively call the function BuildGeneTree on vertices v S such that v S ≺ S u S .
In summary, all assignments are well-defined in every recursion step. It is easy to verify that the algorithm terminates since, in each recursion step, we either have that u S is a leaf, or we recurse on vertices v S that lie strictly below u S . We argue that the resulting tree T is a not necessarily phylogenetic tree on L by observing that, in each step, each x ∈ L is either attached to the tree as a leaf if u S is a leaf, or, since R forms a partition of L by Lemma 9, passed down to a recursion step on K for some R-class K. Nevertheless, T is turned into a phylogentic tree T by supression of degree two vertices in Line 25. Finally, µ(x) and τ T (x) are assigned for all vertices x ∈ L(T ) = L in Line 11, and for all newly created inner vertices in Lines 7 and 18.
Recall that τ S is a valid time map satisfying τ S (x) = 0 for all x ∈ L(S) by construction. Before we continue to show that S is a relaxed scenario, we first show that the conditions for time maps and time consistency are satisfied for (T , τ T , S, τ S , µ): Claim 5. For all x, y ∈ V (T ) with x ≺ T y, we have τ T (x) < τ T (y). Moreover, for all x ∈ V (T ), the following statements are true: Proof: Recall that we always write an edge (u, v) of a tree T such that v ≺ T u. For the first part of the statement, it suffices to show that τ T (x) < τ T (y) holds for every edge (y, x) ∈ E(T ), and thus to consider all vertices x = ρ T in T and their unique parent, which will be denoted by y in the following. Likewise, we have to consider all vertices x ∈ V (T ) including the root to show the second statement. The root ρ T of T corresponds to the vertex u T created in Line 6 in the top-level recursion step on L and ρ S . Hence, we have µ(ρ T ) = (par S (ρ S ) = 0 S , ρ S ) ∈ E(S) and τ T (ρ T ) = τ S (ρ S ) + (cf. Line 7). Therefore, we have to show (ii). Since > 0, it holds that τ S (ρ S ) < τ T (ρ T ). Moreover, τ S (0 S ) − τ S (ρ S ) ≥ 3 holds by construction, and thus τ S (0 S ) − (τ T (ρ T ) − ) ≥ 3 and τ S (0 S ) − τ T (ρ T ) ≥ 2 , which together with > 0 implies τ T (ρ T ) < τ S (0 S ). We now consider the remaining vertices x ∈ V (T ) \ {ρ T }. Every such vertex x is introduced into T in some recursion step on L and u S in one of the Lines 6, 10, 15 or 21. There are exactly the following three cases: (a) x ∈ L(T ) is a leaf attached to some inner vertex u T in Line 10, (b) x = v T as created in Line 15, and (c) x = w T as assigned in Line 21. Note that if x = u T as created in Line 6, then u T is either the root of T , or equals a vertex w T as assigned in Line 21 in the "parental" recursion step. In Case (a), we have that x ∈ L(T ) is a leaf and attached to some inner vertex y = u T . Since u S must be a leaf in this case, and thus τ S (u S ) = 0, we have τ T (y) = 0 + = and τ T (x) = 0 (cf. Lines 7 and 11). Since > 0, this implies τ T (x) < τ T (y). Moreover, we have µ(x) = σ(x) ∈ L(S) ⊂ V (S) (cf. Line 11), and thus have to show Subcase (i). Since u S is a leaf and σ(L ) ⊆ L(S(u S )), we conclude σ(x) = u S . Thus we obtain τ T (x) = 0 = τ S (u S ) = τ S (µ(x)). In Case (b), we have x = v T as created in Line 15, and x is attached as a child to some vertex y = u T created in the same recursion step. Thus, we have τ T (y) = τ S (u S ) + and τ T (x) = τ S (u S ) − (cf. Lines 7 and 18). Therefore and since > 0, it holds τ T (x) < τ T (y). Moreover, we have µ(x) = (u S , v * S ) ∈ E(S) for some v * S ∈ child S (u S ). Hence, we have to show Subcase (ii). By a similar calculation as before, > 0, . In Case (c), x = w T as assigned in Line 21 is equal to u T as created in Line 6 in some nextdeeper recursion step with u S ∈ child S (u S ). Thus, we have τ T (x) = τ S (u S ) + and µ(x) = (u S , u S ) ∈ E(S) (cf. Line 7). Moreover, x is attached as a child of some vertex y = v T as created in Line 15. Thus, we have τ T (y) = τ S (u S ) − . By construction and since (u S , u S ) ∈ E(S), we have τ S (u S ) − τ S (u S ) ≥ 3 . Therefore, (τ T (y) + ) − (τ T (x) − ) ≥ 3 and thus τ T (y) − τ T (x) ≥ . This together with > 0 implies τ T (x) < τ T (y). Moreover, since µ(x) = (u S , u S ) ∈ E(S) for some u S ∈ child S (u S ), we have to show Subcase (ii). By a similar calculation as before, > 0, Claim 6. S = (T, S, σ, µ, τ T , τ S ) is a relaxed scenario.
Proof: The tree T is obtained from T by first adding a planted root 0 T (and connecting it to the original root) and then suppressing all inner vertices except 0 T that have only a single child in Line 25. In particular, T is a planted phylogenetic tree by construction. The root constraint (G0) µ(x) = 0 S if and only if x = 0 T also holds by construction (cf. Line 26). Since we clearly have not contracted any outer edges (y, x), i.e. with x ∈ L(T ), we conclude that L(T ) = L(T ) = L.
As argued before, we have τ T (x) = 0 and µ(x) = σ(x) whenever x ∈ L(T ) = L(T ) (cf. Line 11). Since all other vertices are either 0 T or mapped by µ to some edge of S (cf. Lines 26, 7 and 18), the leaf constraint (G2) µ(x) = σ(x) is satisfied if and only if x ∈ L(T ). By construction, we have V (T )\{0 T } ⊆ V (T ). Moreover, suppression of vertices clearly preserves the -relation between all vertices x, y ∈ V (T ) \ {0 T }. Together with Claim 5, this implies τ T (x) < τ T (y) for all vertices x, y ∈ V (T ) \ {0 T } with x ≺ T y. For the single child ρ T of 0 T in T , we have τ T (ρ T ) ≤ τ S (ρ S ) + where equality holds if the root of T was not suppressed and thus is equal to ρ T . Moreover, τ T (0 T ) = τ S (0 S ) and τ S (0 S ) − τ S (ρ S ) ≥ 3 hold by construction. Taken together the latter two arguments imply that τ T (ρ T ) < τ T (0 T ). In particular, we obtain τ T (x) < τ T (y) for all vertices x, y ∈ V (T ) with x ≺ T y. Hence, τ T is a time map for T , which, moreover, satisfies τ T (x) = 0 for all x ∈ L(T ). To show that S = (T, S, σ, µ, τ T , τ S ) is a relaxed scenario, it remains to show that µ is timeconsistent with the time maps τ T and τ S . In case x ∈ L(T ) ⊂ V (T ), we have µ(x) = σ(x) ∈ L(S) ⊂ V (S) and thus τ T (x) = 0 = τ S (σ(x)) = τ S (µ(x)). For 0 T , we have τ T (0 T ) = τ S (0 S ) = τ S (µ(0 T )). The latter two arguments imply that all vertices x ∈ L(T ) ∪ {0 T } satisfy (C1) in the Def. 4. The remaining vertices of T are all vertices of T as well. In particular, they are all inner vertices that are mapped to some edge of S (cf. Lines 7 and 18). The latter two arguments together with Claim 5 imply that, for all vertices Therefore, every such vertex satisfies (C2) in Def. 4. It follows that the time consistency constraint (G2) is also satisfied, and thus S is a relaxed scenario.
Claim 7. Every vertex v ∈ V 0 (T ) was either created in Line 6 or in Line 15. In particular, it holds for all x, y ∈ L(T ) with lca T (x, y) = v: (1) If v was created in Line 6, then xy / ∈ E(G) and xy / ∈ E(G < (S)).
Furthermore, G is a cograph with cotree (T, t) where t(v) = 0 if v was created in Line 6 and t(v) = 1, otherwise.
Proof: Since T is phylogenetic, every vertex v ∈ V 0 (T ) is the last common ancestor of two leaves x, y ∈ L := L(T ). Let v ∈ V 0 (T ) be arbitrary and choose arbitrary leaves x, y ∈ L such that lca T (x, y) = v. Since v ∈ V 0 (T ), the leaves x and y must be distinct. Note that v / ∈ L(T ) ∪ {0 T }, and thus, v is also an inner vertex in T . Therefore, we have exactly the two cases (1) v = u T is created in Line 6, and (2) v = v T is created in Line 15. Similar as before, the case that v = w K is assigned in Line 21 is covered by Case (a), since, in this case, w K is created in a deeper recursion step. We consider the recursion step on L and u S , in which v was created. Clearly, it must hold that x, y ∈ L . Before we continue, set R := R(G[L ], σ |L ,L(S(u)) , C S (u S )) as in Line 13. Note, since S is a relaxed scenario, the graph (G < (S), σ) is well-defined. For Statement (1), suppose that v = u T was created in Line 6. Hence, we have the two cases (i) the vertex u S of S in this recursion step is a leaf, and (ii) u S is an inner vertex. In Case (i), we have L(S(u S )) = {u S }. Together with Claim 4 and σ(x), σ(y) ∈ σ(L ), this implies σ(x) = σ(x) = u S . By assumption, (G, σ) is properly colored. By Prop. 3 (G < (S), σ) must be properly colored as well. Hence, we conclude that xy / ∈ E(G) and xy / ∈ E(G < (S)), respectively. In Case (ii), u S is not a leaf. Therefore, lca T (x, y) = v = u T is only possible if x and y lie in distinct connected components of G[L ]. This immediately implies xy / ∈ E(G) Moreover, we have σ(x), σ(y) ∈ L(S(u S )) and thus lca S (σ(x), σ(y)) S u S . Since τ S is a time map for S, it follows that τ S (lca S (σ(x), σ(y))) ≤ τ S (u S ). Together with τ T (u T ) = τ S (u S ) + (cf. Line 7) and > 0, this implies τ S (lca S (σ(x), σ(y))) < τ T (v) = τ T (lca T (x, y)). Hence, xy / ∈ E(G < (S)). For Statement (2), suppose that v = v T was created in Line 15. Therefore, lca T (x, y) = v = v T is only possible if x and y lie in the same connected components of G[L ] but in distinct Rclasses. Now, we can apply Lemma 10 to conclude that xy ∈ E(G). Moreover, the fact that x and y lie in the same connected component of G[L ] but in distinct R-classes implies that σ(x) and σ(y) lie in distinct sets of C S (u S ). Hence, there are distinct v S , v S ∈ child S (u) such that σ(x) S v S and σ(y) S v S . In particular, lca S (σ(x), σ(y)) = u S . In Line 18, we assign τ T (lca T (x, y)) = τ T (v T ) = τ S (u S ) − . Together with > 0, the latter two arguments imply τ T (lca T (x, y)) < τ S (u S ) = τ S (lca S (σ(x), σ(y))). Therefore, we have xy ∈ E(G < (S)). By the latter arguments, the cotree (T, t) as defined above is well-defined and, for all v ∈ V 0 (T ), we have t(v) = 1 if and only if xy ∈ E(G) for all x, y ∈ L with lca T (x, y) = v. Hence, (T, t) is a cotree for G.
Proof: Since L(T ) = L, the two undirected graphs G < (S) and G have the same vertex set. By Claim 7, we have, for all distinct x, y ∈ L, either xy / ∈ E(G) and xy / ∈ E(G < (S)), or xy ∈ E(G) and xy ∈ E(G < (S)).
To see that Algorithm 1 runs in polynomial time, we first note that the function BuildGeneTree() operates in polynomial time. This is clear for the setup and the if part. The construction of R in the else part involves the computation of connected components and the evaluation of Def. 11, both of which can achieved in polynomial time. This is also true for the comparisons of color classes required to identify v * S and v S . Since the sets K in recursive calls of BuildGeneTree() form a partition of L , and the v S are children of u S in S and the depth of the recursion is bounded by O(|L(S)|), the total effort remains polynomial.
Theorem 3. A graph (G, σ) is an LDT graph if and only if it is a properly colored cograph and S(G, σ) is compatible.
Proof. By Lemma 6 and 8, if (G, σ) is an LDT graph then it is a propery colored cograph and S(G, σ) is compatible. Now suppose that (G, σ) is a properly colored cograph and S(G, σ) is compatible. Then, by Theorem 2, Algorithm 1 outputs a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) such that G < (S) = G. By definition, this in particular implies that (G, σ) is an LDT graph.
Corollary 2. LDT graphs can be recognized in polynomial time.
Corollary 3. The property of being an LDT graph is hereditary, that is, if (G, σ) is an LDT graph then each of its vertex induced sugraphs is an LDT graph.
Proof. Let (G = (V, E), σ) be an LDT graph. It suffices to show that (G − x, σ |V \{x} ) is an LDT graph, where G − x is obtained from G by removing x ∈ V and all its incident edges. By Prop. 2, G − x is a cograph that clearly remains properly colored. Moreover, every induced path on three vertices in G − x is also an induced path on three vertices in G. This implies that if xy|z ∈ S = S(G − x, σ |V \{x} ), then xy|z ∈ S(G, σ). Hence, S ⊆ S(G, σ). By Theorem 3, S(G, σ) is compatible. Hence, any tree that displays all triples in S(G, σ), in particular, displays all triples in S . Therefore, S is compatible. In summary, (G − x, σ |V \{x} ) is a properly colored cograph and S is compatible. By Theorem 3 it is an LDT graph.
The relaxed scenarios S explaining an LDT graph (G, σ) are far from being unique. In fact, we can choose from a large set of trees (S, τ S ) that is determined only by the triple set S(G, σ): Corollary 4. If (G, σ) is an LDT graph with coloring σ : L → M , then for all planted trees S on M that display S(G, σ) there is a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) that contains σ and S and that explains (G, σ).
Proof. If (G, σ) is an LDT graph, then the species tree S assigned in Line 1 in Algorithm 1 is an arbitrary tree on M displaying S(G, σ).
Corollary 5. If (G, σ) is an LDT graph, then there exists a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) explaining (G, σ) such that T displays the discriminating cotree T G of G.
Proof. Suppose that (G, σ) is an LDT graph. By Thm. 3, (G, σ) must be a properly colored cograph and S(G, σ) is comparable. Hence, Theorem 2 implies that Algorithm 1 constructs a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) explaining (G, σ). In particular, the tree T together with labeling t as specified in Claim 7 is a cotree for G. Since the unique discriminating cotree (T G ,t) of G is obtained from any other cotree by contraction of edges in T , the tree T must display T G .
Although, Cor. 5 implies that there is always a scenerio S where the tree T displays the discriminating cotree T G of G = G(S), this is not true for all relaxed scenarios S with G = G(S). Fig. 16 shows a relaxed scenario S = (T , S , σ, µ , τ T , τ S ) with G = G(S ) for which T does not display T G .
Cor. 5 enables us to relate connectedness of LDT graphs to properties of the relaxed scenarios by which it can be explained.
Proof. By contraposition, suppose first that there is a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) that explains (G, σ) such that τ T (ρ T ) ≥ τ S (lca S (σ(L))). Since |L(T )| = |L| > 1, the root ρ T is not a leaf. To show that G is disconnected we consider two distinct children v, w ∈ child(ρ T ) of the root and leaves x ∈ L(T (v)) and y ∈ L(T (w)) and verify that x and y cannot be adjacent in G. If σ(x) = σ(y), then xy / ∈ E since (G, σ) is properly colored (cf. Lemma 8). Hence, suppose that σ(x) = σ(y). By construction, lca T (x, y) = ρ T and thus, by assumption, τ T (lca T (x, y)) = τ T (ρ T ) ≥ τ S (lca S (σ(L))). Now lca S (σ(L)) S lca S (σ(x), σ(y)) implies that τ S (lca S (σ(L))) ≥ τ S (lca S (σ(x), σ(y))) and thus, τ T (lca T (x, y)) ≥ τ S (lca S (σ(x), σ(y))). Hence, xy / ∈ E. Consequently, for all distinct children v, w ∈ child(ρ T ), none of the vertices in L(T (v)) are adjacent to any of the vertices in L(T (w)) and thus, G is disconnected. Conversely, suppose that G is disconnected. We consider Alg. 1 with input (G, σ). By Thms. 2 and 3, the algorithm constructs a scenario S = (T, S, σ, µ, τ T , τ S ) that explains (G, σ). Consider the top-level recursion step on L and ρ S . Since G is disconnected, the vertex u T created in Line 6 of this step equals the root ρ T of the final tree T . To see this, assume first that ρ S is a leaf. Then, we attach the |L| > 1 elements in L as leaves to u T (cf. Line 10). Now assume that ρ S is not a leaf. Since G[L] = G has at least two components, we attach at least two vertices v T created in Line 15 to u T . Hence u T is not suppressed in Line 25 and thus ρ T = u T . By construction, therefore, we have τ T (ρ T ) = τ T (u T ) = τ S (u S ) + = τ S (ρ S ) + for some > 0. From σ(ρ S ) S lca S (σ(L)) and the definition of time maps, we obtain τ S (ρ S ) ≥ τ S (lca S (σ(L))). Therefore, we have τ T (ρ T ) ≥ τ S (lca S (σ(L))) + > τ S (lca S (σ(L))), which completes the proof. Therefore, we have shown so-far that if all relaxed scenarios S = (T, S, σ, µ, τ T , τ S ) that explain (G, σ) satisfy τ T (ρ T ) ≤ τ S (lca S (σ(L))), then (G, σ) must be connected. However, τ T (ρ T ) = τ S (lca S (σ(L))) cannot occur, since we can reuse the same arguments as in the beginning of this proof to show that, in this case, G is disconnected.

A.4 Least Resolved Trees for LDT graphs
As we have seen e.g. in Cor. 4, there are in general many trees S and T forming scenarios S that explain a given LDT graph (G, σ). This begs the question to what extent these trees are determined by "representatives". For S, we have seen that S always displays S(G, σ), suggesting to consider the role of S = Aho(S(G, σ)). This tree is least resolved in the sense that there is no scenario explaining the LDT graph (G, σ) with a tree S that is obtained from S by edge-contractions. The latter is due to the fact that any edge contraction in Aho(S(G, σ)) yields a tree S that does not display S(G, σ)) any more (Jansson et al, 2012). By Prop. 6, none of the scenarios containing S explain the LDT (G, σ).
In other words, T is least resolved for (G, σ) if no scenario with a gene tree T obtained from T by a series of edge contractions explains (G, σ). The examples in Fig. 3 show that there is not always a unique least resolved tree.
As outlined in the main part of this paper, the examples in Fig. 3 show that LDT graphs are in general not accompanied by unique least resolved trees and the example in Fig. 4 shows that the unique disciminating cotree T G of an LDT graph (G, σ) is not always "sufficiently resolved".

B.1 HGT-Labeled Trees and rs-Fitch Graphs
As alluded to in the introduction, the LDT graphs are intimately related with horizontal gene transfer. To formalize this connection we first define transfer edges. These will then be used to encode Walter Fitch's concept of xenologous gene pairs (Fitch, 2000;Darby et al, 2017) as a binary relation, and thus, the edge set of a graph.
Definition 13. Let S = (T, S, σ, µ, τ T , τ S ) be a relaxed scenario. An edge (u, v) in T is a transfer edge if µ(u) and µ(v) are incomparable in S. The HGT-labeling of T in S is the edge labeling λ S : E(T ) → {0, 1} with λ(e) = 1 iff e is a transfer edge.
The vertex u in T thus corresponds to an HGT event, with v denoting the subsequent event, which now takes place in the "recipient" branch of the species tree. Note that λ S is completely determined by S. In general, for a given a gene tree T , HGT events correspond to a labeling or coloring of the edges of T .
Remark 4. Fitch graphs as defined here have been termed undirected Fitch graphs , in contrast to the notion of the directed Fitch graphs of 0/1-edge-labeled trees studied e.g. in Hellmuth and Seemann, 2019).
1. G is the Fitch graph of a 0/1-edge-labeled tree.
2. G is a complete multipartite graph.
3. G does not contain K 2 + K 1 as an induced subgraph.
A natural connection between LDT graphs and complete multipartite graphs is suggested by the definition of triple sets T(G), since each forbidden induced subgraph K 2 + K 1 of a complete multipartite graphs corresponds to a triple in an LDT graph. More precisely, we have: Proof. The equivalence between the statements can be seen by observing that G is a complete multipartite graph if and only if G does not contain an induced K 2 + K 1 (cf. Prop. 5). By definition of T(G), this is the case if and only if T(G) = ∅.
Definition 15 (rs-Fitch graph). Let S = (T, S, σ, µ, τ T , τ S ) be a relaxed scenario with HGT-labeling λ S . We call the vertex colored graph ( (S), σ) := ( (T, λ S ), σ) the Fitch graph of the scenario S. A vertex colored graph (G, σ) is a relaxed scenario Fitch graph ( rs-Fitch graph) if there is a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) with coloring σ such that G = (S). Fig. 5 shows that rs-Fitch graphs are not necessarily properly colored. A subtle difficulty arises from the fact that Fitch graphs of 0/1-edge-labeled trees are defined without a reference to the vertex coloring σ, while the rs-Fitch graph is vertex colored.
Observation 1. If (G, σ) is an rs-Fitch graph then G is a complete multipartite graph.
The "converse" of Obs. 1 is not true in general, as we shall see in Thm. 6 below. If, however, the coloring σ can be chosen arbitrarily, then every complete multipartite graph G can be turned into an rs-Fitch graph (G, σ) as shown in Prop. 6. Proposition 6. If G is a complete multipartite graph, then there exists a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) such that (G, σ) is an rs-Fitch graph.
Proof. Let G be a complete multipartite graph and set L := V (G) and R := E(G). If R = ∅, then the relaxed scenario S constructed in the proof of Lemma 4 shows that E(G) = E( (S)) = ∅. Hence, we assume that R = ∅ and explicitly construct a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) such that (G, σ) is an rs-Fitch graph.
We start by specifying the coloring σ : L → M . Since G is a complete multipartite graph it is determined by its independent sets I 1 , . . . , I k , which form a partition of L. We set M := {1, 2, . . . , k} and color every x ∈ I j with color σ(x) = j, 1 ≤ j ≤ k. By construction, (G, σ) is properly colored, and σ(x) = σ(y) whenever xy / ∈ R, i.e., whenever x and y lie in the same independent set. Therefore, we have S(G, σ) = ∅. Let S be the planted star tree with leaf set L(S) = {1, . . . , k} = M and child S (ρ S ) = M . Since R = ∅, we have k ≥ 2, and thus, ρ S has at least two children and is, therefore, phylogenetic. We choose the time map τ S by putting τ S (0 S ) = 2, τ S (ρ S ) = 1 and τ S (x) = 0 for all x ∈ L(S).
Finally, we construct the planted phylogenetic tree T with planted root 0 T and root ρ T as follows: Vertex ρ T has k children u 1 , . . . , u k . If I j = {x j } consists of a single element, then we put u j := x j as a leaf or T , and otherwise, vertex u j has exactly |I j | children where child(u j ) = I j . Now label, for all i ∈ {2, . . . , k}, the edge (ρ T , u i ) with "1", and all other edges with "0". Since k ≥ 2, the tree T is also phylogenetic by construction.
We specify the time map τ T and the reconciliation map µ by defining, for every v ∈ V (T ),  With the help of Fig. 17, it is now easy to verify that (i) τ T is a time map for T , (ii) the reconciliation map µ is time consistent, and (iii) λ S = λ. In summary, S = (T, S, σ, µ, τ T , τ S ) is a relaxed scenario, and (G, σ) = ( (S), σ) is an rs-Fitch graph.
Although every complete multipartite graph can be colored in such a way that it becomes an rs-Fitch graph (cf. Prop. 6), there are colored, complete multipartite graphs (G, σ) that are not rs-Fitch graphs, i.e., that do not derive from a relaxed scenario (cf. Thm. 6). We summarize this discussion in the following Observation 2. There are 0/1-edge labeled trees (T, λ) and colorings σ : L(T ) → M such that there is no relaxed scenario S = (T, S, σ, µ, τ T , τ S ) with λ = λ S .
A subtle -but important -observation is that trees (T, λ) with coloring σ for which Obs. 2 applies may still encode an rs-Fitch graph ( (T, λ), σ), see Example 1 and Fig. 6. The latter is due to the fact that (T, λ) = (T , λ ) may be possible for a different tree (T , λ ) for which there is a relaxed scenario S = (T , S, σ, µ, τ T , τ S ) with λ = λ S . In this case, ( (T, λ), σ) = ( (S ), σ) is an rs-Fitch graph. We shall briefly return to these issues in the discussion section 8.

B.2 LDT Graphs and rs-Fitch Graphs
We proceed to investigate to what extent an LDT graph provides information about an rs-Fitch graph. As we shall see in Thm. 5 there is indeed a close connection between rs-Fitch graphs and LDT graphs. We start with a useful relation between the edges of rs-Fitch graphs and the reconciliation maps µ of their scenarios.
Proof. Assume first that ab / ∈ E( (S)) and denote by P xy the unique path in T that connects the two vertices x and y. Clearly, u := lca T (a, b) is contained in P ab , and this path P ab can be subdivided into the two paths P u,a and P u,b that have only vertex u in common. Since ab / ∈ E( (S)), none of the edges (v, w) along the path P ab in T is a transfer edge, and thus, the images µ(v) and µ(w) are comparable in S. This implies that the images of any two vertices along the path P u,a as well as the the images of any two vertices along P u,b are comparable. In particular, therefore, µ(u) is comparable with both µ(a) = σ(a) =: A and µ(b) = σ(b) =: B, where we may have A = B. Together with the fact that A and B are leaves in S, this implies that µ(u) is an ancestor of A and B. Since lca S (A, B) is the "last" vertex that is an ancestor of both A and B, we have lca S (A, B) S µ(u).
The next result shows that a subset of transfer edges can be inferred immediately from LDT graphs: Theorem 4. If (G, σ) is an LDT graph, then G ⊆ (S) for all relaxed scenarios S that explain (G, σ).
Since we only have that xy is an edge in (S) if the path connecting x and y in the tree T of S contains a transfer edge, Lemma 4 immediately implies Corollary 6. For every relaxed scenario S = (T, S, σ, µ, τ T , τ S ) without transfer edges, it holds that E(G < (S)) = ∅.
Thm. 4 provides the formal justification for indirect phylogenetic approaches to HGT inference that are based on the work of Lawrence and Hartl (1992), Clarke et al (2002), and Novichkov et al (2004) by showing that (x, y) ∈ E(G < (S)) can be explained only by HGT, irrespective of how complex the true biological scenario might have been. However, it does not cover all HGT events. Fig. 7 shows that there are relaxed scenarios S for which G < (S) = (S) even though (S) is properly colored. Moreover, it is possible that an rs-Fitch graph (G, σ) contains edges xy ∈ E(G) with σ(x) = σ(y). In particular, therefore, an rs-Fitch graph is not always an LDT graph.
It is natural, therefore, to ask whether for every properly colored Fitch graph there is a relaxed scenario S such that G < (S) = (S). An affirmative answer is provided by Theorem 5. The following statements are equivalent.

(G, σ) is properly colored and an rs-Fitch graph.
In particular, for every properly colored complete multipartite graph (G, σ) the triple set S(G, σ) is compatible. Proof.
(1) implies (2). We assume that (G, σ) is a properly colored multipartite graph and set L := V (G) and E := E(G). If E = ∅, then the relaxed scenario S constructed in the proof of Lemma 4 satisfies G = G < (S) = (S), i.e., the graphs are edgeless. Hence, we assume that E = ∅ and explicitly construct a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) with coloring σ such that G = G < (S) = (S). The graph (G, σ) is properly colored and complete multipartite by assumption. Let I 1 , . . . , I k denote the independent sets of G. Since E = ∅, we have k > 1. Since all x ∈ I i are adjacent to all y ∈ I j , i = j and (G, σ) is properly colored, it must hold that σ(I i ) ∩ σ(I j ) = ∅. For a fixed i let v 1 i , . . . v |Ii| i denote the elements in I i . We first start with the construction of the species tree S. First we add a planted root 0 S with child ρ S . Vertex ρ S has children w 1 , . . . , w k where each w j corresponds to one I j . Note, σ : L → M may not be surjective, in which case we would add one additional child x to ρ S for each color x ∈ M \ σ(L).
If |σ(I j )| = 1, then we identify the single color x ∈ σ(I j ) with w j . Otherwise, i.e., if |σ(I j )| > 1, vertex w j has as children the set child S (w j ) = σ(I j ) which are leaves in S. See Fig. 18 for an illustrative example. Now we can choose the time map τ S for S such τ S (0 S ) = 3, τ S (ρ S ) = 2, τ S (x) = 0 for all x ∈ L(S) and τ S (x) = 1 for all x ∈ V 0 (S) \ {ρ S }.
We now construct T as follows. The tree T has planted root 0 T with child ρ T . Vertex ρ T has k children u 1 , . . . , u k where each u j corresponds to one I j . Vertex u j is a leaf if |I j | = 1, and, otherwise, has exactly |I j | children that are uniquely identified with the elements in I j .
We now define the time map τ T and reconciliation map µ for v ∈ V (T ): With the help of Fig. 18 it is now easy to verify that (i) τ T is a time map for T , and that (ii) the reconciliation map µ is time consistent. In summary the constructed S = (T, S, σ, µ, τ T , τ S ) is a relaxed scenario.
We continue with showing that E = E(G < (S)) = E( (S)). To this end, let a, b ∈ L be two vertices. Note, ab ∈ E if and only if a ∈ I i and b ∈ I j for distinct i, j ∈ [k] := {1, 2, . . . , k}. First assume that ab ∈ E and thus, a ∈ I i and b ∈ I j for distinct i, j ∈ [k]. By construction, a T u i = u j T b with lca T (u i , u j ) = ρ T . In particular, we have par T (u i ) = par T (u j ) = ρ T and the path from a to b contains the two edges (ρ T , u i ) and (ρ T , u j ). By construction, we have µ(ρ T ) = (ρ S , w 1 ), and for all 1 ≤ l ≤ k, µ(u l ) = σ(u l ) = w l if u l is a leaf, and µ(u l ) = (ρ S , w l ) otherwise. These two arguments imply that µ(ρ T ) and µ(u l ) are comparable if and only if u l = u 1 . Now, since u i = u j , they cannot both be equal to u 1 and thus, at least one of the edges (ρ T , u i ) and (ρ T , u j ) is a transfer edge. Hence, ab ∈ E( (S)). By construction, ab ∈ E implies lca T (a, b) = ρ T . Hence, we have µ(lca T (a, b)) = µ(ρ T ) = (ρ S , w 1 ) ≺ S ρ S = lca S (σ(a), σ(b)), and thus ab ∈ E(G < (S)). Now assume that ab / ∈ E, and thus, a, b ∈ I i for some i ∈ [k]. It clearly suffices to consider the case a = b, and thus, a, b ∈ child T (u i ) and u i / ∈ L(T ) holds by construction. In particular, the path between a and b only consists of the edges (u i , a) and (u i , b). Moreover, we have σ(a), σ(b) S w i and µ(u i ) = (ρ S , w i ). Hence, none of the edges (u i , a) and (u i , b) is a transfer edge, and ab / ∈ E( (S)). We have µ(lca T (a, b)) = (ρ S , w i ) T w i T lca S (σ(a), σ(b)), and thus τ T (lca T (a, b)) > τ S (lca S (σ(a), σ(b))). Hence, ab / ∈ E(G < (S)). In summary, ab ∈ E if and only if ab ∈ E( (S)) if and only if ab ∈ E(G < (S)), and consequently, G = G < (S) = (S).
Statement (3), in particular, implies that every properly colored complete multipartite (G, σ) is an LDT-graph and, thus, there is a relaxed scenario S such that G = G < (S). Now, we can apply Lemma 6 to conclude that S(G, σ) is compatible, which completes the proof.
Corollary 7. A colored graph (G, σ) is an LDT graph and an rs-Fitch graph if and only if (G, σ) is a properly colored complete multipartite graph (and thus, a properly colored Fitch graph for some 0/1-edge-labeled tree).
Proof. If (G, σ) is an rs-Fitch graph then, by Obs. 1, G is a complete multipartite graph. Moreover, since (G, σ) is an LDT graph, (G, σ) is properly colored (cf. Prop. 3). Conversely, if (G, σ) is a properly colored complete multipartite graph it is, by Thm. 5(2), an rs-Fitch graph and an LDT graph. Now the equivalence between Statements (1) and (3) in Thm. 5 shows that (G, σ) is an LDT graph Corollary 8. Let (G, σ) be a vertex-colored graph. If T(G) = ∅ and S(G, σ) is incompatible, then G is a complete multipartite graph (and thus a Fitch graph for some 0/1-edge-labeled tree), but σ is not a proper vertex coloring of G.
Proof. By definition, if T(G) = ∅, then G cannot contain an induced K 2 + K 1 . By Prop. 5, G is a Fitch graph. Contraposition of the last statement in Thm. 5 and G being a Fitch graph for some (T, λ) implies that σ is not a proper vertex coloring of G.
As outlined in the main part of this paper, LDT graphs are sufficient to describe replacing HGT. They fail, however, to describe additive HGT in full detail.

B.3 rs-Fitch Graphs with General Colorings
In scenarios with additive HGT, the rs-Fitch graph is no longer properly colored and no-longer coincides with the LDT graph. Since not every vertex-colored complete multipartite graphs (G, σ) is an rs-Fitch graph (cf. Thm. 6), we ask whether an LDT graph (G, σ) that is not itself already an rs-Fitch graph imposes constraints on the rs-Fitch graphs ( (S), σ) that derive from scenarios S that explain (G, σ). As a first step towards this goal, we aim to characterize rs-Fitch graphs, i.e., to understand the conditions imposed by the existence of an underlying scenario S on the compatibility of the collection of independent sets I of G and the coloring σ. As we shall see, these conditions can be explained in terms of an auxiliary graph that we introduce in a very general setting: Definition 16. Let L be a set, σ : L → M a map and I = {I 1 , . . . , I k } a set of subsets of L. Then the graph A (σ, I) has vertex set M and edges xy if and only if x = y and x, y ∈ σ(I ) for some I ∈ I. We define an edge labeling : E(A ) → 2 I such that (e) := {I ∈ I | ∃x, y ∈ I s.t. σ(x)σ(y) = e}.
By construction A (σ, I ) is a subgraph of A (σ, I) whenever I ⊆ I. The labeling of an edge e records the sets I ∈ I that imply the presence of the edge.
Theorem 6. A graph (G, σ) is an rs-Fitch graph if and only if (i) it is complete multipartite with independent sets I = {I 1 , . . . , I k }, and (ii) if k > 1, there is an independent set I ∈ I such that A (σ, I \ {I }) is disconnected.
Proof. Let G = (L, E) be a graph with coloring σ : L → M . Suppose first that G satisfies (i) and (ii). To show that (G, σ) is an rs-Fitch graph, we will construct a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) such that G = (S). If k = 1, or equivalently E = ∅, then the relaxed scenario S constructed in the proof of Lemma 4 satisfies G = (S), i.e., both graphs are edgeless. Now assume that k > 1 and thus, E = ∅. Hence, we can choose an independent set I ∈ I such that A := A (σ, I \ {I }) is disconnected. Note that I \ {I } is non-empty since k > 1. Moreover, since A is a disconnected graph on the color set M , there is a connected component C of A such that (M \ C) ∩ σ(I ) = ∅. Hence M 1 := M \ C and M 2 := C form a non-trivial bipartition of M .
We continue by showing that every I ∈ I \ {I } satisfies either σ(I) ⊆ M 1 or σ(I) ⊆ M 2 . To see this, assume, for contradiction, that there are colors A ∈ σ(I) ∩ M 1 and B ∈ σ(I) ∩ M 2 for some I ∈ I \ {I }. Hence, we have AB ∈ E(A ), and thus A and B must lie in the connected component C; a contradiction. Therefore, we can partition I \ {I } into I 1 := {I ∈ I \ {I } | σ(I) ⊆ M 1 } and I 2 := {I ∈ I \ {I } | σ(I) ⊆ M 2 }. Note that one of the sets I 1 and I 2 , but not both of them, may be empty. This may be the case, for instance, if σ is not surjective. Now, we construct a relaxed scenario S = (T, S, σ, µ, τ T , τ S ) with coloring σ such that G = (S). We first define the species tree S as the planted tree where ρ S (i.e. the single child of 0 S ) hast two children w 1 and w 2 . If |M 1 | = 1, we identify w 1 with the single element in M 1 , and otherwise, we set child S (w 1 ) = L(S(w 1 )) := M 1 . We proceed analogously for w 2 and M 2 . Thus, S is phylogenetic by construction. We choose the time map τ S by putting τ S (0 S ) = 2, τ S (ρ S ) = 1, τ S (w 1 ) = τ S (w 2 ) = 0.5 and τ S (x) = 0 for all x ∈ L(S). This completes the construction of S and τ S .
We proceed with the construction of the gene tree T , its time map τ T and the reconciliation map µ. This tree T has leaf set L, planted root 0 T , and root ρ T . We set µ(0 T ) = 0 S and τ T (0 T ) = τ S (0 S ) = 2, and moreover µ(x) = σ(x) and τ T (x) = 0 for all x ∈ L.
For each I j ∈ I \{I }, we add a vertex u j . We will later specify how these vertices are connected (via paths) to ρ T . If |I j | = 1, u j becomes a leaf of T that is identified with the unique element in I j . Otherwise, we add exactly |I j | children to u j , each of which is identified with one of the elements in I j . If u j is a leaf, we already defined µ(u j ) = σ(u j ) and τ T (u j ) = 0.
Otherwise, we set τ T (u j ) = 0.6 and µ(u j ) = (ρ S , w 1 ) if I j ∈ I 1 and µ(u j ) = (ρ S , w 2 ) if I j ∈ I 2 . Recall that M 1 ∩ σ(I ) = ∅. However, both M 2 ∩ σ(I ) = ∅ and M 2 ∩ σ(I ) = ∅ are possible. The latter case appears e.g. whenever A (σ, I) was already disconnected. To connect the vertices u j to ρ T , we distinguish the three mutually exclusive cases: Figure 19: Illustration of the scenario constructed in the if -direction of the proof of Thm 6. For Cases (a) and (c), only the situation in which a vertex u and u , resp., is necessary is shown. Otherwise, the single element in I , I 1 or I 2 would be a child of the root ρT . Moreover, the vertices uj are drawn under the assumption that |Ij| > 1. Otherwise, there are identified with the single leaf in Ij.
We set µ(ρ T ) = (ρ S , w 2 ) and τ T (ρ T ) = 0.9. We attach all u j that correspond to elements I j ∈ I 1 as children of ρ T . If |I | > 1 or I 2 = ∅, we create a vertex u to which all elements in I and all u j such that I j ∈ I 2 are attached as children, attach u as a child of ρ T , and set µ(u ) = (ρ S , w 1 ) and τ T (u ) = 0.75. Otherwise, we simply attach the single element x in I as a child of ρ T . Clearly, the so constructed tree T is phylogenetic. Note that the edges (ρ T , u j ) with I j ∈ I 1 as well as the edges (u , u j ) with I j ∈ I 2 are transfer edges. Together with (ρ T , u ) or (ρ T , x), respectively, these are the only transfer edges. Case (b): M 2 ∩ σ(I ) = ∅ and I 1 = ∅. By the arguments above, the latter implies I 2 = ∅. Hence, we can set µ(ρ T ) = (ρ S , w 1 ) and τ T (ρ T ) = 0.9 and attach all elements of I as well as the vertices u j corresponding to the independent sets I j ∈ I 2 = I \ {I } as children of ρ T . Since |I | ≥ 1 and I 2 ≥ 1, the tree T obtained in this manner is again phylogenetic. Moreover, note that the transfer edges are exactly the edges (ρ T , u j ). Case (c): M 2 ∩ σ(I ) = ∅. In this case, the sets I 1 := {x ∈ I | σ(x) ∈ M 1 } and I 2 := {x ∈ I | σ(x) ∈ M 2 } must be non-empty. We set µ(ρ T ) = (0 T , ρ T ) and τ T (ρ T ) = 1.5. If |I 1 | > 1 or I 2 = ∅, we create a vertex u to which all elements in I 1 and all u j such that I j ∈ I 2 are attached as children, and set µ(u ) = (ρ S , w 1 ) and τ T (u ) = 0.75. Otherwise, we simply attach the single element in I 1 as a child of ρ T . For the "other side", we proceed analogously: If |I 2 | > 1 or I 1 = ∅, we create a vertex u to which all elements in I 2 and all u j such that I j ∈ I 1 are attached as children, and set µ(u ) = (ρ S , w 2 ) and τ T (u ) = 0.75. Otherwise, we simply attach the single element in I 2 as a child of ρ T . By construction, the so constructed tree is again phylogenetic. Moreover, the transfer edges are exactly the edges (u , u j ) and (u , u j ). Using Fig. 19, one can easily verify that, in all three Cases (a)-(c), the reconciliation map µ is time consistent with τ T and τ S . Thus, S is a relaxed scenario. Moreover, Fig. 19 together with the fact that σ(I) ⊆ M 1 holds for all I ∈ I 1 , and σ(I) ⊆ M 2 holds for all I ∈ I 2 , shows that G = (S) in all three cases. Hence, (G, σ) is an rs-Fitch graph.
For the only-if -direction, assume that (G = (V, E), σ) is an rs-Fitch graph. Hence, there exists a scenario S = (T, S, σ, µ, τ T , τ S ) such that G = (S). By Obs. 1 and Prop. 5, (G, σ) is a complete multipartite graph that is determined by its set of independent sets I = {I 1 , . . . , I k }. Hence, Condition (i) is satisfied. Now assume, for contradiction, that Condition (ii) is violated. Thus k ≥ 2 and there is no independent set I ∈ C such that A (σ, I \ {I }) is disconnected. If |M | = 1, then the species tree S only consists of the planted root 0 S and the root ρ S , which in this case is identified with the single element in M . Clearly, all vertices and edges are comparable in such a tree S, and hence, there is no transfer edges in S, implying E = ∅ and thus |I| = 1; a contradiction to k ≥ 2.
Thus we have |M | ≥ 2 and the root ρ S of the species tree S has at least two children. Since A (σ, I \ {I }) is connected for every I ∈ C, the graph A (σ, I) is also connected. Since each color appears at most once as a leaf of S, σ(L(S(v 1 ))) ∩ σ(L(S(v 2 ))) = ∅ holds for any two distinct children v 1 , v 2 ∈ child S (ρ S ). These three assertions, together with the definition of the auxiliary graph A (σ, I), imply that there are two distinct colors A, B ∈ M such that AB is an edge in A (σ, I), A S v 1 and B ≺ S v 2 for distinct children v 1 , v 2 ∈ child S (ρ S ). By definition of A (σ, I) there is an independent set I ∈ I containing a vertex a ∈ I with σ(a) = A and a vertex b ∈ I with σ(b) = B. Since a and b lie in the same independent set, we have ab / ∈ E. By Lemma 13, µ(lca T (a, b)) S lca S (A, B) = ρ S . Since, by assumption, A (σ, I \ {I }) is also connected, we find two distinct colors C and D (not necessarily distinct from A and B) such that CD is an edge in A (σ, I), C S v 3 and D ≺ S v 4 for distinct children v 3 , v 4 ∈ child S (ρ S ) (but not necessarily distinct from v 1 and v 2 ), and in particular, an independent set I ∈ I \ {I } containing a vertex c ∈ I with σ(c) = C and a vertex d ∈ I with σ(d) = D. By construction, I = I , and thus, all edges between I and I exist in G, in particular the edges ac, ad, bc, bd. Since c, d ∈ I , we have cd / ∈ E and thus, by Lemma 13, µ(lca T (c, d)) S lca S (C, D) = ρ S . We now consider the unique path P in T that connects lca T (a, b) and lca T (c, d). Since µ is time consistent and µ(lca T (a, b)), µ(lca T (c, d)) S ρ S , we conclude that, for every edge uv along this path P , we have µ(u), µ(v) S ρ S and thus µ(u), µ(v) ∈ {ρ S , (0 S , ρ S )}. But then, µ(u) and µ(v) are comparable in S. Therefore, P does not contain any transfer edge. Since ab / ∈ E, the path connecting a and lca T (a, b) does not contain any transfer edges. Likewise, cd / ∈ E implies that the path connecting c and lca T (c, d) does not contain any transfer edges. Thus, the path connecting a and c also does not contain any transfer edge, which implies that ac / ∈ E( (S)) = E; a contradiction since a and c belong to two distinct indepdendent sets.
Hence, we conclude that for k > 1 there exists an independent set I ∈ C such that A (σ, I \{I }) is disconnected.
Corollary 9. rs-Fitch graphs can be recognized in polynomial time.
Proof. Every rs-Fitch graph (G, σ) must be complete multipartite, which can be verified in polynomial time. In this case, the set of independent sets I = {I 1 , . . . , I k } of G can also be determined and the graph A (σ, I) can be constructed in polynomial time. Finally, we need to find an independent set I ∈ I, such that A (σ, I \ {I }) is disconnected. Clearly, checking whether A (σ, I \ {I }) is disconnected can be done in polynomial time and since there are at most |V (G)| independent sets in I, finding an independent set I such that A (σ, I \ {I }) is disconnected (if one exists) can be done in polynomial time as well.
Corollary 10. Let (G, σ) be a complete multipartite graph with coloring σ : V (G) → M and set of independent sets I. Then, (G, σ) is an rs-Fitch graph if and only if A (σ, I) is disconnected or there is a cut Q ⊆ E(A (σ, I)) such that all edges e ∈ Q have the same label (e) = {I} for some I ∈ I.
Proof. If A (σ, I) is disconnected, then A (σ, I \ {I}) remains disconnected for all I ∈ I and, by Theorem 6, (G, σ) is an rs-Fitch graph.
If there is a cut Q ⊆ E(A (σ, I)) such that all edges e ∈ Q have the same label (e) = {I} for some I ∈ I, then, by definition, E(A (σ, I \ {I})) ⊆ E := E(A (σ, I)) \ Q. Since Q is a cut in A (σ, I), the resulting graph A = (M, E ) is disconnected. By the latter arguments, A (σ, I \ {I}) is a subgraph of A , and thus, disconnected as well. By Theorem 6, (G, σ) is an rs-Fitch graph.
Conversely, if (G, σ) is an rs-Fitch graph, then Theorem 6 implies that A (σ, I \ {I}) is disconnected for some I ∈ I. If A (σ, I) was already disconnected, then there is nothing to show. Hence assume that A (σ, I) = (M, E) is connected and let A (σ, I \ {I}) = (M, E ). Moreover, let F ⊆ E be the subset of edges e ∈ E with I ∈ (e). Note, F contains all edges of E that have potentially been removed from E to obtain E . However, all edges e = xy in F with | (e)| > 1 must remain in A (σ, I \ {I}), since there is another independent set I ∈ (e) \ {I} such that x, y ∈ σ(I ). Hence, only those edges e in F for which | (e)| = 1 are removed from E. Hence, there is a cut Q ⊆ F ⊆ E such that all edges e ∈ Q have the same label (e) = {I} for some I ∈ I.
Corollary 11. If (G, σ) with coloring σ : V (G) → M is an rs-Fitch graph then there are no two disjoint independent sets I and I of G with σ(I) = σ(I ) = M . Now let (T, λ) be such that Conditions (a) and (b) are satisfied. First observe that none of the outer edges can be contracted without changing L(T ). Now let e = (u, v) be an inner edge. By Condition (a), e is a 1-edge. Moreover, by Condition (b), vertex u and v are both incident to at least two relevantly-labeled outer 0-edges. Hence, there are outer 0-edges (u, x), (u, x ), (v, y), (v, y ) with pairwise distinct leaves x, x , y, y in T . Since (u, v) is a 1-edge, we have xy, xy , x y, x y ∈ E( (T, λ)). Moreover, we have xx , yy / ∈ E( (T, λ)). Now consider the tree (T /e , λ ) with an arbitrary labeling λ and denote by w the vertex obtained by contraction of the inner edge (u, v). In this tree, x, x , y, y all have the same parent w. If λ ((w, x)) = 1 or λ ((w, y)) = 1, we have xx ∈ (T /e , λ ) or yy ∈ E( (T /e , λ )), respectively. If λ ((w, x)) = 0 and λ ((w, y)) = 0, we have xy / ∈ E( (T /e , λ )). Hence, it holds (T /e , λ ) = (T, λ) in both cases. Since the inner edge e and λ were chosen arbitrarily, we can apply Lemma 17 to conclude that (T, λ) is Fitch-leastresolved.
As a consequence of Thm. 7, Fitch-least-resolved trees can be constructed in polynomial time.
To be more precise, if a Fitch graph G contains only independent sets of size one (except possibly for one), we can construct a star tree T with edge labeling λ as specified in the proof of Thm. 7 to obtain the 0/1-edge labeled tree (T, λ) that is Fitch-least-resolved w.r.t. G. This construction can be done in O(|V (G)|) time. Now, assume that G has at least two independent sets of size at least two. Let I be the set of independent sets of G and I 1 , . . . , I k ∈ I, k ≥ 2 be all independent sets of size at least two. We now construct a tree (T, λ) with root ρ T as follows: First we add k vertices v 1 = ρ T and v 2 , . . . , v k , and add inner edges e i = (v i , v i+1 ) with label λ(e i ) = 1, 1 ≤ i ≤ k − 1. Each vertex v i gets as children the leaves in I i , 1 ≤ i ≤ k and all these additional outer edges obtain label "0". Finally, all elements in the remaining independent sets I \ {I 1 , . . . , I k } are of size one and are connected as leaves via outer 1-edges to the root v 1 = ρ T . It is an easy exercise to verify that T is a phylogenetic tree and that (T, λ) = G. In particular, Thm. 7 implies that (T, λ) is Fitch-least-resolved w.r.t. G. This construction can be done in O(|V (G)|) time. We summarize this discussion as Proposition 7. For a given Fitch graph G, a Fitch-least-resolved tree can be constructed in O(|V (G)|) time.
Fitch-least-resolved trees, however, are only of very limited use for the construction of relaxed scenarios S = (T, S, σ, µ, τ T , τ S ) from an underlying Fitch graph. In fact, even though (G, σ) is an rs-Fitch graph, Example 3 shows that it is possible that there is no relaxed scenario S = (T, S, σ, µ, τ T , τ S ) with HGT-labeling λ S such that (T, λ) = (T, λ S ) for any of its Fitch-least-resolved trees (T, λ).
Fitch-least-resolved trees for (G, σ) must contain an inner 1-edge, since G has two independent sets of size two and by Thm. 7. Thus, it is easy to verify that (T 1 , λ 1 ) and (T 2 , λ 2 ) are the only two Fitch-least-resolved trees for (G, σ).
By Lemma 13, we obtain lca S (A, B) S µ(lca Ti (a, b)) and lca S (B, C) S µ(lca Ti (b , c)), i ∈ {1, 2}, for both Fitch-least-resolved trees. However, for all of the possible species trees on three leaves A, B, C, this implies that the images µ(lca Ti (a, b)) and µ(lca Ti (b , c)) are the single inner edge or the edge (0 T , ρ T ) in S. Therefore, µ(lca Ti (a, b)) and µ(lca Ti (b , c)) are always comparable in S. Hence, for all possible relaxed scenarios S, we have λ S (e) = 0 for the single inner edge e, whereas λ i (e) = 1 in T i , i ∈ {1, 2}. This implies that there is no relaxed scenario S with (T i , λ i ) = (T i , λ S ), i ∈ {1, 2}.

C Editing Cographs to Complete Multipartite Graphs
Lemma 18. There is a linear-time algorithm to solve Problem 1 for every cograph G.
Proof. Instead of inserting in the cograph G the minimum number of edges necessary to reach a complete multipartite graph, we consider the equivalent problem of deleting a minimal set Q of edges from its complement G, which is also a cograph, to obtain the complement of a complete multipartite graph, i.e., the disjoint union of complete graphs. This problem is known as the Cluster Deletion problem (Shamir et al, 2004), which is known to have an polynomial-time solution for cographs (Gao et al, 2013): A greedy maximum clique partition of G is obtained by recursively removing a maximum clique K from G, see also (Dessmark et al, 2007). For cographs, the greedy maximum clique partitions are the solutions of the Cluster Deletion problem (Gao et al, 2013, Thm. 1). The Maximum Clique problem on cographs can be solved in linear time using the co-tree of G (Corneil et al, 1981a), which can also be obtained in linear time (Corneil et al, 1981a).
An efficient algorithm to solve the Cluster Deletion problem for cographs can be devised by making use of the recursive construction of a cograph along its discriminating cotree (T, t). Writing for the join of graphs, we have G = G[ρ T ] for Denote by P(u) the optimal clique partition of the cograph implied by the subtree T (u) of the discriminating cotree (T, t). We think of P(u) := [Q 1 (u), Q 2 (u), . . . ] as an ordered list, such that |Q i (u)| ≥ |Q j (u)| if i < j. It will be convenient to assume that the list contains an arbitary number of empty sets acting as an identity element for the join and disjoint union operation. With this convention, the optimal clique partitions P(u) satisfy the recursion: In the first case, where t(u) = 0, we assume that the union operation to obtain P(u) = [Q 1 (u), Q 2 (u), . . . ] maintains the property |Q i (u)| ≥ |Q j (u)| if i < j. In an implementation, this can e.g. be achieved using k-way merging where k = | child(u)|. To see that the recursion is correct, it suffices to recall that the greedy clique partition is optimal for cographs as input (Gao et al, 2013) and to observe the following simple properties of cliques in cographs (Corneil et al, 1981a): (i) a largest clique in a disjoint union of graphs is also a largest clique in any of its components. The optimal clique partition of a disjoint union of graphs is, therefore, the union of the optimal clique partitions of the constitutent connected components. (ii) For a join of two or more graphs G i , each maximum size clique Q is the join of a maximum size clique of each constituent. The next largest clique disjoint from Q = i Q i is, thus, the join of a largest cliques disjoint from Q i in each constituent graph G i . Thus a greedy clique partition of G is obtained by size ordering the clique partitions of G i and joining the k-largest cliques from each.