 Research
 Open access
 Published:
Predicting horizontal gene transfers with perfect transfer networks
Algorithms for Molecular Biology volume 19, Article number: 6 (2024)
Abstract
Background
Horizontal gene transfer inference approaches are usually based on gene sequences: parametric methods search for patterns that deviate from a particular genomic signature, while phylogenetic methods use sequences to reconstruct the gene and species trees. However, it is wellknown that sequences have difficulty identifying ancient transfers since mutations have enough time to erase all evidence of such events. In this work, we ask whether characterbased methods can predict gene transfers. Their advantage over sequences is that homologous genes can have low DNA similarity, but still have retained enough important common motifs that allow them to have common character traits, for instance the same functional or expression profile. A phylogeny that has two separate clades that acquired the same character independently might indicate the presence of a transfer even in the absence of sequence similarity.
Our contributions
We introduce perfect transfer networks, which are phylogenetic networks that can explain the character diversity of a set of taxa under the assumption that characters have unique births, and that once a character is gained it is rarely lost. Examples of such traits include transposable elements, biochemical markers and emergence of organelles, just to name a few. We study the differences between our model and two similar models: perfect phylogenetic networks and ancestral recombination networks. Our goals are to initiate a study on the structural and algorithmic properties of perfect transfer networks. We then show that in polynomial time, one can decide whether a given network is a valid explanation for a set of taxa, and show how, for a given tree, one can add transfer edges to it so that it explains a set of taxa. We finally provide lower and upper bounds on the number of transfers required to explain a set of taxa, in the worst case.
Introduction
Evolution has historically been seen as a treelike process in which genetic material is inherited through vertical descent. However, it is now established that coexisting species from most kingdoms of life, if not all, have exchanged genetic material laterally through hybridation or horizontal gene transfer (HGT). The latter is wellknown to occur routinely between procaryotes [1, 2], but is believed to have affected eucaryotes as well [3, 4]. HGT is also known to occur between viruses and their hosts [5], between mitochondria and the nucleus [6], and between tumor cells [7].
Since HGTs play a significant role in shaping evolution, several bioinformatics approaches have been developed to identify them. Most of these can be classified as either parametric or phylogenetic. Parametric methods are based on the sequence of one genome of interest and attempt to find DNA regions that exhibit a signature that is different from the rest of the genome (see [8]). Phylogenybased methods consist of taking a set of taxa (e.g. genes and/or species), reconstructing their phylogenetic tree, and inferring the unseen transfer locations on the tree. A common way of achieving this is through reconciliation, which aims to explain the discrepancies between a gene tree and a species tree by finding where the gene duplication, loss, or transfer events occurred [9,10,11,12]. Finding a most parsimonious reconciliation under this model is NPhard [13,14,15], mainly because the inferred transfer locations need to be timeconsistent, meaning that they must occur between species that may have coexisted. In addition, recent fundamental approaches propose to identify pairwise gene relationships to infer transfers. For instance, irregularities in the pairwise gene distances can pinpoint to possible transfers [16], or predictions of orthlogs, paralogs, and xenologs can help reconstructing a gene tree and a species network that explain these relationships [17,18,19,20].
The above approaches are all based on gene sequences in one way or another, either to reconstruct the phylogenies or to infer pairwise relationships. However, it is wellknown that sequences have their limits for predicting HGT, especially in the case of ancient transfers [21]. In this work, we ask whether characterbased approaches can instead be used to predict HGT on a phylogeny. A character is a generic term to denote a trait that a taxa may possess or not, which can be morphological or molecular. A common example of characterbased data is gene expression, where a trait corresponds to whether a species expresses a gene or not in a condition of interest [22,23,24]. A major advantage of using gene expression profiles, and possibly other character traits, over sequence data comes when highly divergent sequences are involved. In [25], the authors used expression to recover phylogenetic signals better than using only sequence similarity measures. This could be because the necessary information to coordinate the folding or function of proteins is encoded in a small number of conserved fragments, in which case the two homologous proteins can share a small percentage of sequence similarity. This can be leveraged to detect HGTs that are hard to find using sequences, since one could hypothesize that two clades that started expressing the same gene independently could have acquired this behavior by transfer.
The task in this setting is, given a set of characters \(\mathcal {C}\) and a set of taxa \(\mathcal {S}\) that each possess a subset of \(\mathcal {C}\), to explain the diversity of \(\mathcal {S}\) in a phylogeny. Ideally, \(\mathcal {S}\) can be explained by a tree in which taxa that possess a common character form a clade, in which case the tree is called a perfect phylogeny [26,27,28,29]. When no such perfect phylogeny exists, transfers may be required to explain the data. We point out that recently, characterbased methods have resurfaced in tumor phylogenetics, where they are used to represent whether a tumor clone has acquired a somatic mutation or not [30,31,32,33].
Before gene expression and other characterbased data can be used to predict HGT, appropriate models and algorithmic frameworks need to be devised. To our knowledge, characterbased approaches have mostly been used to detect hybridation events, where two or more species recombinate to produce an hybrid offspring. In the most popular models, a set of taxa is explained by an ancestral recombination graph (ARG), which is a acyclic directed graph in which nodes with multiple parents represent hybrids, and nodes with a single parent represent vertical descent [34,35,36]. The task of finding recombination events is different from that of finding HGTs. Recombinations create offsprings whose genetic content is merged from the parents without vertical descent being involved directly. As a result, there is no donor/recipient relationship. In the case of transfers, it is important to distinguish which traits were acquired vertically from the parent, and which traits were given by a donor.
Another model called perfect phylogenetic networks (PPN) was also introduced in [37, 38] to study the evolution of languages, but can also be used for biological characters. To our knowledge, this is the first model that attempts to extend the notion of perfect phylogenies to networks. PPNs belong to the class of treebased networks [39, 40] which capture the idea of an underlying tree on which a set of transfer highways are “attached”. The base tree indicates where vertical descent occurred and the attached transfer edges clearly show where genetic material could have been exchanged. In this model, the characters can have multiple states and a character is compatible if the network contains a tree in which the character is convex (i.e. the subgraph induced by nodes with the same state is connected).
Let us also mention that in [41], the authors propose a framework to explain gene evolution using HGT on general networks, in order to minimize the number of genes present in the same ancestral species.
Our contributions. We introduce perfect transfer networks (PTN), which are treebased networks that can explain how each character was acquired/transferred in a given set of taxa. Our model is a direct generalization of perfect phylogenies to networks, as we use the same set of evolutionary rules. That is, we require that in the network, a character acquired by an ancestral species is never lost by its vertical descendants as in the CaminSokal parsimony model [42], and that each character has a unique origin. Additionally, a character can only be transferred horizontally on the edges that are explicitly labeled as transfers. It is worth mentioning that in [43], the authors study an HGT inference framework in which characters that admit a perfect phylogeny are ignored, whereas characters that do not are treated as evidence of transfers. Our work can be seen as an effort to formalize this idea.
We then study the structural and algorithmic aspects of PTNs. We first show that PTNs have two equivalent definitions that are both generalizations of perfect phylogenies. We then distinguish PTNs from recombination networks and from perfect phylogenetic networks by showing that some taxa sets are explained by different networks depending on the model.
As for the algorithmic aspects, we study three different problems. First, we ask whether a given treebased network can explain the characters of a set of taxa and provide a simple, polynomialtime algorithm for the problem. Second, we study the tree completion problem where, given a tree, we are asked to add transfers to it so that it explains the input taxa. We show that any tree can explain any set of taxa, even if the characters at the ancestral nodes of the tree are constrained by the input. Third, we study the reconstruction problem, where only the taxa are known and we must reconstruct a treebased network with a minimum number of transfers that explains them. The algorithmic classification of this problem remains open, but we provide nearly exponential lower and upper bounds on the number of transfers required in the worst case, with respect to the number of characters. We then conclude with a discussion on open problems, including the problem of adding a minimum number of transfers to a tree to make it explain a set of taxa.
Preliminaries
In this section, we describe the standard phylogenetic notions used in the paper, and then define our perfect transfer network model.
Phylogenetic Networks and treebased networks
For an integer n, we use the notation \([n] = \{1, \ldots , n\}\). All graphs in this work are directed and loopless. A directed graph G is connected if the underlying undirected graph of G is connected. A binary phylogenetic network, or simply a network for short, is a directed acyclic graph \(G = (V, E)\) such that either \(V = 1\), or such that G satisfies the following conditions:

there is a set of vertices with indegree 1 and outdegree 0, called leaves.

there is a unique vertex with indegree 0 and outdegree 2, called the root.

every other vertex has either indegree 1 and outdegree 2 (tree nodes), indegree 2 and outdegree 1 (reticulation nodes), or indegree 1 and outdegree 1 (subdivision nodes).
We say that \((u, v) \in E\) is a tree edge if v is a tree node or a leaf. Note that the usual definition of a network forbids subdivision nodes. We allow them only because it simplifies some of the definitions and proofs.
For a network G, we write \(\rho (G)\) for the root of G and L(G) for the leaves. If \(V(G) = 1\), then we define \(\rho (G)\) as the single vertex of G and consider that \(L(G) = \{\rho (G)\}\). If \(\sigma\) is a bijection from L(G) to a set \(\mathcal {S}\), we call \(\sigma\) an \(\mathcal {S}\)map for G, or just an \(\mathcal {S}\)map if G is understood. Now suppose that G is a directed graph, network or not. We say that \(u \in V(G)\) reaches a node \(v \in V(G)\) if there exists a directed path from u to v in G. We denote by \(R_u(G)\) the set of nodes that u reaches in G, and we note that \(u \in R_u(G)\). For a subset W of V(G), we denote by G[W] the subgraph of G induced by W. We will also denote by \(GW\) the graph obtained by the removal of W from V(G) and all of its incident edges. In other words, \(G  W = G[V(G) \setminus W]\).
A tree T is a network whose underlying undirected graph has no cycles. We say that \(W \subseteq V(T)\) forms a subtree of T if T[W] is a tree. We say that a vertex \(v \in V(T)\) is an ancestor of \(u \in V(T)\) if v is on the path from \(\rho (T)\) to u. In this case, we will call u a descendant of v. Note that v is an ancestor and descendant of itself. The ancestor order \(\preceq _T\) is a partial order in a tree T. When \(u \prec _T v\) we say that v is an ancestor of v and u is considered a descendant of v. In this partial order we have that the root \(\rho\) of T is the unique maximal element. We say that two nodes u and v are comparable if \(u \preceq _T v\) or \(v \preceq _T u\). We say that they are incomparable otherwise. We will drop the subscript T when T is clear from the context. For \(v \in V(T)\), we will use T(v) to refer to the subtree of T rooted at v (that is, T(v) contains v and all of its descendants).
A network \(G = (V, E)\) is a treebased network [44] if G has no subdivision nodes, and there is a partition \(\{E_S, E_T\}\) of E such that the subgraph \(\mathcal {T}_{G}:= (V, E_S)\) is a tree with the same set of leaves as G, which is called the support tree of G. The edges in \(E_S\) are called support edges and the edges in \(E_T\) are called transfer edges. Note that \(\mathcal {T}_{G}\) contains subdivision nodes, unless \(E_T\) is empty. The tree obtained from \(\mathcal {T}_{G}\) by suppressing its subdivision nodes is called the base tree of G (suppressing a subdivision node u with parent p and child v consists of removing u and adding an edge from p to v). Roughly speaking, a treebased network G can be obtained by starting with a tree and inserting transfer edges into it. Note that in most cases, the partition of the edges into \(E_S\) and \(E_T\) will be known (whereas treebased networks merely require these to exist). When these edge sets are given, the network is sometimes called an \(\emph {LGT network}\), see [59].
As mentioned in the introduction, networks should be biologicallyfeasible in terms of time. We define a time consistent map over a treebased network G with support edges \(E_S\) and transfer edges \(E_T\) as a function \(\tau : V \rightarrow \mathbb {R}\) such that:

for every \((u,v) \in E_S\), \(\tau (u) > \tau (v)\).

for every \((u,v) \in E_T\), \(\tau (u) = \tau (v)\).
We say that G is a timeconsistent treebased network if there exists a time consistent map for G [45]. Note that the existence of a timeconsistent map on a network implies that it is treebased [46] (but the converse does not necessarily hold). In the following sections, we will assume that all the treebased networks are timeconsistent without explicit mention.
Perfect transfer networks
We now propose to extend the perfect phylogeny model to treebased networks. Let \({\mathcal {S}= \{S_1, S_2, \dots , S_n\}}\) be a set of taxa and \(\mathcal {C}= \{ c_1, c_ 2, \dots , c_m\}\) a set of characters. We view a taxa \(S_i\) as the set of characters that it possesses, so that for each \(i \in [n]\), \(S_i\) is a subset of \(\mathcal {C}\). Our goal is to explain the character diversity of \(\mathcal {S}\) using its evolutionary history. Given a treebased network G with \(\mathcal {S}\)map \(\sigma\), we want to know where each character appeared in G under the conditions that each character has a single origin, that it cannot be lost once acquired, and that it can be transferred. Throughout the phylogenetic literature, requiring a single origin is called the homoplasyfree assumption (or sometimes the “no parallel evolution” or “no convergent evolution”), which states that characters cannot arise independently in unrelated lineages [47, 48]. HGT is not considered to be a cause of homoplasy, but of course homoplasy can occur even in the presence of HGT. Nonetheless, this assumption has historically been used as a first step towards more complex models (see e.g. [49]).
To formalize this, given a treebased network G, a \(\mathcal {C}\)labeling of G is a function \(l: V(G) \rightarrow 2^{\mathcal {C}}\) that maps each node of G to the subset of characters that it possesses (here, \(2^{\mathcal {C}}\) represents the powerset of \(\mathcal {C}\)). For a character \(c \in \mathcal {C}\), we will denote by \(V_c(l) = \{v \in V(G): c \in l(v)\}\) the set of nodes that possess character c, and we denote by \(\overline{V}_c(l) = V(G) \setminus V_c(l)\) the nodes that do not have it. If l is clear from the context, then we may simply write \(V_c\) and \(\overline{V}_c\).
Our evolutionary requirements are encapsulated in the following definition.
Definition 1
(Perfect transfer networks) Let \(\mathcal {S}\) be a set of taxa on characters \(\mathcal {C}\), let \(G = (V, E_S \cup E_T)\) be a treebased network, and let \(\sigma\) be an \(\mathcal {S}\)map for G. We say that a \(\mathcal {C}\)labeling l of G explains \(\mathcal {S}\) if the following conditions hold:

for each \(v \in L(G)\), \(l(v) = \sigma (v)\);

for each support edge \((u, v) \in E_S\), \(c \in l(u)\) implies that \(c \in l(v)\) (never lost once acquired);

for each \(c \in \mathcal {C}\), there exists a unique node \(v \in V_c(l)\) that reaches every node of \(V_c(l)\) in \(G[V_c(l)]\) (single origin).
Furthermore, we call the pair \((G, \sigma )\) a perfect transfer network (PTN) for \(\mathcal {S}\) if there exists a \(\mathcal {C}\)labeling of G that explains \(\mathcal {S}\).
See Fig. 1.2 for an example of a PTN. Later on in Theorem 2, we will show that Definition 1 is similar, though slightly different, to a connectedness requirement known as convexity on each character, see [36]. Notice that if G is a tree, then every edge is a support edge and Definition 1 coincides with the definition of a perfect phylogeny from [36]. If \(G = (V, E_S \cup E_T)\) is a treebased network, the definition does not explicitly state what can or cannot be done with transfer edges. The way to see this is that the definition does not forbid ancestral taxa from using transfer edges. That is, if \((u, v) \in E_T\), then u can transmit any subset of its characters to v horizontally. The motivation behind the requirements of Definition 1 is to model the presence and absence of traits that have unique origins and cannot be lost throughout evolutionary processes. Examples of such traits include transposable elements (TEs) which are unique genomic sequences that have integrated into the genome and are rarely lost [50], biochemical markers such as metabolites which are small molecules that function as intermediates and products of metabolic processes [51], and emergence of organelles such as mitochondria or chloroplasts that results from endosymbiotic events and is irreversible [6, 52]. It is worth highlighting that the horizontal transfer of TEs between species is a prevalent phenomenon that significantly contributes to their sustained viability over time [53]. As for metabolites, it has been previously shown that HGT plays a role in the generation of new metabolic pathways in bacteria [54].
We are interested in the following algorithmic problems:

The PTNrecognition problem: given a treebased network G with \(\mathcal {S}\)map \(\sigma\), is \((G, \sigma )\) a PTN for \(\mathcal {S}\)? That is, does there exist a \(\mathcal {C}\)labeling of G that explains \(\mathcal {S}\)? See Fig. 1.4 for an example of a network that is not a PTN.

The treecompletion problem: given a tree T with \(\mathcal {S}\)map \(\sigma\), does there exist a PTN \((G, \sigma )\) for \(\mathcal {S}\) such that T is the base tree of G? See Fig. 1.2.
We are also interested in the minimization variant of this problem, where we require that \((G, \sigma )\) has a minimum number of transfer edges. See Fig. 1.3.

The PTNreconstruction problem: given a set of characters \(\mathcal {C}\) and a set of taxa \(\mathcal {S}\), find a PTN \((G, \sigma )\) for \(\mathcal {S}\) with a minimum number of transfer edges.
We show that the recognition problem can be solved in time \(O(\mathcal {C}V(G)^2)\). For the treecompletion problem, we provide a more general result: any tree with any given prelabeling can explain any set of taxa. To be more specific, for any given tree T and any \(\mathcal {C}\)labeling of T that satisfies the never lost once acquired condition, one can always explain \(\mathcal {S}\) by adding transfers in a timeconsistent manner while preserving the given labeling. This motivates the need for the minimization variant, which leads to several open problems. For the tree reconstruction problem, we give exponential lower and upper bounds on the number of transfers required by a set of k characters, in the worst case.
Properties of the perfect transfer model
Before delving into the algorithms, we study our model a bit more indepth. First, we provide an alternate definition of perfect transfer networks in terms of character connectedness. This definition is sometimes easier to deal with in our proofs, and is akin to perfect phylogenies that also admit a similar equivalent definition. Second, we ensure that our model does not reinvent the wheel by explicitly stating its differences with other models.
Theorem 2
Let \(G = (V, E_S \cup E_T)\) be a treebased network with \(\mathcal {S}\)map \(\sigma\). Then a \(\mathcal {C}\)labeling l of G explains \(\mathcal {S}\) if and only if the following conditions hold:

for each \(v \in L(G)\), \(l(v) = \sigma (v)\);

for each \(c \in \mathcal {C}\), \(G[V_c(l)]\) is connected and contains a unique node of indegree 0;

for each \(c \in \mathcal {C}\), either \(V = V_c(l)\), or \(\mathcal {T}_{G}[\overline{V}_c(l)]\) is connected and contains \(\rho (G)\).
Proof
(\(\Rightarrow\)) Suppose that l is a \(\mathcal {C}\)labeling of G that explains \(\mathcal {S}\), according to Definition 1. We argue that the three conditions stated in the theorem are true. By Definition 1, \(l(v) = \sigma (v)\) for each \(v \in L(G)\) holds. For the other conditions, let \(c \in \mathcal {C}\). Let v be the unique node of \(V_c(l)\) that reaches every node in \(G[V_c(l)]\), which is guaranteed to exist by Definition 1. Because \(G[V_c(l)]\) is acyclic, no node other than v can reach v in \(G[V_c(l)]\). This implies that v has indegree 0 in \(G[V_c(l)]\). Moreover, \(G[V_c(l)]\) is connected since v reaches all of its nodes. If \(\overline{V}_c(l)\) is empty, then the third condition also holds, so assume this is not the case. Let us now focus on \(\mathcal {T}_{G}[\overline{V}_c(l)]\). Observe that because characters are never lost once acquired, l satisfies the property that for every \((u, w) \in E_S\), \(w \in \overline{V}_c(l)\) implies that \(u \in \overline{V}_c(l)\). This in turn implies that for any \(u \in \overline{V}_c(l)\), every ancestor of u in \(\mathcal {T}_{G}\) is in \(\overline{V}_c(l)\), including the root \(\rho (G)\). Since we assume that \(\overline{V}_c(l)\) is nonemtpy, it follows that \(\rho (G) \in \overline{V}_c(l)\). It also follows that \(\mathcal {T}_{G}[\overline{V}_c(l)]\) is connected because all of its nodes have a path to \(\rho (G)\).
(\(\Leftarrow\)) Suppose that l satisfies all the conditions of the theorem. We show that all properties of Definition 1 hold. For each \(v \in L(G)\), we know that \(l(v) = \sigma (v)\). For the other conditions, let \(c \in \mathcal {C}\). First suppose for contradiction that there is a support edge \((u, v) \in E_S\) such that \(u \in V_c(l)\) but \(v \in \overline{V}_c(l)\). Thus \(\overline{V}_c(l)\) is not empty, in which case \(G[\overline{V}_c(l)]\) is connected and contains \(\rho (G)\). The path in the support tree \(\mathcal {T}_{G}\) from \(\rho (G)\) to v goes through u. But \(\rho (G) \in \overline{V}_c(l)\), which is a contradiction since \(\mathcal {T}_{G}[\overline{V}_c(l)]\) is connected, but here u disconnects \(\rho (G)\) from v in \(\mathcal {T}_{G}\). Thus the condition of never losing acquired characters holds. Now let v be the unique node of \(V_c(l)\) of indegree 0 in \(G[V_c(l)]\). Assume that there is some \(u \in V_c(l)\) that v does not reach in \(G[V_c(l)]\). Let \(P_u\) be the set of nodes of \(V_c(l)\) that reach u in \(G[V_c(l)]\). Because \(G[V_c(l)]\) is acyclic, \(P_u\) must contain a node w of indegree 0, contradicting that v is the unique node of indegree 0. Thus v reaches every node in \(G[V_c(l)]\) and, because it has indegree 0, it is the unique such node. Thus the single origin condition is satisfied. \(\square\)
Perfect transfer networks versus perfect phylogenetic networks
Before we move on, it is important to put our model in perspective with Perfect Phylogenetic Networks (PPN), which, to our knowledge, are the closest to our work. The idea of a PPN is that a network contains several evolutionary trees, and a character could evolve in any one of those trees. More specifically, in the PPN model, characters are multistate, so that a character can be in any of the set of possible states Z. A character c is compatible with a tree T whose leaves are labeled by the states of c if there is a statelabeling of the internal nodes of T such that, for each \(z \in Z\), the nodes in state z form a connected subgraph of T. Given a network G and a tree T, we say that T is displayed by G if T can be obtained by successively removing reticulation edges and suppressing subdivision nodes. A treebased network G is a PPN for a set of characters \(\mathcal {C}\) if each character is compatible with some tree displayed by G. In terms of character evolution, for PPNs every state is subject to the same evolutionary constraints. In contrast, the character evolution model implied by PTNs represents “presence” and “absence” of a trait, and these two states have different behavior. This difference plays an important role for transfer edges. The PTN model explicitly prohibits the transfer of an “absence” state, whereas for PPNs any state is allowed to be transferred. See Fig. 2 for an example of a treebased network that is a PPN, but not a PTN (if the state 0 is interpreted as absence).
Also note that it is NPhard to decide whether a given network G is a PPN for a given set of characters \(\mathcal {C}\) [38]. Later on, we will show that the analogous recognition problem for PTNs can be solved in polynomial time. However, our result holds for binary character states and the hardness proof for PPNs relies on the character states being nonbinary, and it is unclear whether the hardness is preserved for binary character states.
Perfect transfer networks versus recombination networks
Another model with goals that are similar to ours are recombination networks. In this model, the indices of the characters \(\mathcal {C}= \{c_1, \ldots , c_m\}\) determine an ordering of the characters. For a string B, B[j] denotes its jth character and B[i..j] its substrings containing positions from i to j. Each taxa \(S_i \subseteq \mathcal {C}\) can be represented as an mbit string \(\beta (S_i)\) in which \(\beta (S_i)[j] = 1\) if and only if \(S_i\) possesses character \(c_j\). Given an mbit string B and an odd integer d, we say that B is a dcrossover of two other mbit strings X and Y if there are indices \(i_1, \ldots , i_d\) such that \(B = X[1.. i_1] Y[i_1 + 1.. i_2] X[i_2 + 1.. i_3] \ldots Y[i_d + 1.. n]\). If d is even, the definition of a dcrossover is the same except that the last substring is \(X[i_d + 1.. n]\). Note that the roles of X and Y are interchangeable. For a network G and \(\mathcal {S}\)map \(\sigma\), a binary \(\mathcal {C}\)labeling of G is a function f in which f(v) is an mbit binary string for each \(v \in V(G)\), such that \(f(\rho (G))\) only contains 0s. A binary \(\mathcal {C}\)labeling f of G explains \(\mathcal {S}\) with dcrossovers if \(f(v) = \beta (\sigma (v))\) for each \(v \in L(G)\), and the following holds:

for each reticulation node v with parents u and w, f(v) is a dcrossover of f(u) and f(w);

for each tree edge (u, v), f(v) is obtained from f(u) by flipping some 0 positions to 1 (we may decide to flip none);

for each \(i \in [m]\), there is at most one tree edge (u, v) with \(f(u)[i] = 0\) but \(f(v)[i] = 1\).
We say that \((G, \sigma )\) is an ancestral recombination graph (ARG) for \(\mathcal {S}\) with dcrossovers if there exists a binary \(\mathcal {C}\)labeling of G that explains \(\mathcal {S}\) with dcrossovers. We denote by \(ARG_d(\mathcal {S})\) the set of all ARGs for \(\mathcal {S}\) with dcrossovers. We also denote \(ARG_{\infty }(\mathcal {S}) = \bigcup _{d=1}^{\infty } ARG_d(\mathcal {S})\).
In the literature, single crossovers are modeled with \(d = 1\) and have been studied extensively. The \(d = 2\) case is often referred to as double crossovers and can also model gene conversion. It was stated in [36] that \(d > 6\) is rarely considered in practice.
The most obvious difference between ARGs and PTNs is that ARGs were introduced to model hybridation events, whereas we created PTNs to model horizontal gene transfer. More specifically, ARGs do not differentiate between the two parents of a reticulation node, whereas in our model, one parent only transmits genetic content via vertical descent whereas the other does so via HGT. In fact, ARGs do not need to be treebased networks. Although this is a fundamental difference, it is also interesting to ask whether, among the class of treebased networks, the data explanation depends on the model.
To formalize this, we write \(PTN(\mathcal {S})\) for the set of perfect transfer networks for \(\mathcal {S}\). The next result shows that ARGs with dcrossovers are incomparable with PTNs unless we allow an arbitrary number of crossovers. We emphasize that even though infinite crossovers can emulate transfers, they still cannot distinguish vertical from horizontal inheritance.
Proposition 3
The following relationships between PTNs and ARGs hold:

for any fixed \(d \ge 1\), there exists a set of taxa \(\mathcal {S}\) on \(d + 2\) characters such that \(PTN(\mathcal {S}) {\setminus } ARG_d(\mathcal {S})\) is nonempty;

there exists a set of taxa \(\mathcal {S}\) on two characters such that \(ARG_1(\mathcal {S}) \setminus PTN(\mathcal {S})\) is nonempty;

for any set of taxa \(\mathcal {S}\), \(PTN(\mathcal {S}) \subseteq ARG_{\infty }(\mathcal {S})\).
Proof
For (1), consider the network G in Fig. 3.1. For any \(\mathcal {C}\), the labeled network shows that \((G, \sigma )\) is in \(PTN(\mathcal {S})\). Put \(\mathcal {C}= \{c_1, \ldots , c_{d + 2}\}\). We argue that \((G, \sigma )\) is not in \(ARG_d(\mathcal {S})\). Note that in any binary \(\mathcal {C}\)labeling of G that explains \(\mathcal {S}\), the parent of each \(\emptyset\) leaf taxa must be the string \(00 \ldots 0\), as otherwise they would need to transmit a 1 to these leaves. Likewise, the parent of the upper \(\mathcal {C}\) leaf taxon must be \(11 \dots 1\). If not, there would be a \(01\) flip on the edge leading to the upper \(\mathcal {C}\). But, we would also need another \(01\) flip somewhere on the path to the lower \(\mathcal {C}\) taxon, which is not allowed in ARGs. So, the parents of the single reticulation have labels \(00 \ldots 0\) and \(11 \ldots 1\). Moreover, the root is labeled \(00 \ldots 0\), and thus all the possible \(01\) flips occur between the root and its right child. We cannot have any new \(01\) flip, and so the reticulation must be labeled \(0101 \ldots 01\) to be able to transmit the required characters to the oddcharacters leaf (or the last character is 0 if d is even). Whether d is odd or even, there are \(d + 2\) characters and we must alternate each of them between the parents. This requires \(d + 1\) crossovers, and so \((G, \sigma ) \notin ARG_d(\mathcal {S})\).
For (2), consider the network G in Fig. 3.2. There are only two characters \(c_1, c_2\). The right side of the figure shows that G can be explained under single crossovers. However, we can argue that \((G, \sigma )\) is not a perfect transfer network. This is because if there is a \(\mathcal {C}\)labeling l that explains the taxa at the leaves, the parent of each \(c_1\) leaf must contain \(c_1\). But by the never lose once acquired condition, \(c_1\) should then be transmitted vertically to the leaf that has no character, a contradiction. Thus \((G, \sigma ) \notin PTN(\mathcal {S})\).
For (3), let \((G, \sigma ) \in PTN(\mathcal {S})\). Let l be a \(\mathcal {C}\)labeling of G that explains \(\mathcal {S}\). To show that \((G, \sigma ) \in ARG_{\infty }(\mathcal {S})\), we need to modify l slightly. Specifically, we ensure that characters never have their firstappearance on a reticulation node. Let v be a reticulation node of G with parents u, w such that (u, v) is a support edge and (w, v) is a transfer edge. Suppose that there is \(c_j \in \mathcal {C}\) such that \(c_j \notin l(u), c_j \notin l(w)\), but \(c_j \in l(v)\). It follows from Theorem 2 that v is the unique node of indegree 0 in \(G[V_{c_j}(l)]\). Consider the labeling \(l'\) obtained by taking l, but applying \(l'(v) = l(v) {\setminus } \{c_j\}\). Let \(v'\) be the unique child of v. One can easily see that \(G[V_{c_j}(l')]\) is connected and that \(v'\) is its unique node of indegree 0. Moreover, \(\mathcal {T}_{G}[\overline{V}_{c_j}(l')]\) is the same as \(\mathcal {T}_{G}[\overline{V}_{c_j}(l)]\) but with v added. It is still connected since v is a child of \(u \in \overline{V}_{c_j}(l)\), and it still contains the root. Hence by Theorem 2, \(l'\) also explains \(\mathcal {S}\).
By applying the above argument to every character, we obtain a labeling l that explains \(\mathcal {S}\) such that for any character \(c_j\), the firstappearance of \(c_j\) under l does not occur at a reticulation node. Assume that l has this property.
Consider the binary \(\mathcal {C}\)labeling f of G in which, for each \(v \in V(G)\), we put \(f(v)[j] = 1\) if and only if \(c_j \in l(v)\). We claim that f explains \(\mathcal {S}\) with mcrossovers, where \(m = \mathcal {C}\). First consider a reticulation node v with parents u and w, where (u, v) is a support edge and (w, v) is a transfer edge. We must argue that f(v) is an mcrossover of f(u) and f(w). Because under l, no character firstappears on a reticulation, we have that for each \(c_j \in l(v)\), either \(c_j \in l(u)\) or \(c_j \in l(w)\). Moreover, for each \(c_j \notin l(v)\), we must have \(c_j \notin l(u)\) (by the never lost once acquired condition). In terms of f, this means that for each \(j \in [m]\), if \(f(v)[i] = 1\) then one of u or w also has a 1 in position j, and if \(f(v) = 0\), then \(f(u)[j] = 0\). It follows that f(v) can be obtained with at most m crossovers from its parents.
Next, we argue that for each character \(c_j\), there is at most one tree edge (u, v) that flips \(c_j\) from 0 to 1 under f. If there were two such edges, then under l, there would be two trees nodes that possess \(c_j\) but not their (unique) parent. Thus \(G[V_{c_j}(l)]\) would have two nodes of indegree 0, contradicting Theorem 2. Third, the condition that characters are not lost after being acquired implies that, for every tree edge (u, v), f(v) can be obtained from f(u) by flipping 0s to 1s, but not viceversa (this follows from the fact that tree edges are support edges). Thus, f explains \(\mathcal {S}\) and we conclude that \((G, \sigma ) \in ARG_{\infty }(\mathcal {S})\). \(\square\)
Algorithmic problems
We now study the algorithmic aspects of recognition, completion, and recontruction of PTNs.
Recognizing perfect transfer networks
The first problem in this section is analogous to the perfect phylogeny problem, where we must find a labeling of all the inner nodes so that the network correctly represents the evolution of a given set of species. This is not as trivial as in the tree case, since their may be multiple options for the originator of a character \(c \in \mathcal {C}\).
The PTN recognition problem
Input. A set of taxa \(\mathcal {S}\) on characters \(\mathcal {C}\) and a treebased network \(G = (V, E_S \cup E_T)\) with \(\mathcal {S}\)map \(\sigma\).
Output. A \(\mathcal {C}\)labeling of G that explains \(\mathcal {S}\), if one exists.
Importantly, the above problem formulation lets us assume that we have knowledge of support and transfer edges. We first need some intermediate results (recall that \(\mathcal {T}_{G}\) is the support tree of G).
Lemma 4
Let \(G = (V,E_S \cup E_T)\) be a treebased network with \(\mathcal {S}\)map \(\sigma\), and let l be a \(\mathcal {C}\)labeling of G that explains \(\mathcal {S}\). Let \(u \in \overline{V}_c(l)\). Then for each ancestor v of u in \(\mathcal {T}_{G}\), we have \(v \in \overline{V_c}(l)\) as well.
Proof
Suppose that \(u \in \overline{V}_c(l)\) has an ancestor v in \(\mathcal {T}_{G}\) such that \(v \in V_c(l)\). Consider the unique path of \(\mathcal {T}_{G}\) from v to u, namely the sequence \((v,v_1, v_2,\dots , v_k, u)\). Due to the never lost once acquired requirement of Definition 1\(\{v_1,v_2, \dots , v_k\} \subseteq V_c(l)\). In this way the edge \((v_k,u)\) will represent the loss of character c, a contradiction. \(\square\)
In other words, any node that has at least one descendant in \(\overline{V_c}(l)\) should be in \(\overline{V_c}(l)\) in every possible \(\mathcal {C}\)labeling l that explains \(\mathcal {S}\). Since we must have \(l(v) = \sigma (v)\) for each leaf v, we can already deduce that if v is a leaf such that \(c \notin \sigma (v)\), then no ancestor of v in the support tree can possess c. This is a property similar to character state changes in the CaminSokal parsimony method [55]. We thus define the following subset of nodes that are forced to not have c:
If G and \(\sigma\) are clear from the context, we will write \(F_c\) instead of \(F_c(G, \sigma )\). Recall that for a network G, \(R_v(G)\) denotes the set of nodes reachable from v. The following characterization of PTNs will let us recognize them easily.
Lemma 5
Let G be a treebased network with \(\mathcal {S}\)map \(\sigma\). Then \((G, \sigma )\) is a perfect transfer network for \(\mathcal {S}\) if and only if for every character \(c \in \mathcal {C}\), \(GF_c\) contains a node v such that \(R_v(G  F_c)\) contains every leaf in \(L(G  F_c)\).
Proof
\((\Rightarrow )\) Let l be a \(\mathcal {C}\)labeling of G that explains \(\mathcal {S}\), and let \(c \in \mathcal {C}\). By Lemma 4, we must have \(F_c \subseteq \overline{V}_c(l)\). The resulting graph \(GF_c\) thus contains all the nodes in \(V_c(l)\). Due to the single origin requirement of our definition, \(G  F_c\) contains a node v that is able to reach all the leaves in \(V_c(l)\), which includes all the leaves of \(G  F_c\).
\((\Leftarrow )\) To show the converse, we build a \(\mathcal {C}\)labeling l in the following way: for every \(c \in \mathcal {C}\), let v be a node such that its reachable set in \(GF_c\) contains every leaf in \(L(GF_c)\), and let us call v the origin of c. Then for \(u \in V(G)\), we put \(c \in l(u)\) if and only if \(u \in R_v(GF_c)\). That is, the origin of c is v and it is transmitted to every node that v reaches in \(G  F_c\). We claim that l satisfies all the conditions of Theorem 2.
Let \(u \in L(G)\) and let us first argue that \(l(u) = \sigma (u)\). Let \(c \in \mathcal {C}\) and let v be the chosen origin of c in l. If \(c \notin \sigma (u)\), then \(u \in F_c\) and v does not reach u in \(G  F_c\) (because u is simply not in \(G  F_c\)), and by our construction, \(c \notin l(u)\). If \(c \in \sigma (u)\), then \(u \notin F_c\) and v reaches u in \(G  F_c\), in which case we put \(c \in l(u)\). It follows that \(l(u) = \sigma (u)\).
We now argue on the connectedness requirements of the \(G[V_c(l)]\) subgraphs. Again, let \(c \in \mathcal {C}\) and let v be the chosen origin of c in l. Since \(V_c(l)\) consists of nodes reachable from v, it is evident that v will be the only node in \(G[V_c(l)]\) whose indegree is 0. It is also evident that \((G  F_c)[V_c(l)]\) is connected, since \(V_c(l)\) only contains nodes reachable from v in \(G  F_c\). This implies that \(G[V_c(l)]\) is also connected, since we cannot disconnect the \(V_c(l)\) subgraph by putting back the nodes of \(F_c\).
It remains to argue the third condition of Theorem 2. First assume that the origin v of c is equal to \(\rho (G)\). Then every leaf must possess c, as otherwise if some leaf u would satisfy \(c \notin \sigma (c)\), then \(u \in F_c\) and the root would also be in \(F_c\), by its definition. It follows that \(F_c\) is empty. Then our construction puts \(V_c(l) = V(G)\) since \(\rho (G)\) reaches every node in \(G  F_c = G\). In this case, the third condition of the theorem holds. So we may assume that \(v \ne \rho (G)\). In this case, v does not reach \(\rho (G)\) in \(G  F_c\) since no node reaches the root (except the root itself). Thus we may assume that \(\overline{V}_c(l) \ne \emptyset\) and contains the root. Suppose for a contradiction that \(\mathcal {T}_{G}[\overline{V_c}(l)]\) is disconnected, i.e. there exist some node \(u \in \overline{V}_c(l)\) that \(\rho (G)\) cannot reach in \(G[\overline{V}_c(l)]\). Then in \(\mathcal {T}_{G}\), u has an ancestor \(w \in V_c(l)\), which implies that the origin, v, can reach w in \(GF_c\). This implies that \(w \notin F_c\), which in turn implies that no node from w to u in \(\mathcal {T}_{G}\) can be in \(F_c\). This means that the path from w to u exists in \(GF_c\). Thus in \(G  F_c\), v reaches u through w, and so our construction of l would have put \(c\in l(u)\), a contradiction. Hence, \(\mathcal {T}_{G}[\overline{V_c}(l)]\) is connected and contains \(\rho (G)\). \(\square\)
The proof of the previous lemma implies the following verification algorithm:
Theorem 6
Algorithm 1 correctly solves the PTN recognition problem in time \(O(\mathcal {C}V(G)^2)\).
Proof
We first argue that the algorithm is correct. By Lemma 5, it suffices to check, for every \(c \in \mathcal {C}\), that some node v reaches every leaf in \(G  F_c\). Moreover, when this is the case, the proof of Lemma 5 shows that we can add c to every node in \(R_v(G  F_c)\) to obtain a labeling that explains \(\mathcal {S}\). If the algorithm finds such a v, this is exactly the labeling that it applies. So we must argue that when such a v exists, the algorithm will find it.
For that, we claim that the verification in line 12 of Algorithm 1 is enough to find the node required by Lemma 5. That is, we do not need to check every node v of \(\widehat{G_c} = G  F_c\), but only those in the set X, i.e. the nodes of indegree 0. Suppose that there is \(y \in V(\widehat{G_c})\) that reaches every leaf in \(L(\widehat{G_c})\). If \(y \in X\), we are done. Otherwise, because \(\widehat{G_c}\) is acyclic, there must be \(v \in X\) that reaches y (it can be found by following by iteratively following inneighbors starting from y until such a node is reached). It follows that \(R_y(\widehat{G_c}) \subseteq R_v(\widehat{G_c})\) and that v also reaches every leaf. Thus, it suffices to check every source in \(\widehat{G_c}\).
Let us now argue the complexity. For a character \(c \in \mathcal {C}\), computing \(F_c\) can be done in a postorder traversal of \(\mathcal {T}_{G}\) in time O(V(G)). Checking whether the resulting network is connected or not can be done in linear time too. Finding the nodes of indegree 0 takes lineartime and, for each O(V(G)) of these nodes, computing \(R_v(\widehat{G_c})\) takes time O(V(G)). Thus each character requires time \(O(V(G)^2)\), and thus our algorithm solves the problem in \(O(\mathcal {C}V(G)^2)\). \(\square\)
The treecompletion problem
We now turn to the problem of predicting transfer locations on a given species tree. As mentioned in [44], species trees depict vertical inheritance and thus serve as basis for our networks, and HGT events can be seen as additional evolutionary events that happen on the way. This motivates the feasibility question: given a set of taxa \(\mathcal {S}\) and a species tree T on \(\mathcal {S}\), can we add transfer arcs to T so that the resulting network explains \(\mathcal {S}\)? Moreover, can we do this so that the resulting network is timeconsistent? One possibility is that a universal treebased network, which contains all phylogenetic trees on a given set of n leaves [56], could explain any set of characters. However, a base tree needs to be specified in our model, and it is not clear that such a choice always exists in a universal network.
Nevertheless, it turns out that there is no feasibility problem. Indeed, it is relatively easy to show that, for a set of taxa \(\mathcal {S}\), any tree T on \(\mathcal {S}\) can be complemented with transfers to become a PTN. One way to achieve this is to add a transfer edge between the parent edge of every pair of leaves, from which point it can be argued that the network is a PTN. In fact, we can show a stronger statement: if T is “prelabeled” in any way that acquired characters are never lost, then we can add transfers to T to explain \(\mathcal {S}\) while preserving the given prelabeling.
Formally, for a tree T, a \(\mathcal {C}\)labeling \(\lambda\) of T is called a noloss \(\mathcal {C}\)labeling if, for any edge \((u, v) \in E(T)\) and any \(c \in \mathcal {C}\), it holds that \(c \in l(u)\) implies \(c \in l(v)\). Recall that if G is a treebased network, then the base tree T of G is obtained by removing transfer arcs and suppressing subdivision nodes. Hence, \(V(T) \subseteq V(G)\), and we use \(V(G) \cap V(T)\) to explicitly refer to the nodes of G that are also in the base tree. We have the following problem.
The Prelabeled Tree Completion problem
Input. A set of taxa \(\mathcal {S}\) on characters \(\mathcal {C}\), a tree T with \(\mathcal {S}\)map \(\sigma\), and a noloss \(\mathcal {C}\)labeling \(\lambda\) of T such that \(\lambda (v) = \sigma (v)\) for each \(v \in L(T)\).
Output. A timeconsistent treebased network G such that T is the base tree of G, and a \(\mathcal {C}\)labeling l of G that explains \(\mathcal {S}\) and such that \(l(v) = \lambda (v)\) for every \(v \in V(G) \cap V(T)\).
We will now prove that this is always possible, even with the timeconsistency constraint.
One interest of allowing a prelabeling is that one can start with any hypothesis on where the characters appeared on a tree, and transfers can explain that hypothesis. Perhaps the most natural prelabeling is the Fitchlike labeling where, for each character c, we add c in every maximal subtree whose leaves have the character. To be more specific, if v is a leaf, \(\lambda (v) = \sigma (v)\) and otherwise, let u, w be the children of v, then \(\lambda (v) = \lambda (u) \cap \lambda (w)\). This corresponds to the reasonable hypothesis that characters always appear at maximal clades that have it, and we provide and algorithm that can explain this. Again, this is one example of a possible prelabeling, and our algorithm can explain any other that has the noloss property, even if characters are again after the lowest common ancestor of the leaves that have this character.
We define a transfer operation between two nodes u and v on a treebased network G. We write \(G\blacktriangle (u,v)\) to denote the treebased network obtained by subdividing the respective incoming edges of u and v in \(\mathcal {T}_{G}\), thereby creating new parent \(u'\) for u and \(v'\) for v, and adding the transfer edge \((u',v')\).
It is important to point out that in a noloss labeling, there can be multiple ancestral species that acquire a specific character that for the first time. In our algorithm, this property will also be maintained in the constructed network, and we will use the following notion:
Definition 7
Let G be a treebased network with a noloss \(\mathcal {C}\)labeling \(\lambda\). Let (u, v) be an edge of \(\mathcal {T}_{G}\). We will say that v is a firstappearance node for c under \(\lambda\) if it holds that \(u \in \overline{V_c}(l)\) and every descendant of v in \(\mathcal {T}_{G}\) belongs to \(V_c(l)\).
We may say firstappearance for c if \(\lambda\) is clear from the context. Note that if \(\lambda\) is a noloss labeling, a firstappearance node for c cannot have a firstappearance node for c as a descendant, and hence firstappearance nodes are pairwise incomparable.
We can now describe our algorithm. The first step is to make G a copy of the given tree T, and then we add transfer edges to G. Note that in our problem, the given tree has no time map, and deciding where to put the transfers on T in a timeconsistent manner becomes surprisingly complicated. For this reason, before adding any transfer, we start by constructing a time consistent map \(\tau\) for G. It is easy to do this in such a way that no two vertices have the same time.
From that point, we look at each character c and their set of firstappearance nodes \(a_1, \ldots , a_k\), ordered in decreasing order of age, and we greedily connect them using transfers. The \(\tau\) that we constructed dictates the order of connections, in the sense that each \(a_i\) is assumed to transfer c to the younger \(a_{i+1}\) node. This is achieved by finding a descendant of \(a_i\) that could have coexisted between \(a_{i+1}\) and its parent. The \(\tau\) map is also used to assign a time to the nodes created by transfers (Fig. 4).
Lemma 8
The network returned by Algorithm 2 is timeconsistent under the time map \(\tau\).
Proof
We argue that at any moment during the execution of the algorithm, \(\tau\) is a timeconsistent map of G. We prove this by induction on the number of iterations undertaken. Notice that as a base case, the statement is initially true before entering the main for loop. Now assume that we have inserted \(j  1\) transfer edges and that \(\tau\) is timeconsistent for G after these insertions. Consider the jth transfer edge inserted into G. This transfer edge is \((\hat{w}, \hat{a}_{i+1})\), which are created between w and its parent \(w'\) in the support tree \(T'\), and between \(a_{i+1}\) and its parent \(a'_{i+1}\) in \(T'\), respectively.
We first claim that \((w', w)\) as used in the algorithm exists in the subtree \(T(a_i)\), where \(a_i\) is the node that precedes \(a_{i+1}\) in \(X_c\). We know that \(\tau (a_i) \ge \tau (a_{i+1})\). Suppose that \(\tau (a_i) = \tau (a_{i+1})\). Let \(a_i'\) be the parent of \(a_i\), then by induction hypotesis, since the network is time consistent we have that \(\tau (a_i') > \tau (a_i) = \tau (a_{i+1})\) and so \(w' = a_i'\) and \(w = a_i\). In this case, we do have \(\tau (w') > \tau (a_{i+1})\) and \(\tau (w) \le \tau (a_{i+1})\). Now, suppose that \(\tau (a_i) > \tau (a_{i+1})\). Note that we can always order the vertices of \(T(a_i)\) with respect to \(\tau\) in such a way that \(\tau (a_i) \ge v\) for all \(v \in V(T(a_i))\). By induction hypothesis, every time we pick a descendant y of \(a_i\), \(\tau (y) < \tau (a_i)\), so w can be found by iteratively following the descendants of \(a_i\) and choosing the first one whose time is at most \(\tau (a_{i+1})\) (which exists since all leaves have the same timing).
Note that by adding the transfer edge \((\hat{w}, \hat{a}_{i+1})\), the times \(\tau\) of every edge have remained unchanged and still satisfy the timeconsistency definition, with the exception of the edges linking \(w', \hat{w}\), and w, those linking \(a'_{i+1}, \hat{a}_{i+1}\), and \(a_{i+1}\), as well as the new transfer edge. Since \(\tau (\hat{w}) = \tau (\hat{a}_{i+1})\) is made explicit on line 16, to conclude the proof it suffices to show that \(\tau (w')> \tau (\hat{w}) > \tau (w)\) and that \(\tau (a'_{i+1})> \tau (\hat{a}_{i+1}) > \tau (a_{i+1})\). By induction we know that \(\tau (w') > \tau (w)\) and that \(\tau (a'_{i+1}) > \tau (a_{i+1})\) (this holds before and after the transfer insertion because they were not changed). Using these inequalities we have that:
since \(\min (\tau (w'), \tau (a'_{i+1})) \le \tau (w')\) and \(\tau (a_{i+1}) < \tau (w')\) both hold. Note that it is also true that
since \(\min (\tau (w'), \tau (a'_{i+1})) > \tau (a_{i+1})\) (because \(\tau (w') > \tau (a_{i+1})\) and \(\tau (a'_{i+1}) > \tau (a_{i+1})\) both hold). Using the same arguments, we have
and
\(\square\)
Lemma 9
Let G and l be the network and \(\mathcal {C}\)labeling returned by Algorithm 2, respectively, on input \(T, \mathcal {S}\), and \(\lambda\). Then T is the base tree of G. Furthermore, l explains \(\mathcal {S}\) and satisfies \(l(v) = \lambda (v)\) for every \(v \in V(G) \cap V(T)\).
Proof
Let \(G = (V, E_S \cup E_T)\) be the network returned by the algorithm and let l be the returned labeling. To see that \(l(v) = \lambda (v)\) for every node v in the base tree, it suffices to note that the algorithm never changes the labeling of a node initially present in T: it only assigns sets of characters to nodes created by transfer insertion operations. It is also easy to see that T is the base tree of G, since we start with a copy of T and only attach transfer edges to it.
We will argue that the returned \(\mathcal {C}\)labeling l explains \(\mathcal {S}\) using the conditions required by Definition 1. First, by requirement on the input \(\lambda\), we know that for every \(v \in L(G)\), \(l(v) = \lambda (v) = \sigma (v)\).
Let us next show that for every character \(c \in \mathcal {C}\) there exists a unique node \(v \in V_c(l)\) that reaches every node in \(G[V_c(l)]\). It is not hard to see that after handling a particular \(c \in \mathcal {C}\) in the algorithm, this property will be satisfied for \(V_c(l)\). However, it is not obvious that the subsequent iterations on other characters will not “break” this property for c. We thus prove the following statement. Assume that the algorithm handles the characters of \(\mathcal {C}\) in order \(c_1, \ldots , c_m\) in the main while loop. Then we claim that in the network G obtained after finishing the ith iteration and handling \(c_1, c_2, \ldots , c_i\), for every \(j \le i\), there exists a unique node \(v \in V_{c_j}(l)\) that reaches every node in \(G[V_{c_j}(l)]\). This shows the desired property since it will hold for \(j = m\), i.e. for every character. As a base case, consider \(i = 0\). Then it is true that for \(j \le i\), the desired node v exists (because there is no \(c_j\) to satisfy). Now, assume that \(i > 0\) and that before entering the ith iteration, the statement holds for every \(c_j\) with \(j \le i  1\).
After we are done handling \(c_i\) on the \(i\)th iteration we know that there exists a vertex \(a_1 \in X_{c_i}\) such that \(\tau (a_1) \ge \tau (a_h)\) for all \(a_h \in X_{c_i}\). In particular, when equality holds for some \(a_h\), it must be that \(\tau (a_1) = \tau (a_2)\). In this case, when the algorithm iterates on \(a_1\), we get \((w', w) = (a'_1, a_1)\) and the corresponding transformation yields \(G\blacktriangle (a_1,a_2)\). In this case, we claim that the vertex \(\hat{a}_1\) created by the subdivision of the edge \((a_1',a_1) \in E_s\) will remain as the unique source for \(V_{c_i}(l)\). To see this first note that \(a_1\) has no incoming edge from \(V_c(l)\) at the start of the iteration, because if that was not the case then \(c \in l(a_1')\) and so \(a_1\) would not have been a firstappearance node in the first place. This in turn implies that \(\hat{a}_1\) has no incoming edge after the ith iteration, since all other transfer heads are added above \(a_2, \ldots , a_k\). Additionally, \(\hat{a}_1\) will become the firstappearance node for its corresponding subtree. After applying \(G\blacktriangle (a_1,a_2)\), \(\hat{a}_1\) now reaches the new parent \(\hat{a}_2\) of \(a_2\) and all its descendants in \(\mathcal {T}_{G}\). Subsequently, we will now choose a descendant w of \(a_2\) from which we will add a new transfer to the parent node \(\hat{a}_3\) of \(a_3\). In this way, \(\hat{a}_1\) will also reach \(a_3\) and all of its descendants. We will continue adding transfer operations in this way so that finally \(\hat{a}_1\) will be able to reach the last vertex of \(X_{c_j}\), \(a_k\) and all of its descendants. Note that any node of \(V_{c_i}(l)\) is reachable by an element of \(A_{c_i}\), thus after the \(i\)th iteration \(\hat{a}_1\) reaches every node in the \(G[V_{c_i}(l)]\) subgraph.
On the other hand, when we have the strict inequality, i.e. when \(\tau (a_1) > \tau (a_2)\), then the first chosen w is distinct from \(a_1\), and using the same arguments, we see that \(a_1\) is the unique origin for \(V_{c_i}(l)\).
We must also argue that the ith iteration does not “break” a \(c_j\) with \(j < i\). Consider such a \(c_j\). By induction, before the ith iteration, \(G[V_{c_j}(l)]\) had a unique origin v. Suppose that during the \(i\)th iteration of the main loop we created some transformation \(G\blacktriangle (w,a_h)\) after which some node, say z, that possesses \(c_j\) cannot be reached by v in the transformed graph. Let \(w', a'_h\) be the parents of w and \(a_h\), respectively, before the addition of the transfer. Also let \(\hat{w}\) and \(\hat{a}_h\) be the nodes which were created by this transformation.
First assume that \(z = \hat{w}\). Then \(c_j \notin l(w')\), as otherwise if \(c_j \in l(w')\), by induction, v would reach \(w'\) and thus also reach \(\hat{w} = z\). But because \(c_j \notin l(w')\), \(c_j \notin l(w') \cap l(w)\) and so the algorithm would not have put \(c_j\) in \(\hat{w} = z\), a contradiction. By the same argument, \(z \ne \hat{a}_h\). Thus, z was present in G before the insertion of the transfer.
Next, assume that \(c_j \notin l(\hat{w})\) and \(c_j \notin l(\hat{a}_h)\). If v cannot reach z anymore, every path from v to z in \(G[V_{c_j}(l)]\) must have been going through \((w', w)\) or \((a'_h, a_h)\) before the transfer insertion. But then, \(c_j \in l(w') \cap l(w)\) and \(c_j \in l(a'_h) \cap l(a_h)\), and the algorithm would have put \(c_j \in l(\hat{w})\) and \(c_j \in l(\hat{a}_h)\), a contradiction.
Then either \(c_j \in l(\hat{w})\), \(c_j \in l(\hat{a}_h)\) or \(c_j \in l(\hat{w}) \cap l(\hat{a}_g)\). Assume \(c_j \in l(\hat{w})\). By line 15, we know that this would only be possible if \(c_j \in l(w')\cap l(w)\). So any path from v to z in \(V_{c_j}(l)\) that used the \((w', w)\) edge can now use the edges \((w', \hat{w}), (\hat{w}, w)\) to reach z. If \(c_j \in l(\hat{a}_h)\) as well, the same idea applies, and we get that any path from v to z is still usable, albeit with either \(\hat{w}\) or \(\hat{a}_h\) as an additional vertex. So it must be that \(c_j \notin l(\hat{a}_h)\), and that all paths used \((a'_h, a_h)\). As before, this means that \(c_j \in l(a'_h) \cap l(a_h)\) and that we should have \(c_j \in l(\hat{a}_h)\), a contradiction. This covers the case \(c_j \in l(\hat{w})\). The case \(c_j \in l(\hat{a}_h)\) can be handled in the same manner.
We then show that for each support edge \((u,v) \in E_S, c \in l(u)\) implies that \(c \in l(v)\). We argue that this property holds before and after any transfer edge is inserted. Notice that initially, when G is just a copy of T and l a copy of \(\lambda\), \(c \in l(u)\) implies \(c \in l(v)\) because \(\lambda\) is a noloss labeling. Now suppose inductively that the property holds before we insert some transfer \((\hat{w}, \hat{a}_{i+1})\) by line 13. It suffices to argue that the property holds on the support edges \((w', \hat{w}), (\hat{w}, w), (a'_{i+1}, \hat{a}_{i+1})\), and \((\hat{a}_{i+1}, a_{i+1})\), as defined in the algorithm, because no other support edge is modified. Let \(c' \in l(w')\) (we distinguish \(c'\) from c, the latter being the c the algorithm is currently iterating on). Then by assumption that the property held before the transfer addition, we must have \(c' \in l(w)\) and, because \(c' \in l(w) \cap l(w')\), \(c'\) will be added to \(l(\hat{w})\), as desired. The same argument holds for \(c' \in l(a'_{i+1})\) and the fact that \(c' \in l(\hat{a}_{i+1})\). Now let \(c' \in l(\hat{w})\). We want to argue that \(c' \in l(w)\). If \(c' \in l(w')\), then again by assumption we have \(c' \in l(w)\) as well and our property holds. So suppose that \(c' \notin l(w')\). The algorithm puts \(l(\hat{w}) = (l(w) \cap l(w')) \cup \{c\}\) where c is the character of the current iteration, which means that only \(c = c'\) is possible. Notice that the algorithm chooses the edge \((w, w')\) in the subtree \(\mathcal {T}_{G}(a'_i)\), where \(a'_i\) has child \(a_i\) that is a firstappearance node for c. By assumption, every descendant of \(a_i\) in the support tree possesses c, so only \(w' = a'_i\) is possible. Thus \(w = a_i\) and \(c \in l(a_i) = l(w)\), as desired. Finally, let \(c' \in l(\hat{a}_{i+1})\). If \(c' \in a'_{i+1}\), by assumption \(c' \in l(a_{i+1})\) and we are done. Otherwise, as the previous case we must have \(c' = c\) and, since \(a_{i+1}\) is a firstappearance for c, we have \(c \in l(a_{i+1})\) as desired. \(\square\)
Theorem 10
Algorithm 2 solves the Prelabeled Tree Completion problem correctly in time \(O(\mathcal {C}^2\mathcal {S} + \mathcal {C}\mathcal {S}^2)\).
Proof
By Lemma 8, the network G output by the algorithm has T as its base tree and is timeconsistent. Then by Lemma 9, the output labeling l preserves the prelabeling \(\lambda\) and explains \(\mathcal {S}\). Thus, the output is correct.
As for the running time, the complexity is dominated by the main while loop over \(c \in \mathcal {C}\). Note that firstappearance nodes partition the leaves of \(G[V_c(l)]\), and so each \(A_c\) has at most \(\mathcal {S}\) elements and, for each c we add at most \(\mathcal {S}\) transfers. It follows that the final network G output by the algorithm has at most \(O(\mathcal {C}\mathcal {S} + V(T))\) nodes. Let us denote \(n = V(G) \le \mathcal {C}\mathcal {S} + V(T)\). For a given \(c \in \mathcal {C}\), computing the firstappearance nodes can be done in time O(n) and sorting them takes time \(O(n \log n)\). Then for each of the O(n) nodes in \(X_c\), we must find a descendant w in time O(n). The other operations take constant time. Thus, each iteration of the main loop takes time \(O(n \log n + n^2) = O(n^2)\). This is repeated \(O(\mathcal {C})\) times, and thus the complexity is \(O(\mathcal {C}n^2) = O(\mathcal {C} \cdot (\mathcal {C}\mathcal {S} + V(T)))\). The claimed complexity follows from \(V(T) \in O(\mathcal {S})\) since T is a tree on leafset \(\mathcal {S}\). \(\square\)
On minimizing the number of transfers in a completion
We have shown that any tree whose leaves are mapped to \(\mathcal {S}\) can explain \(\mathcal {S}\). The tree completion therefore becomes more interesting in the minimization variant:
The Minimum Perfect Transfer Completion problem
Input. A set of taxa \(\mathcal {S}\) on characters \(\mathcal {C}\), a tree T with \(\mathcal {S}\)map \(\sigma\).
Output. A PTN \((G, \sigma )\) for \(\mathcal {S}\) whose base tree is T that contains a minimum number of transfer edges.
Note that the above problem does not impose a prelabeling of T. However, one such labeling \(\lambda\) that is natural is the one where maximal subtree containing a character are assigned that character, which we call the Fitch labeling.
Definition 11
Let T be a tree with \(\mathcal {S}\)map \(\sigma\), where \(\mathcal {S}\) are on characters \(\mathcal {C}\). The Fitchlabeling of T is the labeling \(\lambda\) of T such that, for each \(c \in \mathcal {C}\), we put \(c \in \lambda (v)\) if and only if all leaves descending from v contain c.
The Fitchlabeling can be combined with Algorithm 2 to obtain basic bounds on the number of transfers required.
Proposition 12
Let T be a tree with \(\mathcal {S}\)map \(\sigma\), where \(\mathcal {S}\) is on characters \(\mathcal {C}\). Let \(\lambda\) be the Fitch labeling for T, and for \(c \in \mathcal {C}\), let \(A_c\) be the set of firstappearance nodes of c under \(\lambda\). Then

any PTN for \(\mathcal {S}\) with base tree is T requires at least \(\max _{c \in \mathcal {C}} (A_c  1)\) transfer edges;

there exists a PTN for \(\mathcal {S}\) with base tree T with at most \(\sum _{c \in \mathcal {C}} (A_c  1)\) transfer edges. Moreover, Algorithm 2 returns such a PTN when given prelabeling \(\lambda\).
Proof
Let \((G, \sigma )\) be a PTN for \(\mathcal {S}\) with base tree T. Let \(c \in \mathcal {C}\) be such that the number of firstappearance nodes in \(A_c\) is maximum. Notice that all nodes of \(V(G) \cap V(T)\) that do not descend from a firstappearance node in \(A_c\) cannot contain c in any labeling of G by Lemma 4 (since they have a descendant not possessing c, such a node is in \(F_c\)). Therefore, any solution for T must add at least \(A_c  1\) transfers to T to be able to connect the firstappearance subtrees. Thus G requires at least \(A_c  1\) transfers.
Now consider the output of Algorithm 2 on prelabeling \(\lambda\). For each \(c \in \mathcal {C}\), the algorithm adds at most \(A_c  1\) transfer arcs when it considers c in its while loop (noting that the number of firstappearance nodes for c never increases in the algorithm). By Theorem 10, the algorithm correctly returns a PTN, which has at most \(\sum _{c \in \mathcal {C}}(A_c  1)\) transfers. \(\square\)
Corollary 13
Suppose that Algorithm 2 is given \(T, \mathcal {S}\), and the Fitchlabeling \(\lambda\). Then it is a \(\mathcal {C}\)approximation, i.e. it outputs a PTN with at most \(\mathcal {C}\) times more transfers than an optimal solution.
Proof
Using the notation of Proposition 12, it states that an optimal PTN needs at least \(A_c  1\), and Algorithm 2 adds at most \(\mathcal {C}(A_c  1)\) transfers. \(\square\)
Do note that Algorithm 2 does not always output an optimal solution to the Minimum Perfect Transfer Completion problem. To see that Algorithm 2 can be suboptimal, consider Fig. 5 and the explanation in the caption.
The cases in which Algorithm 2 is suboptimal appear to have a common cause. The algorithm tends to add transfers as high as possible in the tree, whereas the optmal solution would add more transfers lower in the tree, but with the advantage of being reusable by more characters. For instance in Fig. 5, a is greedily transferred by itself and two more separate transfers are required for b, whereas the optimal solution reuses the same transfers for both a and b. It appears difficult to determine when to add more transfers lower and when not to, which leads us conjecture that the Minimum Perfect Transfer Completion is NPhard.
We must reckon that a \(\mathcal {C}\)approximation is far from interesting. We conclude by suggesting a candidate approximation algorithm that combines both algorithms presented here. Suppose that, given T and Fitchlabeling \(\lambda\), we obtain G and l from Algorithm 2. A simple heuristic postprocessing step can then be applied to detect unneeded transfers. That is, for each transfer edge (u, v) of G, consider the network \(G  (u, v)\) obtained by removing (u, v) and the resulting subdivision nodes. Then, run Algorithm 1 to check if \(G  (u, v)\) is a PTN for \(\mathcal {S}\). If so, we know that (u, v) can safely be removed and we repeat. We try every such transfer edge until all of them are necessary. With this modified algorithm, we were unable to generate instances with more than twice as many transfers as the optimal solution. This suggests that it might not be far from optimal. We conjecture that Algorithm 2, combined with the above postprocessing step, achieves a constant factor approximation.
The PTN reconstruction problem
We now study the variant in which only \(\mathcal {S}\) and \(\mathcal {C}\) are known, and no tree is given. Note that by Theorem 10, there is no feasibility problem, since a solution always exists. That is, we can take any tree T with any \(\mathcal {S}\)map \(\sigma\), run Algorithm 2 using the Fitchlabeling, and obtain a PTN for \(\mathcal {S}\). The minimization variant has more appeal.
The Minimum Perfect Transfer Reconstruction problem
Input. A set of taxa \(\mathcal {S}\) on characters \(\mathcal {C}\);
Output. A PTN \((G, \sigma )\) for \(\mathcal {S}\) with a minimum number of transfer edges.
This does not appear to be an easy algorithmic problem. Proposition 12 suggests a (seemingly) simple approach: find a tree that minimizes the total number of firstappearance nodes, over all characters. This does not guarantee that the resulting network will minimize transfers, and even finding a tree that minimizes the number of firstappearance nodes appears hard to find. We conjecture that both problems are NPhard, i.e. finding a PTN \((G, \sigma )\) for \(\mathcal {S}\) with a minimum number of transfers, and finding a tree with \(\mathcal {S}\)map \(\sigma\) with a minimum number of firstappearance nodes.
In the following, we instead focus on providing bounds on the number of transfers required if \(k:= \mathcal {C}\) characters are present, in the worst case. It should be intuitive that the taxa set that will require the most transfers is when \(\mathcal {S}= 2^{\mathcal {C}}\), i.e. \(\mathcal {S}\) is the power set of \(\mathcal {C}\). When this is the case, we show that, up to a linear factor, an exponential number of transfers (with respect to k) is required and sufficient.
Lemma 14
Any set of taxa \(\mathcal {S}\) on a character set \(\mathcal {C}\) of k characters can be explained by a treebased network G that has at most \(2^k  (k1)\) transfers.
Proof
Let \(\mathcal {S}\) be a set of taxa on characters \(\mathcal {C}= \{c_1, c_2, \ldots , c_k\}\). We will assume that no two elements of \(\mathcal {S}\) are identical (as two identical taxa can use the same transfers). We will further assume that \(\mathcal {S}= 2^{\mathcal {C}}\) contains every subset of \(\mathcal {C}\). Note that if we can explain \(\mathcal {S}\) with at most \(2^k  (k  1)\) transfers, then we can explain any \(\mathcal {S}' \subseteq \mathcal {S}\) with at most that many transfers. We will first show how to construct a base tree T for G from which we will then derive G. Let T be a rooted complete binary tree with exactly \(2^k\) leaves and root \(\rho\). Let \(l_b:V(T) \rightarrow \{0,1\}\) be a labeling such that for every inner node \(u \in V(T)\) with v, w as children we have that \(l_b(v) = 0\) and \(l_b(w) = 1\) (the label of the root is not important). For an example of this construction, see Fig. 6.
Let \(\mathcal {L} = \{L_1, L_2, \dots , L_k\}\) be a partition of \(V(T) \setminus \{\rho \}\) such that a vertex \(u \in L_i\) with \(i \in [k]\) if and only if the unique path from u to the root contains exactly i edges. We will call each \(L_i\) a level of T.
Consider the \(\mathcal {C}\)labeling l such that, for each \(i \in [k]\) and \(u \in L_i\) with \(l_b(u) = 1\), u is a firstappearance of \(c_i\). Note that such a \(\mathcal {C}\)labeling can be achieved by adding character \(c_i\) to each node descending from every such u, and not adding \(c_i\) to any other node. For each \(c_i \in \mathcal {C}\), we denote by \(A_i\) its set of firstappearance nodes under l. Notice that \(A_i = 2^{i1}\), since \(L_i\) has exactly \(2^i\) nodes and, by definition, there exist \(2^{i1}\) nodes labeled as 1.
We argue that under l, the leaves of T are in bijection with \(\mathcal {S}\), and that l can serve as the \(\mathcal {S}\)map for T. There are \(2^k = \mathcal {S}\) leaves, so it suffices to show that for any distinct \(u, v \in L(T)\), \(l(u) \ne l(v)\). Let \(z = {{\,\textrm{lca}\,}}_T(u, v)\) and let \(z_1, z_2\) be the two children of z. Note that \(z_1, z_2\) are in the same level, say \(L_i\) for some \(i \in [k]\). Moreover, \(l_b(z_1) \ne l_b(z_2)\), implying that one of u has \(c_i\) and the other does not. Then \(l(u) \ne l(v)\).
Finally, we will create a set of transfer edges \(E_T\) for T in the following way: we use Algorithm 2 and give it l as a prelabeling.
Recall that for each character \(c_i\), the algorithm adds at most \(A_i  1 = 2^{i1}  1\) transfer edges. Since \(2^{i1}  1\) transfers will be added to T per level \(L_i\) with \(i \in \{1, 2, \ldots , k\}\), this results in at most
added transfers. \(\square\)
Lemma 15
Let \(\mathcal {C}\) be a set of k characters. Then there exists a set of taxa \(\mathcal {S}\) on characters \(\mathcal {C}\) such that any PTN for \(\mathcal {S}\) has at least \(2^k/(3k)  1\) transfer edges.
Proof
Let \(\mathcal {S}= 2^{\mathcal {C}}\) be the power set of \(\mathcal {C}\). Let \((G, \sigma )\) be a PTN for \(\mathcal {S}\) and let T be the base tree of G. Let \(\lambda\) be Fitchlabeling of T. In what follows, all firstappearance nodes of T are assumed to be with respect to \(\lambda\).
Let A(T) be the set of nodes of T that are a firstappearance node of at least one character of \(\mathcal {C}\). We argue that \(A(T) \ge 2^k/3\). To achieve this, we describe a partial injective function \(f: L(T) \rightarrow A(T)\) that maps some leaves of T to a firstappearance node. By partial injective function, we mean that perhaps not all leaves are mapped, but no two mapped leaves map to the same node. A cherry of T is a pair of leaves that have the same parent. A noncherry leaf is a leaf that is not in a cherry. Note that since L(T) is in bijection with \(\mathcal {S}\) we will refer to the leaves of T as taxa, with the understanding that leaves are subsets of \(\mathcal {C}\).
First let x, y be leaves that form a cherry in T. Then since all taxa are distinct, x, y disagree on at least one character c, and hence one of x or y is a firstappearance node of c, let us say x without loss of generality. Then we put \(f(x) = x\) (and leave f(y) undefined). Now let \(N'\) be the set of noncherry leaves of T. For each \(x \in N'\) such that x is a firstappearance node for some character, put \(f(x) = x\).
Next let \(N = N' \setminus A(T)\), i.e. N contains noncherry leaves that are not a firstappearance node, for any character. For \(x \in N\), denote by \(p_x\) the parent of x in T. Let us denote the set of nodes \(\{p_x: x \in N\}\) as marked nodes. For two distinct marked nodes \(p_x, p_y\), we say that \(p_y\) is a closest marked descendant of \(p_x\) if \(p_y \prec p_x\) and there is no marked node on the path between \(p_x\) and \(p_y\), except \(p_x\) and \(p_y\) themselves. Suppose that \(x \in N\) is such that \(p_x\) has at least one closest marked descendant, say \(p_y\). We argue that there is a firstappearance node z satisfying \(p_y \preceq z \prec p_x\). This situation is illustrated in Fig. 7.
To see this, notice that \(p_x\) is marked because x is not a firstappearance. This means that for every c in x, all descending leaves of \(p_x\) contain c. This includes y, and so \(x \subseteq y\). Since x and y have distinct characters, there must be a character \(c'\) such that \(c'\) is in y but \(c'\) is not in x. Since y is not a firstappearance of \(c'\), all descendants of \(p_y\) have \(c'\). Hence, there is a firstappearance node z of \(c'\) that is an ancestor of \(p_y\), but a strict descendant of \(p_x\) (because not all descendants of \(p_x\) have \(c'\)). We put \(f(x) = z\). Note that there may be multiple choices for z, in which case we choose arbitrarily. The important property is that whichever choice is made, z is a strict descendant of \(p_x\), and not a strict descendant of any marked \(p_y \prec p_x\). This completes the description of f.
Suppose that \(p_x, p_{x'}\) are distinct marked nodes that both have a closest marked descendant. Notice that f(x) and \(f(x')\) must be distinct. Indeed, if \(p_x\) and \(p_{x'}\) are incomparable, this is obvious since f(x) and \(f(x')\) are strict descendants of \(p_x\) and \(p_{x'}\), respectively. If instead \(p_x \prec p_{x'}\), then f(x) is a strict descendant of \(p_x\), whereas \(f(x')\) is either a closest marked descendant of \(p_{x'}\), or an ancestor of one of those nodes, implying that \(f(x')\) cannot be a strict descendant of \(p_x\). One can thus see that f is injective, since it either maps leaves to themselves, or children of marked nodes to distinct internal nodes.
Now consider the set of leaves \(x \in N\) such that \(p_x\) has no marked descendants. Note that all these marked \(p_x\) nodes are pairwise incomparable. Moreover, any such \(p_x\) has a leaf child x, and another child with at least two leaves (if the other child was a single leaf, \(p_x\) would form a cherry and x would not be in \(N'\)). Since any tree with at least two leaves has a cherry, \(p_x\) has a descending cherry, and in fact each \(p_x\) is the ancestor of a distinct cherry. It follows that the number of \(p_x\) with no marked descendant is at most the number of cherries.
We can finally relate the number of firstappearances to the number of taxa as follows. Let C be the number of cherries of T; let \(N_A\) be the number of noncherry leaves that are firstappearances; let \(N_M\) be the number of leaves in N whose parent has a marked descendant; and let \(N_X\) be the number of leaves in N whose parent has no marked descendant. Then
and, owing to our partial injection f,
We have argued just above that \(N_X \le C\), and so we can infer the chain of inequalities
and we get \(A(T) \ge L(T)/3 = 2^{k}/3\).
Each node of A(T) is a firstappearance of some \(c \in \mathcal {C}\). Therefore, by the generalized pigeonhole principle, some character c of \(\mathcal {C}\) must have at least \(A(T)/\mathcal {C} \ge 2^{k}/(3k)\) firstappearance nodes in T. By Proposition 12, at least that many transfers, minus 1, need to be added to T to explain \(\mathcal {S}\). \(\square\)
Open problems
We conclude this section with some open problems regarding all problems mentioned in this paper.

Our algorithm for the recognition problem takes time \(O(\mathcal {C}V(G)^2)\). Can this be improved to \(O(\mathcal {C}V(G))\), or even \(O(\mathcal {C} + V(G))\)?

Is the minimum tree completion problem NPhard?

Does the greedy Algorithm 2 achieve a constant factor approximation, with the postprocessing mentioned in the tree completion section?

Is the minimum perfect transfer reconstruction NPhard?

Suppose that the taxa set is \(\mathcal {S}= 2^{\mathcal {C}}\) for characters \(\mathcal {C}\). Then what exactly is the minimum number of transfers of a PTN for \(\mathcal {S}\)?

How can our model be extended to characters with multiple states? And would the underlying recognition problem be easy?
Conclusion
In this contribution, we have introduced perfect transfer networks (PTNs) as a model that aims to combine the structural properties of treebased networks with the classical notion of perfect characters. In the absence of HGT events, PTNs coincide with the notion of perfect phylogenies. To better understand these, we studied their properties, stated the main differences between them and recombination networks as well as perfect phylogeny networks which is to our knowledge the closest model related to ours. Additionally, we explored several algorithmic challenges that result from this model with potential applications for HGT inference methods using characterbased information that does not rely on sequence similarities. To the best of our knowledge, this is the initial theoretical endeavor employing the “once acquired never lost” principle through treebased networks for inferring HGT events. While we acknowledge the simplicity of this model, it represents an initial stride towards incorporating additional conditions. Our intention is to develop more intricate models that better align with the complexity of biological systems.
Although widely used throughout the literature, perfect characters impose strong restrictions for our model, since each character is allowed to change of state at most once. A potential extension of our model would be to include different models for character state changes as in Dollo parsimony [57]. This model allows losing an acquired character but not gaining it twice. This assumption has been shown to be more suitable for complex characters such as restriction sites and introns [55]. Another possible extension of our model would be to include expression levels of the different characters instead of discrete changes which is a problem similar to that of multistate perfect phylogenies [58].
Several other questions seem to be appealing for future work. Most importantly, since finding experimental datasets that use gene expression seems like a challenging task, the generation of insilico datasets to test our algorithms seems to be a pertinent solution. Nevertheless, to our knowledge there is no simulation framework that combines evolutionary histories with gene expression data. Therefore, a future direction for this project could also be the design of a simulation environment that is able to generate this type of data.
Availability of data and materials
not applicable.
References
Koonin EV, Makarova KS, Aravind L. Horizontal gene transfer in prokaryotes: quantification and classification. Ann Rev Microbiol. 2001;55(1):709–42.
Thomas CM, Nielsen KM. Mechanisms of, and barriers to, horizontal gene transfer between bacteria. Nat Rev Microbiol. 2005;3(9):711–21.
Keeling PJ, Palmer JD. Horizontal gene transfer in eukaryotic evolution. Nat Rev Genet. 2008;9(8):605–18.
Hotopp JCD. Horizontal gene transfer between bacteria and animals. Trends Genet. 2011;27(4):157–63.
Irwin NA, Pittis AA, Richards TA, Keeling PJ. Systematic evaluation of horizontal gene transfer between eukaryotes and viruses. Nat Microbiol. 2022;7(2):327–36.
Anselmetti Y, ElMabrouk N, Lafond M, Ouangraoua A. Gene tree and species tree reconciliation with endosymbiotic gene transfer. Bioinformatics. 2021;37:120–32.
TrejoBecerril C, PérezCárdenas E, TajaChayeb L, Anker P, HerreraGoepfert R, MedinaVelázquez LA, HidalgoMiranda A, PérezMontiel D, ChávezBlanco A, CruzVelázquez J, et al. Cancer progression mediated by horizontal gene transfer in an in vivo model. PloS ONE. 2012;7(12):52754.
Ravenhall M, Škunca N, Lassalle F, Dessimoz C. Inferring horizontal gene transfer. PLoS Comput Biol. 2015;11(5):1004095.
Bansal MS, Alm EJ, Kellis M. Efficient algorithms for the reconciliation problem with gene duplication, horizontal transfer and loss. Bioinformatics. 2012;28(12):283–91.
Doyon JP, Scornavacca C, Gorbunov KY, Szöllősi GJ, Ranwez V, Berry V. An efficient algorithm for gene/species trees parsimonious reconciliation with losses, duplications and transfers. In: RECOMB International Workshop on Comparative Genomics. Springer; 2010. 93–108.
Hellmuth M, Huber KT, Moulton V. Reconciling eventlabeled gene trees with multrees and species networks. J Math Biol. 2019;79(5):1885–925.
Delabre M, ElMabrouk N, Huber KT, Lafond M, Moulton V, Noutahi E, Castellanos MS. Evolution through segmental duplications and losses: a superreconciliation approach. Algorithm Mol Biol. 2020;15(1):1–15.
Tofigh A, Hallett M, Lagergren J. Simultaneous identification of duplications and lateral gene transfers. IEEE/ACM Trans Comput Biol Bioinform. 2010;8(2):517–35.
Kordi M, Bansal MS. On the complexity of duplicationtransferloss reconciliation with nonbinary gene trees. IEEE/ACM Trans Comput Biol Bioinform. 2015;14(3):587–99.
Jacox E, Weller M, Tannier E, Scornavacca C. Resolution and reconciliation of nonbinary gene trees with transfers, duplications and losses. Bioinformatics. 2017;33(7):980–7.
Schaller D, Lafond M, Stadler PF, Wieseke N, Hellmuth M. Indirect identification of horizontal gene transfer. J Math Biol. 2021;83(1):1–73.
Geiß M, Anders J, Stadler PF, Wieseke N, Hellmuth M. Reconstructing gene trees from fitch’s xenology relation. J Math Biol. 2018;77(5):1459–91.
Hellmuth M, Seemann CR, Stadler PF. Generalized fitch graphs II: sets of binary relations that are explained by edgelabeled trees. Discret Appl Math. 2020;283:495–511.
Lafond M, Hellmuth M. Reconstruction of timeconsistent species trees. Algorithm Mol Biol. 2020;15(1):1–27.
Jones M, Lafond M, Scornavacca C. Consistency of orthology and paralogy constraints in the presence of gene transfers. Peer Community in Mathematical and Computational Biology. 2012.
Boto L. Horizontal gene transfer in evolution: facts and challenges. Proc Royal Soc B Biol Sci. 2010;277(1683):819–27.
De Jong G. Phenotypic plasticity as a product of selection in a variable environment. Am Nat. 1995;145(4):493–512.
Rawat A, Seifert GJ, Deng Y. Novel implementation of conditional coregulation by graph theory to derive coexpressed genes from microarray data. BMC Bioinform. 2008. https://doi.org/10.1186/147121059S9S7.
Pontes B, Giráldez R, AguilarRuiz JS. Configurable patternbased evolutionary biclustering of gene expression data. Algorithm Mol Biol. 2013;8(1):1–22.
Alexander PA, He Y, Chen Y, Orban J, Bryan PN. The design and characterization of two proteins with 88% sequence identity but different structure and function. Proc Natl Acad Sci. 2007;104(29):11963–8.
Bodlaender HL, Fellows MR, Warnow TJ. Two strikes against perfect phylogeny. In: Kuich W, editor. International colloquium on automata, languages, and programming. Berlin: Springer; 1992. p. 273–83.
FernándezBaca D. The perfect phylogeny problem. In: Cheng X, Du DZ, editors. Steiner trees in industry. Berlin: Springer; 2001. p. 203–34.
Bafna V, Gusfield D, Lancia G, Yooseph S. Haplotyping as perfect phylogeny: a direct approach. J Comput Biol. 2003;10(3–4):323–40.
Iersel LV, Jones M, Kelk S. A third strike against perfect phylogeny. Syst Biol. 2019;68(5):814–27.
Della Vedova G, Patterson M, Rizzi R, Soto M. Characterbased phylogeny construction and its application to tumor evolution. In: Conference on Computability in Europe. Springer; 2017.3–13.
Pradhan D, ElKebir M. On the nonuniqueness of solutions to the perfect phylogeny mixture problem. In: RECOMB International Conference on Comparative Genomics. Springer; 2018. 277–293.
Malikic S, Mehrabadi FR, Ciccolella S, Rahman MK, Ricketts C, Haghshenas E, Seidman D, Hach F, Hajirasouliha I, Sahinalp SC. Phiscs: a combinatorial approach for subperfect tumor phylogeny reconstruction via integrative use of singlecell and bulk sequencing data. Genome Res. 2019;29(11):1860–77.
Sashittal P, Zaccaria S, ElKebir M. Parsimonious clone tree reconciliation in cancer. In: Leibniz International Proceedings in Informatics, LIPIcs. Schloss Dagstuhl–LeibnizZentrum für Informatik; 2021. 201:9
Wang L, Zhang K, Zhang L. Perfect phylogenetic networks with recombination. J Comput Biol. 2001;8(1):69–78.
Gusfield D, Eddhu S, Langley C. Optimal, efficient reconstruction of phylogenetic networks with constrained recombination. J Bioinform Comput Biol. 2004;2(01):173–213.
Gusfield D. ReCombinatorics: the algorithmics of ancestral recombination graphs and explicit phylogenetic networks. Cambridge: MIT press; 2014.
Nakhleh L, Ringe D, Warnow T. Perfect phylogenetic networks: a new methodology for reconstructing the evolutionary history of natural languages. Language. 2005;81(2):382–420.
Nakhleh L. Phylogenetic networks. PhD thesis, The University of Texas at Austin. 2004.
Francis AR, Steel M. Which phylogenetic networks are merely trees with additional arcs? Syst Biol. 2015;64(5):768–77.
Pons JC, Semple C, Steel M. Treebased networks: characterisations, metrics, and support trees. J Math Biol. 2019;78(4):899–918.
van Iersel L, Semple C, Steel M. Quantifying the extent of lateral gene transfer required to avert a genome of eden. Bull Math Biol. 2010;72:1783–98.
Camin JH, Sokal RR. A method for deducing branching sequences in phylogeny. Evolution. 1965;19(3):311. https://doi.org/10.2307/2406441.
Avni E, Snir S. A new phylogenomic approach for quantifying horizontal gene transfer trends in prokaryotes. Sci Rep. 2020;10(1):1–14.
Pons JC, Semple C, Steel M. Treebased networks: characterisations, metrics, and support trees. J Math Biol. 2018;78(4):899–918. https://doi.org/10.1007/s0028501812969.
Francis A, Semple C, Steel M. New characterisations of treebased networks and proximity measures. Adv Appl Math. 2018;93:93–107. https://doi.org/10.1016/j.aam.2017.08.003.
Murakami Y. On phylogenetic encodings and orchard networks. PhD thesis, TU Delft. 2021.
Sanderson MJ, Hufford L. Homoplasy: the recurrence of similarity in evolution. Amsterdam: Elsevier; 1996.
Semple C, Steel M. Tree reconstruction from multistate characters. Adv Appl Math. 2002;28(2):169–84.
Ringe D, Warnow T, Taylor A. Indoeuropean and computational cladistics. Trans Philol Soc. 2002;100(1):59–129.
Bourque G, Burns KH, Gehring M, Gorbunova V, Seluanov A, Hammell M, Imbeault M, Izsvák Z, Levin HL, Macfarlan TS, Mager DL, Feschotte C. Ten things you should know about transposable elements. Genome Biol. 2018. https://doi.org/10.1186/s130590181577z.
AltafUlAmin M, Kanaya S, MohamedHussein ZA. Investigating metabolic pathways and networks encyclopedia of bioinformatics and computational biology. Amsterdam: Elsevier; 2019. p. 489–503. https://doi.org/10.1016/b9780128096338.201404.
Zachar I, Boza G. Endosymbiosis before eukaryotes: mitochondrial establishment in protoeukaryotes. Cell Mol Life Sci. 2020;77(18):3503–23. https://doi.org/10.1007/s00018020034626.
Wells JN, Feschotte C. A field guide to eukaryotic transposable elements. Ann Rev Genet. 2020;54(1):539–61. https://doi.org/10.1146/annurevgenet040620022145.
Goyal A. Horizontal gene transfer drives the evolution of dependencies in bacteria. iScience. 2022;25(5): 104312. https://doi.org/10.1016/j.isci.2022.104312.
Felsenstein J. Inferring phylogenies. Sunderland: Sinauer Associates; 2004.
Bordewich M, Semple C. A universal treebased network with the minimum number of reticulations. Discrete Appl Math. 2018;250:357–62.
Farris JS. Phylogenetic analysis under Dollo’s Law. Syst Biol. 1977;26(1):77–88. https://doi.org/10.1093/sysbio/26.1.77.
Gusfield D. The multistate perfect phylogeny problem with missing and removable data: solutions via integerprogramming and chordal graph theory. J Comput Biol. 2010;17(3):383–99. https://doi.org/10.1089/cmb.2009.0200.
Cardona, Gabriel, Pons, Joan Carles, Rosselló Francesc. A reconstruction problem for a class of phylogenetic networks with lateral gene transfers.Algorithms for Molecular Biology. BioMed Central. 2015;10(1):1–15.
Acknowledgements
The authors would like to thank the reviewers for their helpful comments and for pointing out paper [37].
Funding
Alitzel López Sánchez acknowledges financial support from the programme de bourses d’excellence en recherche from the University of Sherbrooke. Manuel Lafond acknowledges financial support from the Natural Sciences and Engineering Research Council (NSERC) and the Fonds de Recherche du Québec Nature et technologies (FRQNT)
Author information
Authors and Affiliations
Contributions
Both authors contributed equally for the development of this article.
Corresponding author
Ethics declarations
Ethics approval and consent to participate
Not applicable.
Consent for publication
Not applicable.
Competing interests
The authors declare that they have no competing interests.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/. The Creative Commons Public Domain Dedication waiver (http://creativecommons.org/publicdomain/zero/1.0/) applies to the data made available in this article, unless otherwise stated in a credit line to the data.
About this article
Cite this article
López Sánchez, A., Lafond, M. Predicting horizontal gene transfers with perfect transfer networks. Algorithms Mol Biol 19, 6 (2024). https://doi.org/10.1186/s13015023002422
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/s13015023002422