Orienting undirected phylogenetic networks

This paper studies the relationship between undirected (unrooted) and directed (rooted) phylogenetic networks. We describe a polynomial-time algorithm for deciding whether an undirected nonbinary phylogenetic network, given the locations of the root and reticulation vertices, can be oriented as a directed nonbinary phylogenetic network. Moreover, we characterize when this is possible and show that, in such instances, the resulting directed nonbinary phylogenetic network is unique. In addition, without being given the location of the root and the reticulation vertices, we describe an algorithm for deciding whether an undirected binary phylogenetic network $N$ can be oriented as a directed binary phylogenetic network of a certain class. The algorithm is fixed-parameter tractable (FPT) when the parameter is the level of $N$ and is applicable to classes of directed phylogenetic networks that satisfy certain conditions. As an example, we show that the well-studied class of binary tree-child networks satisfies these conditions.


Introduction
Phylogenetic networks are graphs which are used to describe, for example, the evolutionary relationships of extant species [HRS10].Such networks generalize the more widely-known concept of phylogenetic trees.The leaves of such a phylogenetic network represent extant species, while the interior vertices represent hypothetical ancestors.
Phylogenetic networks are usually rooted acyclic directed graphs, where the vertices and arcs combine to represent evolutionary events (e.g., hybridization or horizontal gene transfer).However, unrooted undirected graphs have also been studied which still aim to describe an explicit evolutionary history, but do not include directions on the edges [Mor05].Reasons for not including directions can be uncertainty about the location of the root and uncertainty about the order in which reticulate events occurred, that is, events where species or lineages merge.Moreover, it can be unclear which vertices represent reticulate events and which vertices represent speciation events or "vertical" descent.See Figure 1 for an example of an undirected and a directed phylogenetic network which illustrates these differences in perspective.Note that unrooted networks are also used as a tool to display patterns within data (e.g., split networks [BM04]) but, as these networks do not aim to explicitly represent the evolution of the underlying species, we do not focus on them here.
In addition to directed and undirected phylogenetic networks, a third option is partly-directed phylogenetic networks, that is, phylogenetic networks in which only some of the edges are oriented.Such networks make sense in light of the discussion above and, indeed, several published phylogenetic networks in the biological literature are partly-directed, e.g., of grape cultivars [MBO + 11] and of the evolutionary history of Europeans [Laz18], or Figure 1: An undirected phylogenetic network (left) and a directed phylogenetic network (right) based on [Mor15, MSH + 14].Note that the directed phylogenetic network can be obtained from the undirected phylogenetic network by adding a root vertex and orienting the edges.contain bi-directed arcs, e.g., of bears [KLB + 17].Also, the popular software tool SNAQ produces partly-directed phylogenetic networks [SLA16].Despite these publications, partly-directed phylogenetic networks have yet to be studied from a mathematical perspective, even though this was suggested by David Morrison in 2013 [Mor13]: "Perhaps the possibility of partly directed phylogenetic networks needs more consideration." In this paper, we study two fundamental questions regarding the relationship between undirected and directed phylogenetic networks.In the first part of the paper, we investigate the following.Suppose we are given the underlying undirected phylogenetic network of some directed (nonbinary) phylogenetic network N as well as the location of the root of N and the desired in-degrees of the reticulation vertices (the vertices where lineages merge) of N .Does this give us enough information to uniquely reconstruct N ?We show that this is indeed the case.Moreover, given the locations of the root and the desired in-degrees of the reticulation vertices, we characterize when an undirected phylogenetic network N can be oriented as a directed phylogenetic network (see Theorem 1).For an example of an undirected binary phylogenetic network where this is not possible, see Figure 2. Following this, we give a linear-time algorithm in the number of edges of N to find such an orientation.We also show how to apply the algorithm to partly-directed networks.In particular, we show how one can decide in quadratic time in the number of edges whether a given partly-directed network is a semi-directed network, i.e., whether it can be obtained from some directed phylogenetic network by suppressing the root and removing all directions from non-reticulation edges (see Corollary 3).
x y x y Figure 2: Left, an undirected binary phylogenetic network with specified reticulation vertices (indicated by squares) and root location (indicated with an arrow) that has no orientation as a directed phylogenetic network.Right, the same undirected binary phylogenetic network but with no information about the root and reticulation vertices.This latter undirected binary phylogenetic network can be oriented as a binary stack-free network, but not as a binary tree-child network.
In the second part of the paper, we study the following question.Given an undirected binary phylogenetic network N , can N be oriented to become a directed binary phylogenetic network of a given class (with no information about the location of the root or the reticulation vertices).Again see Figure 2 for an example.We give an algorithm for this task that is fixed-parameter tractable (FPT), where the level of N is the parameter (see Algorithm 4).The level of N is a measure of its tree-likeness.(A formal definition is given in the next section.)The algorithm can be applied to a wide range of classes of directed binary phylogenetic networks, including the well-studied classes of tree-child, tree-based, reticulation-visible, and stack-free networks, as well as the recently-introduced classes of valid networks [MvIJ + 19] and orchard networks [ESS19,JM21] (see Section A.1 for definitions).We include the proof for the class tree-child as an example (see Section 5) since this is one of the most well-studied classes of phylogenetic networks.The proofs for the other classes, following a similar approach, can be found in Appendix A. To obtain this algorithm, we first describe an FPT algorithm where the number of reticulation vertices is the parameter (see Algorithm 3).The final FPT algorithm (Algorithm 4, which relies on Algorithm 3) may scale better because it has the level as the parameter, which is always smaller or equal to the reticulation number.All of the algorithms in the paper have been implemented and are publicly available [Jan20].
To the best of our knowledge, the questions investigated in this paper have not been studied previously.To date, most publications consider either directed or undirected phylogenetic networks, but do not study how they are related.Exceptions are a paper studying how to optimally root unrooted trees as to minimize their hybridization number [IKS + 18] and papers about orienting split networks [ABR19, HKLS05, SM00].Also see [GHS17] which looks into the relationship between undirected phylogenetic networks and Buneman graphs.There is also a large body of literature on orienting graphs (see, e.g., [AJMO16,AT92]), but such papers are not applicable to our situation because, for example, they do not require the orientation to be acyclic (one exception being [Ata83] which is discussed later) or they do not have our degree restrictions.Lastly, there are two papers that provide results on the orientability of genealogical phylogenetic networks.However, these only provide such results as sidenotes to their main purpose: rearranging networks [JJE + 18], and characterizing undirected (unrooted) tree-based networks [FHM18].

Preliminaries
Throughout the paper, X denotes a non-empty finite set.Biologically speaking, X can be viewed as a set of extant taxa.An undirected phylogenetic network N on X is an undirected connected (simple) graph, in which no vertex has degree 2, and the set of vertices of degree 1 (the leaves) is X.We say N is binary if each non-leaf vertex has degree 3.An undirected phylogenetic network with no cycles is an undirected phylogenetic tree.The reticulation number of an undirected phylogenetic network is the number of edges that need to be removed to obtain, after suppressing degree-2 vertices, an undirected phylogenetic tree.
A directed phylogenetic network N on X is a directed acyclic graph with no parallel arcs in which exactly one vertex has in-degree 0 and this vertex has out-degree 2 (the root), no vertices have in-degree 1 and outdegree 1, and the set of vertices of out-degree 0 is X and all such vertices have in-degree 1.The vertices of out-degree 0 are the leaves of N .We say N is binary if all non-root non-leaf vertices either have in-degree 1 and out-degree 2, or have in-degree 2 and out-degree 1. Vertices with in-degree at least 2 are reticulations, while vertices with in-degree 1 are tree vertices.Arcs directed into a reticulation are called reticulation arcs.Furthermore, an arc of N is pendant if it is incident to a leaf.If (u, v) is an arc of N , then u is a parent of v, and v is a child of u.A directed (binary) phylogenetic network with no reticulations is a directed (binary) phylogenetic tree.
To avoid ambiguity, when the need arises we will say a "nonbinary phylogenetic network" to mean a phylogenetic network that is not necessarily binary.Furthermore, we note that in the phylogenetics literature the terms rooted and unrooted phylogenetic network are often used.However, since the location of the root does not necessarily imply the direction of all the arcs, we will use directed and undirected instead of rooted and unrooted, respectively.Two undirected phylogenetic networks N and M on X are isomorphic if there exists a bijection f from the vertex set of N to the vertex set of M such that f (x) = x for all x ∈ X, and such that {u, v} is an edge of N if and only if {f (u), f (v)} is an edge of M .Given an undirected phylogenetic network N on X and a directed phylogenetic network N on X, we say that N is the underlying network of N and that N is an orientation of N if the undirected phylogenetic network obtained from N by replacing all directed arcs with undirected edges and suppressing its degree-2 root is isomorphic to N .We say that N is orientable if it has at least one orientation.
A biconnected component of a directed or undirected phylogenetic network is a maximal subgraph that cannot be disconnected by deleting a single vertex.A biconnected component is called a blob if it contains at least three vertices.An undirected phylogenetic network is level-k if, by deleting at most k edges from each blob, the resulting graph is a tree, that is, has no cycles.A directed phylogenetic network is level-k if its underlying network is level-k.Hence, a directed binary phylogenetic network is level-k if and only if each blob contains at most k reticulations.
A graph is mixed if it contains both undirected and directed edges.A partly-directed phylogenetic network is a mixed graph that is obtained from an undirected phylogenetic network by orienting a subset of its edges.: Left, a partly-directed phylogenetic network that is semi-directed (it can be rooted along the pendant edge incident with z).Right, a partly-directed phylogenetic network that is not semi-directed.If it were semidirected, then a directed phylogenetic network from which it is obtained would have to be rooted along either the pendant edge incident with x or one of the arcs incident to the neighbour of x; otherwise, there is no directed path from the root to x.This makes (p, z) an arc, which implies that p has the incoming arc (s, p).For similar reasons, the orientation must include (r, s) and (q, r).But then, together with (p, q), these arcs form a directed cycle, a contradiction.
An orientation of a partly-directed phylogenetic network N on X is a directed phylogenetic network on X that is obtained from N by inserting the root along a directed or undirected edge, and orienting all undirected edges.A semi-directed phylogenetic network is a mixed graph obtained from a directed phylogenetic network by unorienting all non-reticulation arcs and suppressing the root.If the root, ρ say, is incident with the arcs (ρ, u) and (ρ, v), where u is a tree vertex and v is a reticulation, then this process replaces (ρ, u) and (ρ, v) with the arc (u, v).Note that, as the root has out-degree 2, it is not the parent of two reticulations.Such networks are of interest because they are used in practical software [SLA16].A semi-directed phylogenetic network is a partly-directed phylogenetic network but the converse is not true in general, see Figure 3.
We emphasize that we do not allow parallel edges or parallel arcs in (undirected and directed) phylogenetic networks.However, replacing directed arcs of a directed phylogenetic network by undirected edges and suppressing the root may create parallel edges.We do not consider this case explicitly because it can be dealt with easily.In particular, if an undirected phylogenetic network has more than one pair of parallel edges, it cannot be oriented; since the oriented phylogenetic network would contain either a pair of parallel arcs or a directed cycle of length 2. If there is exactly one pair of parallel edges, then, for the same reason, one of these edges needs to be subdivided with the root to obtain an orientation.
Lastly, for an (undirected) graph G = (V, E), let E and V be subsets of E and V , respectively.The graph obtained from G by deleting each of the edges in E is denoted by G\E .Similarly, the graph obtained from G by deleting each of the vertices in V is denoted by G\V .On the other hand, if A and B are sets, the set obtained from B by deleting each of the elements in A ∩ B is denoted by B − A.
3 Orienting an undirected phylogenetic network given the root and the desired in-degrees Suppose that N is an undirected binary phylogenetic network, with a designated edge e ρ , and R is a subset of the vertices of N .Does there exist an orientation N r of N whose set of reticulations is R and whose root subdivides e ρ ?In this section, we characterize precisely when there exists such an orientation.Furthermore, we prove that if an orientation exists, then it is unique, and we present a linear-time algorithm that finds N r .
We start by discussing nonbinary phylogenetic networks, which then allows us to treat binary phylogenetic networks as a special case.In directed nonbinary phylogenetic networks, vertices may have both their in-degree and out-degree greater than 1, in which case knowing the locations of the root and the reticulations may not guarantee a unique orientation of the network (see Figure 4).Therefore, in addition to knowing which vertices are reticulations, we also need to know their desired in-degrees.See Section 6 for a discussion on nonbinary networks in which reticulations are required to have out-degree 1.
In what follows, let N = (V, E, X) denote an undirected nonbinary phylogenetic network on X with vertex set V and edge set E. In addition, let e ρ denote a designated edge of N where we want to insert the root and, for all v ∈ V , let d − N (v) and d N (v) denote the desired in-degree and the total degree of v, where respectively.We say that (N, e ρ , d − N ) is orientable and that N r is a orientation of (N, e ρ , d − N ) if there exists an orientation N r of N such that its root subdivides e ρ and each v ∈ V has in-degree for some leaf l of N .This leads to the following decision problem.

Constrained Orientation
Input: An undirected nonbinary phylogenetic network N = (V, E, X), a distinguished edge e ρ ∈ E, and a map d − N : V → N assigning a desired in-degree to each vertex of N .Output: An orientation of (N, e ρ , d − N ) if it exists, and NO otherwise.

Characterizing the orientability of undirected nonbinary phylogenetic networks
We start by introducing the notion of a degree cut, which will be the key ingredient for characterizing orientability.
Definition 1.Let N = (V, E, X) be an undirected nonbinary phylogenetic network with e ρ ∈ E a distinguished edge, and let N ρ = (V ρ , E ρ , X) be the graph obtained from N by subdividing e ρ by a new vertex ρ.Given the desired in-degree d − N (v) of each vertex v ∈ V , a degree cut for (N, e ρ , d − N ) is a pair (V , E ) with V ⊆ V and E ⊆ E ρ such that the following hold in N ρ : • E is an edge cut of N ρ ; • ρ is not in the same connected component of N ρ \E as any v ∈ V ; • each edge in E is incident to exactly one element of V ; and The notion of a degree cut is illustrated in Figure 5. Observe that if the desired in-degree of each vertex in V is at most one, then (N, e ρ , d − N ) has no degree cut.We say that a degree cut ) has no degree cut.If V denotes the vertex set of N and R denotes the set of unfilled vertices, the dashed edges are those edges with end-vertices in V − R and R that can be reached from e ρ without traversing an unfilled vertex ('{t, r} edges' in the setting of Lemma 1).The dotted edge is an edge with end-vertices in V − R and R that cannot be reached from e ρ without traversing an unfilled vertex.Middle, the graph N ρ obtained by deleting the dashed edge that is incident to the neighbour of w from N ρ and suppressing the resulting degree-two vertices.Observe that (N , e ρ , d − N ), as defined in Lemma 1, has no degree cut.Right, the graph N obtained by deleting the dotted edge from N ρ and suppressing the resulting degree-two vertices.Here, (N , e ρ , d − N ) has a degree cut (the unfilled vertices together with the dashed edges).
We will show in Theorem 1 that the non-existence of a degree cut for (N, e ρ , d − N ) together with a condition on the desired in-degrees is equivalent to (N, e ρ , d − N ) being orientable.One direction of this theorem is established in Proposition 1(i) and (ii).
Proposition 1.Let N = (V, E, X) be an undirected nonbinary phylogenetic network, e ρ ∈ E be a distinguished edge, and d − N (v) be the desired in-degree of each vertex v ∈ V , where is orientable, then each of the following holds: where R is the set of vertices in V with desired in-degree at least two.Proof.To prove (i), suppose, for a contradiction, that (N, e ρ , d − N ) has a degree cut (V , E ).Consider an orientation N r of (N, e ρ , d − N ).In this orientation, each vertex v ∈ V is incident to at most d − N (v) − 1 arcs corresponding to edges in E .Hence, each vertex in V is incident to at least one incoming arc that does not correspond to an edge in E .Let v ∈ V be an arbitrarily chosen vertex, and let e be an incoming arc of v that does not correspond to an edge in E .Since there is a directed path from ρ to v via e in N r , and since (V , E ) is a degree cut of (N, e ρ , d − N ), it must be the case that, prior to e, this path traverses an arc that corresponds to an edge in E .In particular, this means that there is a directed path from some other vertex in V to v. Observe that this property holds for all vertices in V , that is, for each v ∈ V , there is a directed path from some other vertex in V to v .Since V is finite, this implies that N r contains a cycle, a contradiction.For (ii), the total in-degree in an orientation is v∈V d − N (v).Since an orientation has |E|+1 edges as edge e ρ of N is subdivided by ρ, it follows that v∈V d − N (v) = |E| + 1.
To prove (iii), suppose N \R contains a cycle C = (v 1 , v 2 , . . ., v 1 ).Then, in an orientation N r of (N, e ρ , d − N ), each vertex of C has one incoming and at least two outgoing arcs.Without loss of generality, suppose that {v 1 , v 2 } is oriented from v 1 to v 2 in N r .Then all other edges incident to v 2 are oriented away from v 2 in N r , so {v 2 , v 3 } is oriented from v 2 to v 3 .By repeating this argument, it follows that N r has a directed cycle (v 1 , v 2 , . . ., v 1 ).This contradiction completes the proof of (iii) and the proposition.
We will show later in Corollary 1 that (iii) in Proposition 1 is implied by (i) and (ii).We next prove a lemma which will be used in several proofs.See Figure 6 for an example.
Lemma 1.Let N = (V, E, X) be an undirected nonbinary phylogenetic network, e ρ ∈ E be a distinguished edge, and d − N (v) be the desired in-degree of each vertex v ∈ V , where set of all vertices of N with desired in-degree at least two.Suppose that (N, e ρ , d − N ) has no degree cut and R = ∅.Then the following hold: (i) There exists an edge {t, r} = e ρ in N , where t ∈ V − R and r ∈ R, such that there is a path from an endpoint of e ρ to t not traversing any vertex in R.
(ii) For any such edge {t, r} in (i), (N , e ρ , d − N ) has no degree cut, where (I) N is the undirected nonbinary phylogenetic network obtained from N by deleting {t, r} and suppressing any resulting degree-two vertices, (II) e ρ = e ρ unless e ρ = {p, q} and, p say, is suppressed (and so q is not suppressed as {t, r} = e ρ ), in which case, e ρ = {q, s}, where s is the neighbour of p that is not in {q, r, t}, and for all vertices v in N .
Proof.Let N ρ be the graph obtained from N by subdividing e ρ with a vertex ρ.If, in N ρ , both vertices adjacent to ρ are in R, then these vertices together with the two edges incident with ρ form a degree cut for (N, e ρ , d − N ), a contradiction.It follows that at least one vertex adjacent to ρ is not in R. Avoiding ρ, take a path from such a vertex to a vertex r ∈ R, such that no other vertices of the path except r are in R. To show that such a path exists, assume it does not.This is only possible when exactly one neighbour of ρ is in R and there is no path avoiding ρ between the neighbours of ρ, i.e., the edges incident to ρ are cut-edges.In this case, the neighbour of ρ that is in R together with the edge between this vertex and ρ form a degree cut for (N, e ρ , d − N ), a contradiction.Hence, there exists a path from a neighbour of ρ that is not in R to a vertex r ∈ R, such that this path does not contain ρ and does not contain any vertices from R except r.Then the last edge on this path is an edge {t, r} with t ∈ V − R and r ∈ R for which there is a path from ρ to t not using any vertex from R. Note that t = ρ since we started the path at a neighbour of ρ.Also note that r = ρ since r ∈ R. Hence, the edge {t, r} is not incident to ρ and so it is an edge of N .Since it is also an edge of N ρ , it is not equal to e ρ .This establishes (i).
To prove (ii), consider any such edge {t, r}, and let P be a path in N ρ from ρ to t avoiding vertices in R. Suppose (N , e ρ , d − N ) has a degree cut (V , E ).Let N ρ be the graph obtained from N by subdividing e ρ with a vertex ρ.Observe that N ρ can be obtained from N ρ by deleting {t, r} and suppressing any resulting degree-2 vertices (except ρ).Also note that we can obtain N from N ρ by suppressing ρ and that e ρ is the edge created by suppressing ρ.In this proof, we will work with N ρ and N ρ (rather than with N and N ) because degree cuts may contain edges incident to ρ.
If t is suppressed when obtaining N ρ from N ρ , let e t = {u, v} denote the resulting edge in N ρ , where u ∈ P (possibly u = ρ).Similarly, if r is suppressed when obtaining N ρ from N ρ , let e r = {u , v } denote the resulting edge in N ρ (possibly, ρ ∈ {u , v }).
Let S be the subgraph of N ρ \E consisting of all connected components containing at least one element of V , and let S ρ be the subgraph of N ρ \E consisting of the remaining connected components of N ρ \E .Since (V , E ) is a degree cut of (N , e ρ , d − N ), the subgraph S ρ contains ρ.Furthermore, as P contains no vertices in R (so for all p ∈ P , we have d − N (p) ≤ 1), it follows by the fourth property of a degree cut that no p ∈ P is an element of V .Hence, the path P cannot contain any edges of E , so any node on P is in the component S ρ and, in particular, either t or, if t is suppressed, u is contained in S ρ .
We now derive a contradiction by distinguishing three cases depending on r.
For the first case, assume that either r or, if r is suppressed, e r is contained in S ρ .If either t is not suppressed or t is suppressed and e t ∈ E , then (V , E ) is a degree cut of (N, e ρ , d − N ), a contradiction.Now suppose that t is suppressed and e t = {u, v} ∈ E .Since u ∈ S ρ we have v ∈ S.Then, (V , (E − {e t }) ∪ {{t, v}}) is a degree cut of (N, e ρ , d − N ), a contradiction.
For the second case, assume that either r or, if r is suppressed, e r is contained in S. If either t is not suppressed or t is suppressed and e t ∈ E , then (V ∪ {r}, E ∪ {{t, r}}) is a degree cut of (N, e ρ , d − N ), a contradiction.Furthermore, if t is suppressed and e t ∈ E , then (V ∪ {r}, (E − {e t }) ∪ {{t, v}, {t, r}}) is a degree cut of (N, e ρ , d − N ), a contradiction.
For the last case, assume that r is suppressed and e r = {u , v } ∈ E .Without loss of generality, say v ∈ V .If either t is not suppressed or t is suppressed and e t ∈ E , then (V , (E − {e r }) ∪ {{r, v }}) is a degree cut of (N, e ρ , d − N ), a contradiction.If t is suppressed and e t = {u, v} ∈ E , then we have, as before, that u ∈ S ρ and v ∈ S. In this case, (V , (E − {e t , e r }) ∪ {{t, v}, {r, v }}) is a degree cut of (N, e ρ , d − N ).This last contradiction completes the proof of the lemma.
We are now ready to prove the above-mentioned characterization for when an undirected nonbinary phylogenetic network has an orientation respecting a given location for the root and in-degree of every vertex.
Theorem 1.Let N = (V, E, X) be an undirected nonbinary phylogenetic network, e ρ ∈ E be a distinguished edge, and d − N (v) be the desired in-degree of each vertex v ∈ V , where , and so N is an undirected phylogenetic tree, in which case, (N, e ρ , d − N ) is trivially orientable.Now suppose that v∈V d − N (v) − |V | ≥ 1, and the converse holds for any undirected nonbinary phylogenetic network in which the sum of the given in-degree of each vertex minus the size of its vertex set is at most Let N ρ be the graph obtained from N by subdividing e ρ by ρ.By Lemma 1, there exists an edge {t, r} in N ρ with t ∈ V − R and r ∈ R for which there is a path from ρ to t not using any vertex from R. Set (N , e ρ , d − N ) to be the same as its namesake in the statement of Lemma 1 and let E be the edge set of N .Recalling that d N (v) denotes the degree of a vertex v ∈ V and , there are four possibilities to consider depending on the degree of t and the degree of r in N : • If d N (t) = 3 and d N (r) = 3, then both t and r are suppressed in obtaining N , and so • If d N (t) = 3 and d N (r) > 3, then only t is suppressed in obtaining N , and so • If d N (t) > 3 and d N (r) = 3, then only r is suppressed in obtaining N , and so • If d N (t) > 3 and d N (r) > 3, then neither t nor r is suppressed in obtaining N , and so In all four possibilities, v∈V d − N (v) = |E | + 1.Furthermore, a routine check using the above calculations shows that, for all four possibilities, v∈V d By Lemma 1, (N , e ρ , d − N ) has no degree cut, and so, by the induction assumption (N , e ρ , d − N ) is orientable.Now consider such an orientation, (N ) r say, and impose the same arc directions on N ρ except for the edge {t, r}.If t is suppressed in obtaining N , then d Nρ (t) = 3, in which case, the two edges incident with t that are not {t, r} are oriented to respect the orientation of the corresponding edge in (N ) r .Analogously, the edges incident with r that are not {t, r} are orientated in a similar way if d Nρ (r) = 3.Now orient {t, r} from t to r, and let N r denote the resulting orientation of N ρ .It follows by construction that each vertex in N r has the correct in-degrees.
It remains to show that N r is an orientation of (N, e ρ , d − N ) by showing that N r has no directed cycle.If there exists such a cycle, then this directed cycle uses the oriented edge (t, r) as (N ) r has no directed cycle.Hence N r has a directed path P from r to t.On the other hand, by the choice of t, the directed graph N r has a directed path Q from ρ to t not using any vertex from R. Since both P and Q end in t, they must meet.Let v be the first vertex on Q meeting P .Then v = ρ as P starts at r = ρ and both arcs incident with ρ are directed away from ρ. Therefore v has in-degree at least 2. But Q does not contain any vertices in R.This contradiction completes the proof of the theorem.
A consequence of Theorem 1 is that Proposition 1(iii) is implied by Proposition 1(i) and (ii).
Corollary 1.Let N = (V, E, X) be an undirected nonbinary phylogenetic network, e ρ ∈ E be a distinguished edge, and

Orientation algorithm
In this section, we present a polynomial-time algorithm for deciding if, given an undirected nonbinary phylogenetic network N , there is an orientation of N respecting a given location of the root and desired in-degree of each vertex, in which case, the algorithm returns such an orientation.The algorithm is as follows.
Input: An undirected nonbinary phylogenetic network N = (V, E, X), an edge e ρ ∈ E, and the desired in-degree return NO 3 Subdivide e ρ by a new vertex ρ and orient the two edges incident to ρ away from ρ; 4 while there exist an unoriented edge do Theorem 2. Let N = (V, E, X) be an undirected nonbinary phylogenetic network, e ρ ∈ E be a distinguished edge, and Then Algorithm 1 decides whether (N, e ρ , d − N ) is orientable, in which case, it finds an orientation in time O(|E|).Moreover, this orientation is the unique orientation of (N, e ρ , d − N ).
Proof.By Proposition 1(ii), we may assume that v∈V d − N (v) = |E|+1.Let N ρ denote the graph obtained from N by subdividing e ρ with ρ.We say that a vertex of N ρ is processed by Algorithm 1 when the algorithm orients its outgoing edges.Note that Algorithm 1 only processes a vertex when it already has at least one incoming oriented edge, and when a vertex is processed all its remaining unoriented edges are oriented outwards.
First suppose that there exists an orientation N r of (N, e ρ , d − N ).We will prove that Algorithm 1 returns N r .To see this, we first show that if a vertex of N ρ is processed by Algorithm 1, then every edge incident to this vertex obtains the same orientation as in N r .Assume, for a contradiction, that this is not the case, and let v be the first vertex processed by Algorithm 1 for which at least one of its incident edges is not oriented as in N r .Immediately before v is processed, it has d − N (v) incoming oriented edges and at least one incident unoriented edge.By the choice of v, the incoming oriented edges of v are oriented the same way as in N r because the other end-vertices of these edges have already been processed.Algorithm 1 orients all other edges incident to v away from v.These edges are also oriented away from v in N r , since N r is an orientation and v is required to have in-degree d − N (v).This contradicts the assumption that at least one edge incident to v does not have the same orientation as in N r .It follows that if there exists an orientation N r of (N, e ρ , d − N ), then every vertex processed by Algorithm 1 has all its incident edges assigned the same orientation as in N r .To prove that Algorithm 1 returns N r , it remains to show that every non-leaf vertex is processed by the algorithm.
Assume that Algorithm 1 stops without having processed all non-leaf vertices.Let P be the set of vertices of N ρ that have been processed at this point.Let E be the set of all edges of N ρ with exactly one end-vertex in P , and let V be the set of all vertices of N ρ not in P that are incident to an edge in E .Every edge e ∈ E is incident to one processed vertex u ∈ P and one unprocessed vertex in V .By construction, e is oriented away from u and, by the previous argument, e has the same orientation in N r .
If v ∈ V , then, as every oriented edge is oriented in the same direction as in N r , we have that v is incident to at most d − N (v) incoming oriented edges.Also, every edge in edges in E .Since E is an edge cut of N ρ such that ρ is not in the same connected component of N ρ \E as any vertex in V , and each edge in E is incident to exactly one element of V , it follows that (V , E ) is a degree cut for (N, e ρ , d − N ), contradicting Proposition 1(i).This last contradiction implies that all non-leaf vertices of N ρ are processed.Hence, if there exists an orientation N r of (N, e ρ , d − N ), Algorithm 1 will return N r , and N r is the unique orientation of (N, e ρ , d − N ).
Now suppose that Algorithm 1 returns an orientation N r of N ρ .We will prove that N r is an orientation of (N, e ρ , d − N ).It suffices to show that all vertices of N r have the correct in-degree and out-degree, and N r has no directed cycle.
Assume that there exists some vertex u in N r that does not have the correct in-degree and out-degree.Each vertex that is processed (as well as each leaf) always obtains the correct in-degree and out-degree.Hence u has not been processed.Since all edges have been oriented and edges are oriented away from a vertex only if that vertex is processed, it follows that u has in-degree d N (v).Thus, as But this implies that the total number of edges in N ρ is at least |E| + 2, a contradiction as N ρ has |E| + 1 edges.Thus, every vertex of N r has the correct in-degree and out-degree.Now assume that N r has a directed cycle.Since every vertex of N r has the correct in-degree and out-degree, every non-leaf vertex has been processed.Consider the vertex v of the cycle that is processed first.Let u be the neighbour of v on the cycle such that there is an oriented edge e from u to v.As any oriented edge incident to a vertex is oriented away from that vertex when it is processed, e must have been oriented before v was processed.But this implies that u was processed before v, contradicting our choice of v. Thus N r has no directed cycles and it follows that, if Algorithm 1 returns an orientation of N , it is an orientation of (N, e ρ , d − N ).
To complete the proof of the theorem, it remains to show that Algorithm 1 runs in O(|E|) time.A naive implementation takes O(|V | 2 ) time, as there are O(|V |) vertices to process and it may take O(|V |) time to find the next vertex that can be processed and process it.However, this running time can be improved by observing that any vertex v (apart from the root ρ) only becomes suitable for processing after it has d − N (v) incoming oriented edges.Thus it is enough to maintain a set S of such vertices and check, whenever an edge is oriented, whether an unprocessed end-vertex of this edge should be added to S.Then, instead of searching for a new vertex to process each time, we can simply take any vertex from the set S. As each edge is oriented exactly once, the total time spent maintaining S and orienting all edges is O(|E|).
Partly-directed and semi-directed phylogenetic networks.We end this subsection with two consequences of Theorem 1 and Algorithm 1 concerning partly-directed and semi-directed phylogenetic networks.Recall that a partly-directed phylogenetic network is a mixed graph obtained from an undirected phylogenetic network by orienting some of its edges.Let N = (V, E, A, X) be a partly-directed phylogenetic network on X with vertex set V , undirected edge set E, and directed edge set A. Let e ρ ∈ E and, for each v ∈ V , let d − N (v) denote the desired in-degree of v.We say that (N, e ρ , d − N ) is orientable if there is an orientation of N in which the root subdivides e ρ and, for each is orientable, replace each arc of N by an undirected edge and apply Algorithm 1 to determine whether there exists an orientation.If it exists, it is unique by Theorem 2. Hence, we only need to check whether each arc in A is oriented the same way in the obtained orientation.Thus we have the following corollary of Theorem 2.
Corollary 2. Let N = (V, E, A, X) be a partly-directed nonbinary phylogenetic network, e ρ ∈ E and d − N (v) the desired in-degree of each v ∈ V .Then there exists a linear-time algorithm that decides whether (N, e ρ , d − N ) is orientable and finds the unique orientation if it exists.
We now consider semi-directed phylogenetic networks.Recall that a semi-directed phylogenetic network is a mixed graph that is obtained from a directed phylogenetic network by unorienting all non-reticulation arcs and suppressing the root.We noted in Section 2 that a partly-directed phylogenetic network is not necessarily a semidirected phylogenetic network.Thus a natural question is whether it is easy to decide if a given partly-directed phylogenetic network is semi-directed.Corollary 2 allows us to answer this question positively.
Let N = (V, E, A, X) be a partly-directed nonbinary phylogenetic network on X.If there is a vertex of N with exactly one incoming arc, then N is not semi-directed, so we may assume that there are no such vertices.Let R denote the subset of vertices of N with at least two incoming arcs.For each vertex v ∈ V , define the desired in-degree For each choice of e ρ ∈ E, we apply Corollary 2. Then N is semi-directed if and only if (N, e ρ , d − N ) is orientable for at least one choice of e ρ .The running time is O(|E| 2 ), since there are |E| choices for e ρ and Algorithm 1 runs in O(|E|) time.Hence we have the following corollary.
Corollary 3. Let N = (V, E, A, X) be a partly-directed nonbinary phylogenetic network.Then we can decide in O(|E| 2 ) time whether N is a semi-directed nonbinary phylogenetic network.

Characterizing the orientability of undirected binary phylogenetic networks
We now consider the special case of the decision problem Constrained Orientation for undirected binary phylogenetic networks.Here, rather than being given the desired in-degree of each vertex, we are simply given the set of desired reticulations as all such vertices have in-degree exactly two and all remaining vertices (except the root) have in-degree one.
Definition 2. Let N = (V, E, X) be an undirected binary phylogenetic network with e ρ ∈ E a distinguished edge, and let N ρ = (V ρ , E ρ , X) be the graph obtained from N by subdividing e ρ by a new vertex ρ.Given the set of desired reticulations R ⊆ V , a reticulation cut for (N, e ρ , R) is a pair (R , E ) with R ⊆ R and E ⊆ E ρ such that the following hold in N ρ : • E is an edge cut of N ρ ; • ρ is not in the same connected component of N ρ \E as any r ∈ R ; • each edge in E is incident to exactly one element of R ; and Observe that, if, in the definition of a degree cut, N is binary, then, because of the fourth property of a degree cut, V is a subset of the set of vertices whose desired in-degree is two.Hence, the definition of a reticulation cut coincides with that of a degree cut when N is binary.We say An example of a reticulation cut of the triple (N, e ρ , R) in Figure 2 is illustrated in Figure 7.The next proposition is a consequence of Proposition 1.
Proposition 2. Let N = (V, E, X) be an undirected binary phylogenetic network, e ρ ∈ E and R ⊆ V .If (N, e ρ , R) is orientable, then each of the following holds: To illustrate Proposition 2, the example in Figure 2 satisfies (ii) and (iii) but, as shown in Figure 7, it does not satisfy (i), and hence it is not orientable.
The next theorem is the special case of Theorem 1 when restricted to undirected binary phylogenetic networks.It characterizes when an undirected binary phylogenetic network with given locations for the root and reticulations has an orientation.The correctness of this characterization follows from Theorem 1. Theorem 3. Let N = (V, E, X) be an undirected binary phylogenetic network, e ρ ∈ E and R ⊆ V .Then (N, e ρ , R) is orientable if and only if (N, e ρ , R) has no reticulation cut and 4 Orientations within a specific subclass of directed binary phylogenetic networks We now turn our attention to deciding whether a given undirected binary phylogenetic network has a Corientation for a given class C of directed binary phylogenetic networks.Unlike Constrained Orientation we are given no information about the location of the root or the reticulation vertices.Formally, given a class C of directed binary phylogenetic networks, the problem of interest is as follows: C-Orientation Input: An undirected binary phylogenetic network N .
Output: A C-orientation of N if it exists, and NO otherwise.
In this section, we present algorithms for solving C-Orientation for classes C of directed binary phylogenetic networks satisfying certain properties.In the next section, Section 5, we will show that the class tree-child satisfies these properties.In Appendix A we use a similar approach to show the same holds for the classes stack-free, tree-based, valid, orchard, and reticulation-visible networks (all defined in Appendix A.1).This section is organised as follows.In Section 4.1, we describe an FPT algorithm for C-Orientation that is parameterized by the reticulation number of N .Subsequently, in Section 4.2, we extend this to an FPT algorithm for C-Orientation but with the level of N as the parameter.These algorithms essentially guess the locations of the root and the reticulations, compute the unique corresponding orientation as in Section 3, and determine whether it is within the required class.To get an FPT running time, N needs to be reduced to a size which is dependent only on the reticulation number (or level) first.We will give such a reduction for any class C of directed binary phylogenetic networks whose members satisfy three certain properties.Intuitively, these properties are as follows.First, membership of C can be checked by considering each blob separately.Second, if N is a directed binary phylogenetic network in C and new leaves are attached to N , then the resulting directed binary phylogenetic network is also in C. Lastly, the third property is based on reducing "chains" (sequences of leaves whose neighbours form a path).The third property implies that if N is a directed binary phylogenetic network in C and all chains of N are reduced to a certain constant length, then the resulting directed binary phylogenetic network N is also in C. Additionally, a particular relationship holds between the C-rooted edges of N and N .These three properties are formally defined in Definitions 3, 4, and 5, respectively.

FPT algorithm parameterized by the reticulation number
For a class C of directed binary phylogenetic networks, we begin by describing a simple exponential-time algorithm, namely, Algorithm 2, that finds all edges of a given undirected binary phylogenetic network where the root can be inserted in order to obtain a C-orientation and, for all such edges, one C-orientation.The FPT algorithm described later in this subsection uses Algorithm 2 as a subroutine.Let N be an undirected binary phylogenetic network, and let e be an edge of N .We say that N can be C-rooted at e if there is a C-orientation of N whose root subdivides e.If this is the case, we also say that e is a C-rooted edge of N .If e is incident to a leaf l and N can be C-rooted at e, we say that N can be C-rooted at l.For a set X and a non-negative integer n, we let X n = {Y ⊆ X : |Y | = n} denote the set of size n subsets of X.
Input: An undirected binary phylogenetic network N = (V, E, X) with reticulation number k.
Output: The set of C-rooted edges of N and a corresponding C-orientation for each such edge. 1 Set L := ∅ for the root locations and orientations; 2 for each edge e of N do Note that Algorithm 2 does not necessarily return all C-orientations of N .Indeed, for each edge of N , the inner loop quits (Line 7) after one such orientation is found.To find the complete set of orientations, simply remove this line.The correctness of Algorithm 2 and its running time is established in the next lemma.For the running-time, the outer loop runs O(n) times, as the degree of every vertex of N is at most three and so |E| ≤ 3 2 n.The inner loop runs at most n k times.Inside the inner loop, there are exactly two parts that run in non-constant time.First, by Theorem 2, Orientation Algorithm runs in O(n) time and, second, by definition, checking whether a directed binary phylogenetic network with n vertices and k reticulations is in C takes O(f C (n, k)) time.These combine to give a total running time of To obtain an FPT algorithm for C-Orientation, we need to pose some restrictions on the class C. The first of these restrictions is described in Definition 3.For a blob B of a directed binary phylogenetic network, the directed binary phylogenetic network induced by B is obtained from B by adjoining, to each vertex v of either in-degree 1 and out-degree 1, or in-degree 2 and out-degree 0, a new leaf x and a new arc (v, x).Definition 3. A class C of directed binary phylogenetic networks is blob-determined if the following property holds: A directed binary phylogenetic network N is a member of C precisely if every network induced by a blob of N is a member of C.
Let N be an undirected (resp.directed) binary phylogenetic network on X, and suppose that e is a cut-edge (resp.cut-arc) of N .A connected component of N \e that is an undirected (resp.directed) phylogenetic tree on X , where X ⊆ X, is called a pendant phylogenetic subtree of N .A pendant phylogenetic subtree is trivial if it consists of a single leaf; otherwise, it is non-trivial.If a class C of directed binary phylogenetic networks is blob-determined, then, in deciding whether an undirected binary phylogenetic network N has a C-orientation, we may assume that N has no non-trivial pendant phylogenetic subtrees.To see this, observe that if N is an undirected binary phylogenetic network obtained from N by replacing a pendant phylogenetic subtree with a single leaf, say l, then, as C is blob determined and, thus, the existence of a C-orientation depends only on the biconnected components of N , it follows that N has a C-orientation if and only if N has a C-orientation (see Figure 8).Moreover, if e is the pendant edge of N incident with l, then N can be C-rooted at e if and only if N can be C-rooted at each edge of the pendant phylogenetic subtree replaced by l (again, see Figure 8).
Figure 8: Orientating pendant phylogenetic subtrees.Two examples showing how orientations of an undirected binary phylogenetic network N and the undirected binary phylogenetic network N obtained from N by replacing a pendant phylogenetic subtree with a single leaf can be derived from each other.In the first example (a), the root is placed along an edge in the pendant phylogenetic subtree of N and, in the second example (b), the root is placed elsewhere.Note that, for each example, the orientation of the edges within the grey circle are the same.Thus, for a blob-determined class C of directed binary phylogenetic networks, N has a C-orientation if and only if N has a C-orientation.
Hence, we will assume throughout the remainder of Section 4, as well as Section 5, that if N is an undirected binary phylogenetic network, then N has no non-trivial pendant phylogenetic subtrees.
In addition, note that if N is an undirected binary phylogenetic network with reticulation number at most 1, then we can decide whether N can be C-rooted at an edge e by running Algorithm 2, with the running time being a polynomial in the number of vertices and the time needed to check membership of the class C (see Lemma 2).Therefore, we also assume throughout the remainder of Section 4, as well as Section 5, that each undirected binary phylogenetic network has reticulation number at least 2.
To describe the remaining two restrictions, we need some additional definitions.Let N be an undirected (resp.directed) phylogenetic network.Adding a leaf to N means that an edge, say {u, v} (resp.arc (u, v)), of N is replaced by edges {u, w}, {w, v}, {w, x} (resp.arcs (u, w), (w, v), (w, x)), where w is a new vertex and x is a new leaf.The second restriction is described in Definition 4. Definition 4. A class C of directed binary phylogenetic networks is leaf-addable if the following property holds: If N is a member of C and N is obtained from N by adding leaves, then N is a member of C.
The generator G(N ) of an undirected (resp.directed) binary phylogenetic network N is the undirected (resp.directed) multi-graph obtained from N by deleting all (trivial and non-trivial) pendant phylogenetic subtrees together with the edges (resp.arcs) joining the pendant phylogenetic subtrees to the rest of N , and suppressing each of the resulting vertices of degree 2 (resp.in-degree 1 and out-degree 1).Note that if N is undirected, then, for the definition of G(N ), we additionally require the reticulation number of N to be at least 2 (which we assume already).Furthermore, G(N ) may have parallel edges (resp.arcs), as well as undirected (resp.directed) loops.The edges (resp.arcs) of G(N ) are called sides.
Let N be an undirected binary phylogenetic network N and let s = {u, v} be a side of G(N ).Let P s denote the undirected path in N starting at u and ending at v from which s is obtained in the construction of G(N ) by suppressing degree-2 vertices.A leaf x of N is said to be on s, and s is said to contain x, if x is adjacent to an internal vertex of P s .Let n s denote the number of leaves that are on side s.An edge of N is on s if it is an edge of P s .If P s is the undirected path u = u 0 , e 0 , u 1 , e 1 , . . ., u ns , e ns , u ns+1 = v and c i is the leaf adjacent to u i for all i ∈ {1, 2, . . ., n s }, then, relative to P s , we say that the leaves c 1 , c 2 , . . ., c ns and the edges e 0 , e 1 , . . ., e ns of N on s are ordered from u to v.In addition, if e ρ is a distinguished edge in which we want to insert the root, then s is said to contain the root if e ρ is incident to an internal vertex of P s , that is either e ρ is on s or e ρ is a pendant edge incident to an internal vertex of P s .
Similarly, if N is a directed binary phylogenetic network and s is a side of G(N ), then P s is the directed path in N from which s is obtained in the construction of G(N ) by suppressing vertices of in-degree 1 and out-degree 1.A leaf x of N is said to be on s, and s is said to contain x, if x is adjacent to an internal vertex of P s .Let n s denote the number of leaves that are on side s.An arc of N is on s if it is an arc of P s .If s = (u, v) is a side of G(N ), and P s is the directed path u = u 0 , e 0 , u 1 , e 1 , . . ., u ns , e ns , u ns+1 = v and c i is the leaf adjacent to u i for all i ∈ {1, 2, . . ., n s }, then we say that the leaves c 1 , c 2 , . . ., c ns and the arcs e 0 , e 1 , . . ., e ns of N on s are ordered from u to v.
Let N be an undirected binary phylogenetic network.Let be a non-negative integer, and let s be a side of (that is, i = 4), then N can be C-rooted at all edges incident with u j for all j ∈ {4, 5, . . ., 8} (dashed edges).Furthermore, to illustrate (ii) of Definition 5, if N can be C-rooted at the pendant edge incident with u 7 , then N can be C-rooted at {u i , c i } for some i ∈ {1, 2, . . ., 5} satisfying 7 ∈ {i, i + 1, . . ., i + 4}, that is, for some i ∈ {3, 4, 5} (dashed edges).
G(N ) that contains n s ≥ leaves of N .Then the undirected binary phylogenetic network obtained from N by deleting n s − leaves that are on s and suppressing any resulting degree-2 vertices is said to be obtained from N by an -chain reduction on s.More generally, an -chain reduction on N consists of performing an -chain reduction on each side of G(N ) containing at least leaves.
The third restriction is described in Definition 5.
Definition 5. Let C be a class of directed binary phylogenetic networks, and let N be an undirected binary phylogenetic network that is C-orientable.Let N be an undirected binary phylogenetic network obtained from N by an -chain reduction on N .Suppose that s = {u, v} is a side of G(N ) that contains at least leaves of N , and let P s be the undirected path u = u 0 , u 1 , . . ., u ns , u ns+1 = v of N corresponding to s ordered from u to v. Viewing s as a side of G(N ), let c 1 , c 2 , . . ., c denote the leaves of N on s ordered from u to v and, for all i ∈ {1, 2, . . ., }, let u i denote the unique vertex of N adjacent to c i .We say that N is -chain reducible along s if the following two properties hold: (i) If N can be C-rooted at {u i , c i } with i ∈ {1, 2, . . ., }, then N can be C-rooted at all edges incident to u j for all j ∈ {i, i + 1, . . ., n s − ( − i)}.
More generally, N is -chain reducible if N is -chain reducible along every side of G(N ) containing at least leaves and the following property holds: (iii) If N can be C-rooted at an edge e that is neither on a side s containing at least leaves nor incident with a leaf on a side s containing at least leaves, then N can also be C-rooted at e.
A class C of directed binary phylogenetic networks is -chain reducible if every C-orientable undirected binary phylogenetic network is -chain reducible.This concludes Definition 5.
Properties (i) and (ii) in Definition 5 are illustrated in Figure 9. Figure 10 shows an example where Property (iii) is necessary.Note that we can perform an -chain reduction on any undirected binary phylogenetic network, but not every such network is -chain reducible.
Let C be an -chain reducible, leaf-addable, blob-determined class of directed binary phylogenetic networks.We next describe an FPT algorithm, namely, Algorithm 3, for C-orientation with the reticulation number of N as the parameter.In the description of Algorithm 3, recall that adding a leaf x to a directed network means that an arc (u, v) is subdivided with a new vertex, w say, to create the two arcs (u, w) and (w, v), and that leaf x is added with an arc (w, x) (so, in particular, the orientation of the added pendant arcs is determined).In particular, when we add back several leaves to form a chain, we repeat this operation sequentially for each leaf whilst respecting the ordering of the added leaves.As with Algorithm 2, Algorithm 3 finds all of the C-rooted edges of a given undirected binary phylogenetic network, say N , and, for all such edges, it also finds a C-orientation.Loosely speaking, Algorithm 3 starts by performing an -chain reduction on N to produce an undirected binary phylogenetic network N , and then, using Algorithm 2, finds all the C-rooted edges of N as well as a C-orientation of N for each such edge (Lines 1-2).For each C-rooted edge e of N , the algorithm then iteratively finds several C-rooted edges of N "linked" to e via Definition 5.It essentially does this by re-attaching the leaves that were removed in the -chain reduction (after optionally first removing the leaf edge where the root is located and relocating the root to the resulting degree-2 node).It thus also provides a corresponding C-orientation.
Noting that G(N ) = G(N ), let s be the side of G(N ) that contains either e if e is not pendant or the leaf incident to e if e is pendant, and let n s be the number of leaves of N on s.How this iterative process proceeds depends on whether (i) n s < (Lines 7-10; uses Definition 5(iii)), (ii) n s ≥ and e is a pendant edge of N (Lines 11-30; uses Definition 5(i)), or (iii) n s ≥ and e is not a pendant edge of N (Lines 31-33; we argue that we do not need to consider this case explicitly).Most of the work is in (ii) where Algorithm 3 initially handles pendant edges of N linked to e (Lines 16-22) and then handles non-pendant edges of N linked to e (Lines 23-29).The fact that this process finds all C-rooted edges of N as well as a corresponding C-orientation of N for each such edge is established in Lemma 3. Lemma 3. Let N = (V, E, X) be an undirected binary phylogenetic network with reticulation number k, where k ≥ 2. Then Algorithm 3 applied to N is correct and runs in time where n = |V |, f C (8 (k −1), k) is the time complexity of checking whether a directed binary phylogenetic network with 8 (k − 1) vertices and k reticulations is in the -chain reducible, leaf-addable, blob-determined class C of directed binary phylogenetic networks, and g is a function of k and independent of n.
Proof.To establish the lemma, we use the same notation as in Algorithm 3. To prove correctness, we first show that the algorithm correctly infers C-rooted edges of N from the C-rooted edges of N .Let e be a C-rooted edge of N , and let s be the side of G(N ) containing either the leaf incident to e if e is pendant, or e if e is not pendant.If n s < , then e is an edge of N and, as C is leaf-addable, it follows that the algorithm correctly concludes that N can be C-rooted at e. On the other hand, if n s ≥ , then, as C is -chain reducible, it follows by Property (i) of Definition 5 that each of the edges of N inferred by Algorithm 3 is a C-rooted edge of N on side s.
We now show that Algorithm 3 finds all C-rooted edges of N .Suppose that N can be C-rooted at edge e ρ , and let s ρ be the side of G(N ) that contains either the leaf incident to e ρ if e ρ is pendant, or e ρ if e ρ is not pendant.First suppose that s ρ contains fewer than leaves of N .Then e ρ is an edge of N and, by Property (iii) of Definition 5, e ρ is a C-rooted edge of N .Thus, as Algorithm 2 finds all C-rooted edges of N with corresponding orientations, the algorithm correctly finds e ρ and, because C is leaf-addable, a corresponding C-orientation of N .
Input: An undirected binary phylogenetic network N with reticulation number k ≥ 2 and no non-trivial pendant phylogenetic subtrees.Output: The set of C-rooted edges of N and a corresponding C-orientation of N for each such edge. 1 Construct an undirected binary phylogenetic network N by performing an -chain reduction on N ; 2 Find the set of C-rooted edges of N and a corresponding C-orientation N e for each such edge e using Algorithm 2; 3 Set L := ∅ for the root locations and orientations; 4 for each C-rooted edge e of N do 5 Let s = {u, v} be the side of G(N ) that contains either the leaf incident to e if e is pendant, or e itself if e is not pendant; Let n s be the number of leaves of N on s; Extend N e to a C-orientation N e of N by adding back the leaves deleted in the reduction (in Line 1) at their original location; Let f be the pendant edge of N incident to c j ; 18 Modify N e to a C-orientation N f of N as follows.First, add back (j − 1) − (i − 1) leaves to an arbitrary arc on the directed path from u i to u and add back (n s − j) − ( − i) leaves to an arbitrary arc on the directed path from u i to v.Then, (re)label the leaves ordered from u i to u as c j−1 , c j−2 , . . ., c 1 , (re)label the leaves ordered from u i to v as c j+1 , c j+2 , . . ., c ns and relabel the leaf adjacent to u i as c j .Now extend the resulting orientation by adding back the remaining leaves deleted in the reduction (in Line 1) at their original location; Modify N e to a C-orientation N f of N as follows.First delete c i and the root, relocating the root to u i .Second, add back (j − 1) − (i − 1) leaves to an arbitrary arc on the directed path from u i (the new root) to u and add back (n s − (j − 1)) − ( − i)) leaves to an arbitrary arc on the directed path from u i to v, (re)labelling the leaves ordered from u i to u and from u i to v as c j−1 , c j−2 , . . ., c 1 and c j , c j+1 , . . ., c ns , respectively.Now extend the resulting orientation by adding back the remaining leaves deleted in the reduction (in Line 1) at their original location; Now suppose that s ρ contains at least leaves of N .We consider two cases depending on whether or not e ρ is a pendant edge of N .If e ρ is pendant, then e ρ is incident to a leaf, say c j , of N .By Property (ii) of Definition 5, N can be C-rooted at c i for some i satisfying j ∈ {i, i + 1 . . ., n s − ( − i)}.Since Algorithm 2 finds all C-rooted edges of N with corresponding orientations, the algorithm will establish that N can be C-rooted at c i and also find a corresponding C-orientation of N .It follows that Algorithm 3 correctly finds that e ρ is a C-rooted edge of N and, it is easily checked, as C is leaf-addable, a corresponding C-orientation of N in Line 18.If e ρ is not a pendant edge of N , then e ρ is incident to a vertex, say u j which is adjacent to c j , of N .By Property (ii) of Definition 5, N can be C-rooted at c i for some i satisfying j ∈ {i, i + 1, . . ., n s − ( − i)}.Thus, as Algorithm 2 finds all C-rooted edges of N with corresponding orientations, the algorithm establishes that c i is a C-rooted edge of N and also finds a corresponding C-orientation.Therefore, by the argument in the first paragraph of the proof, Algorithm 3 correctly finds that e p is a C-rooted edge of N and, it is easily checked, as C is blob-determined and leaf-addable, it finds a corresponding C-orientation of N in Line 25. Hence Algorithm 3 correctly finds all C-rooted edges of N as well as a corresponding C-orientation of N .
Note that all C-rooted edges are indeed found in Lines 7-30, so the case of Line 31 can indeed be ignored in the algorithm.
For the running time, note that Algorithm 3 consists of three separate parts: the -chain reduction on N to get N by deleting leaves (Line 1); the application of Algorithm 2 to find the C-rooted edges of N and a corresponding C orientation for each such edge (Line 2); and the inference of the C-rooted edges of N as well as the corresponding C-orientations (Lines 3-34).It is clear that the reduction in Line 1 can be executed in O(n 2 ) time.
Next we turn to the running time of applying Algorithm 2 to N .As each side of the generator of N contains at most leaves, the number of vertices and edges of N are bounded by a function of k and .This makes the running time of Algorithm 2 a function of and k.To be more concrete, first observe that, since and so, by Lemma 2, the running time of the second part is For the last part, G(N ) can be found in O(n) time by deleting all leaves and suppressing their neighbours.As G(N ) and G(N ) are isomorphic, each side of G(N ) has at most + 1 edges, and so N has at most 3(k − 1)(2 + 1) edges.For each C-rooted edge of N , we modify a C-orientation of N at most 2n times, each time taking O(n) time.Hence, the running time of this part is O( (k − 1)n 2 ).Taken altogether, the total running time of Algorithm 3 is The next theorem is an immediate consequence of Lemma 3. Theorem 4. Let C be an -chain reducible, leaf-addable, blob-determined class of directed binary phylogenetic networks.If f C (8 (k − 1), k) (described in Lemma 3) is a computable function, then C-orientation is FPT with the reticulation number of the undirected binary phylogenetic network as the parameter.
In Section 4.2, we extend Algorithm 3 to an FPT algorithm for C-orientation, where the level of N is the parameter.Before doing this, we conclude this subsection with the following sufficient condition for a network to be C-orientable.
Proposition 3. Let N be an undirected binary phylogenetic network with at least leaves on each side of G(N ), and let C be an -chain reducible, leaf-addable class of directed binary phylogenetic networks.If, by adding leaves, there is an undirected binary phylogenetic network that is C-orientable, then N is C-orientable.
Proof.Let N be an arbitrary undirected binary phylogenetic network with at least leaves on each side of its generator.Suppose we can add leaves to N to obtain an undirected binary phylogenetic network N that is C-orientable.Since C is -chain reducible, it follows by Properties (ii) and (iii) of Definition 5 that applying an -chain reduction to N gives a directed binary phylogenetic network N that is C-orientable.Since N can be obtained from N by adding leaves and C is leaf-addable, N is C-orientable.

FPT algorithm parameterized by the level
Using Algorithms 2 and 3, in this section we establish an FPT algorithm for C-orientation, where the level of the undirected binary phylogenetic network N is the parameter.The main idea is to orient each blob of N and to combine these orientations into an orientation of N .For this second step, we first need the following definitions.
Let N be an undirected binary phylogenetic network and let B be a blob of N .The undirected binary phylogenetic network induced by B is obtained from B by adjoining to each degree-2 vertex u a new leaf x and a new edge {u, x}.Furthermore, for a blob-determined class C of directed binary phylogenetic networks, if N is a member of C, we say that B can be C-rooted at a cut-edge e = {u, v} of N with u ∈ B and v / ∈ B if the undirected binary phylogenetic network induced by B can be C-rooted at the pendant edge incident to u.
Allowing for bi-directed edges, let N o C be the mixed graph obtained from N by directing each cut-edge e of N incident to a blob B away from B if B cannot be C-rooted at e.Note that if a cut-edge e joins two blobs of N and neither blob can be C-rooted at e, then this cut-edge becomes bi-directed.Define T C (N ) to be obtained from N o C by contracting every undirected edge of N o C .Note that (the underlying graph of) T (N ) is a tree as all edges in the blobs of N are undirected in N o C and therefore contracted (and a graph without blobs is a tree).Also note that T C (N ) is not a phylogenetic tree, but a tree in the usual graph-theoretic sense and that all its edges are directed or bidirected.
Let C be an -chain reducible, leaf-addable, blob-determined class of directed binary phylogenetic networks.The FPT algorithm for C-orientation with the level of N as the parameter is described as Algorithm 4. The main idea behind the algorithm is captured by the following proposition.A rooted tree is a directed tree with a single vertex of in-degree 0, called the root, in which all arcs are directed away from the root.Note that a rooted tree may consist of a single vertex.C , then B cannot be C-rooted at {u, v}, and so, as N is a C-orientation of N , it follows that {u, v} is not directed towards u in N .Thus {u, v} is directed away from u in N , that is, {u, v} is directed away from B in N .Therefore if an edge is orientated in N o C , then the orientation of that edge is in agreement with its orientation in N .(In particular, it follows that no edge is bi-directed in N o C .)Therefore, by contracting the arcs of N for which the corresponding edges of N o C have no orientation, we obtain T C (N ).Since T C (N ) is obtained from a directed binary phylogenetic network by contracting arcs, and T C (N ) is a tree, it follows that T C (N ) is a rooted tree.
To prove the converse, assume that the undirected binary phylogenetic network induced by each blob of N has a C-orientation and that T C (N ) forms a rooted tree.Let K be the subgraph of N that contracts to the root of T C (N ).Then either (i) K consists of a single blob B of N , or (ii) K contains at least one cut-edge of N .Depending on whether (i) or (ii) holds, we next show that there exists a C-orientation of N where the root is located either on an edge of B, or on a cut edge e of K.
C by contracting all undirected edges), all of the cut-edges of N incident to a vertex of B are oriented away from B in N o C .Therefore, as the undirected binary phylogenetic network N B induced by B is C-orientable, there exists an edge e ρ of B at which N B can be C-rooted.We now find a C-orientation of N as follows.Subdivide e ρ by inserting the root, and orient the edges in B the same way as they are orientated in N B .Orienting all cut-edges of N away from the root, each blob B = B of N now has exactly one incoming cut-arc, say (u, v).Since T C (N ) is a rooted tree, the undirected binary phylogenetic network induced by B can be C-rooted at the cut-edge incident to v. Orienting the edges of B (and all other such blobs of N ) accordingly, gives a C-orientation of N .For (ii), we subdivide the cut-edge e of K by the root and proceed in the same way as for (i), starting by orienting all cut-arcs away from the root.
The correctness of Algorithm 4 and its running time is established in the next lemma.Proof.The correctness of Algorithm 4 is essentially given in the proof of Proposition 4, and so it is omitted.For the running time, first note that all blobs can be found in O(n 3 ) time by checking for each edge whether it is a cut-edge.The rest of the algorithm consists of two parts.The first part consists of finding all C-rooted edges of the undirected binary phylogenetic networks induced by the blobs of N and a corresponding C-orientation for each such edge (Lines 1-8), while the second part consists of constructing N o C and T C (N ) and, provided T C (N ) is a rooted tree, finding an orientation of the cut-edges and blob edges of N (Lines 9-29).that contains the root is denoted s ρ = {u, v}.As the class of tree-child networks is rooted 3-chain reducible, with respect to e ρ , a rooted 3-chain reduction on N from at least one of u and v results in an undirected binary phylogenetic network that can be tree-child rooted at e ρ .Subfigure (b) shows a rooted 3-chain reduction on N from u, but, as indicated in (b), it cannot be tree-child rooted at e ρ .However, as shown in Subfigure (c), a rooted 3-chain reduction from v results in an undirected binary phylogenetic network that can be tree-child rooted at e ρ .
Definition 7. A class C of directed binary phylogenetic networks is rooted -chain reducible if the following property holds: Let N be an undirected binary phylogenetic network and let e ρ be a pendant edge of N .Let s ρ = {u, v} be the side of G(N ) containing e ρ and let N u and N v be rooted -chain reductions from u and v, respectively, with respect to e ρ .If N can be C-rooted at e ρ , then at least one of N u and N v can be C-rooted at e ρ .
An example illustrating these definitions is given in Figure 11, where C is the class of binary tree-child networks.Note that, we will eventually show that the class of binary tree-child networks is rooted 3-chain reducible (Lemma 8).
The next two lemmas will be used to show that if a class of directed binary phylogenetic networks is rooted -chain reducible, leaf-addable, and blob-determined, then it is -chain reducible.
Lemma 5. Let C be a rooted -chain reducible, leaf-addable class of directed binary phylogenetic networks, and let N be an undirected binary phylogenetic network that is C-orientable.Let N be the undirected binary phylogenetic network obtained from N by an -chain reduction on N .Suppose that s = {u, v} is a side of G(N ) that contains at least leaves.Let c 1 , c 2 , . . ., c ns denote the leaves of N on s ordered from u to v, and let c 1 , c 2 , . . ., c denote the leaves of N on s ordered from u to v. Then each of the following hold: (ii) If j ∈ {1, 2, . . ., n s } and N can be C-rooted at c j , then N can be C-rooted at c i for some i satisfying j ∈ {i, i + 1, . . ., n s − ( − i)}.
Proof.For (i), suppose that N can be C-rooted at c i , where i ∈ {1, 2, . . ., }, and let N i be a C-orientation of N rooted at c i .Let j ∈ {i, i + 1, . . ., n s − ( − i)}.Now construct an orientation N j of N from N i as follows.First, add back j − i leaves on the directed path from the neighbour u i of c i to u and add back (n s − j) − ( − i) leaves on the directed path from u i to v relabelling the leaves ordered from u i to u and u i to v as c j−1 , c j−2 , . . ., c 1 and c j+1 , c j+2 , . . ., c ns , respectively, and relabelling the leaf adjacent to u i as c j .Note that, as j ≤ n s − ( − i), it follows that (n s − j) − ( − i) ≥ 0. Now extend the resulting orientation by adding back the remaining leaves deleted in the reduction at their original location.This gives N j , an orientation of N rooted at c j .Since C is leaf-addable and N i is a C-orientation, it follows that N j is a C-orientation of N rooted at c j .This establishes (i).
To prove (ii), suppose that N can be C-rooted at c j , where j ∈ {1, 2, . . ., n s }.Since C is rooted -chain reducible, there is a rooted -chain reduction N on N with respect to the edge incident with c j that can be rooted at c j .Without loss of generality, we may assume that in this reduction we deleted all the leaves on s between the neighbour u j of c j and u, and if there are at least leaves on s between u j and v, we deleted all but − 1 of these leaves.
First assume that j ≥ n s − ( − 1), and let j = n s − t, where t ≤ − 1.In this case, no leaves of N on s are deleted between u j and v to obtain N .Thus N has exactly t + 1 leaves on s and (by definition of c j and of rooted -chain reduction) N can be C-rooted at c j the first leaf on s ordered from u to v. Let N j denote a C-orientation of N rooted at c j .We next construct an orientation N i of N from N j as follows.Add back − (t + 1) leaves on the directed path from u j to u, so that we have exactly leaves on s, and relabel the leaves ordered from u j to u and from u j to v as c i−1 , c i−2 , . . ., c 1 and c i+1 , c i+2 , . . ., c , respectively, and relabel c j as c i .This gives N i .Since G(N i ) is isomorphic to G(N ) and each side s of G(N i ) and G(N ) contains the same number of leaves, it follows that, up to relabelling the leaves on each side, N i is an orientation of N .Thus, as C is leaf-addable, N has a C-orientation rooted at c i , where i Now assume that j < n s − ( − 1).Then, by applying the rooted -chain reduction, we delete all leaves of N on s between u and u j while keeping the network C-rootable at the leaf-edge incident to u j .Hence, we have that N can be C-rooted at the first leaf on s ordered from u to v.Moreover, as j < n s − ( − 1), side s of N contains exactly leaves.Therefore, as G(N ) is isomorphic to G(N ), up to relabelling the leaves on each side, N is isomorphic to N .Hence, N can be C-rooted at c 1 .Since j ≥ i and n s − ( − i) ≥ n s − ( − 1) > j as i ≥ 1, we have j ∈ {i, i + 1, . . ., n s − ( − i)}, again, as required.This completes the proof of (ii) and the lemma.
The next lemma is the non-pendant edge analogue of Lemma 5. Lemma 6.Let C be a rooted -chain reducible, leaf-addable, blob-determined class of directed binary phylogenetic networks, and let N be an undirected binary phylogenetic network that is C-orientable.Let N be the undirected binary phylogenetic network obtained from N by an -chain reduction on N .Suppose that s = {u, v} is a side of G(N ) that contains at least leaves.Let e 0 , e 1 , . . ., e ns denote the edges of N on s ordered from u to v, and let c 1 , c 2 , . . ., c l denote the leaves of N on s ordered from u to v. Then each of the following hold: (i) If i ∈ {1, 2, . . ., } and N can be C-rooted at c i , then N can be C-rooted at e j for all j ∈ {i − 1, i, . . ., n s − ( − i)}.
(ii) If j ∈ {0, 1, . . ., n s } and N can be C-rooted at e j , then N can be C-rooted at c i for some i satisfying j ∈ {i − 1, i, . . ., n s − ( − i)}.
Proof.Let e j be an edge of N on s, and let N j be the undirected binary phylogenetic network obtained from N by subdividing e j with a new vertex and adjoining a new leaf to this vertex via a new edge.Let c 1 , c 2 , . . ., c ns+1 denote the leaves of N j on s ordered from u to v. Thus c j+1 is the new leaf.Note that G(N ) = G(N j ).Since C is blob-determined, N j can be C-rooted at c j+1 if and only if N can be C-rooted at e j .Let N j be the undirected binary phylogenetic network obtained from N j by an -chain reduction on N j .
For the proof of (i), assume that N can be C-rooted at c i , where i ∈ {1, 2, . . ., }.Let j ∈ {i − 1, i, . . ., n s − ( −i)}.Up to relabelling leaves, N j is isomorphic to N , and so N j can be C-rooted at the i-th leaf on s ordered from u to v. Therefore, as N j has n s + 1 leaves on side s, it follows by Lemma 5(i) applied to N j that N j can be C-rooted at c j for all j ∈ {i, i + 1, . . ., (n s − ( − i)) + 1}.In particular, as j + 1 ∈ {i, i + 1, . . ., (n s − ( − i)) + 1}, we have that N j can be C-rooted at c j+1 .Thus N can be C-rooted at e j .
To prove (ii), assume that N can be C-rooted at e j , where j ∈ {0, 1, . . ., n s }.Then N j can be C-rooted at c j+1 .To see this, take a C-orientation of N rooted at e j , and orient the edges of N j , except the pendant edge incident with c j+1 , in the same direction as the corresponding edges of the C-orientation of N .Now subdivide the edge incident with c j+1 by a vertex w and orient the two edges incident with w away from it.The resulting directed binary phylogenetic network is a C-orientation of N j rooted at c j+1 .
By Lemma 5(ii), N j can be C-rooted at c i for some i satisfying j + 1 ∈ {i, i + 1, . . ., (n s − ( − i)) + 1}.Since N j is isomorphic to N up to relabelling leaves, N can be C-rooted at c i for some i satisfying j ∈ {i − 1, i, . . ., n s − ( − i)}.This completes the proof of (ii) and the lemma.
A consequence of the last two lemmas is the following proposition.
Proposition 5. Let C be a rooted -chain reducible, leaf-addable, blob-determined class of directed binary phylogenetic networks.Then C is -chain reducible.
Proof.To see that C is -chain reducible, observe that properties (i) and (ii) of -chain reducibility follow directly from Lemmas 5 and 6, while property (iii) of -chain reducibility is a consequence of C being leaf-addable.

Tree-child networks
In this section, we establish Theorem 6. Recall that a directed binary phylogenetic network N is tree-child if every non-leaf vertex has a child that is a tree vertex.Equivalently, N is tree-child if and only if N has no stack reticulations, two reticulations one of which is the parent of the other, and no sibling reticulations, two reticulations sharing a common parent (see [Sem16]).This equivalence will be used throughout this subsection.
Let N be a directed binary phylogenetic network.Since adding leaves to N cannot create any stack or sibling reticulations, it follows that the class of binary tree-child networks is leaf-addable.The next two lemmas show that this class is also blob-determined and rooted 3-chain reducible, and thus, by Proposition 5, 3-chain reducible.
Lemma 7. The class of binary tree-child networks is blob-determined.
Proof.Let N be a directed binary phylogenetic network.If N is tree-child, then N has no stack and no sibling reticulations, and so every directed binary phylogenetic network induced by a blob of N is tree-child.Now suppose that all directed binary phylogenetic networks induced by a blob of N are tree-child.Then each such network has no stack and no sibling reticulations.Observe that every reticulation of N is contained in a blob of N and that both parents of a reticulation are in the same blob (because there are paths from the root to each parent).If N contains sibling reticulations, then (for similar reasons) their common parent must be in the same blob as each of the reticulations, and so the network induced by this blob would also contain sibling reticulations, a contradiction.Similarly, N cannot contain stacks.Thus N is tree-child.This completes the proof of the lemma.By Lemma 7, the class of binary tree-child networks is blob-determined.Therefore, as explained in Section 4.1, in the process of deciding if an undirected binary phylogenetic network N has a tree-child orientation, we may assume that N has no non-trivial pendant phylogenetic subtrees.The analogous assumption holds for other classes.
Lemma 8.The class of binary tree-child networks is rooted 3-chain reducible.
Proof.Let N be an undirected binary phylogenetic network that can be tree-child rooted at a pendant edge e ρ = {v ρ , x ρ }, where x ρ is a leaf, and let N d be a tree-child orientation of N rooted at e ρ .Note that v ρ is a tree vertex in N d .Recall that we assume that N , and therefore N d , has reticulation number at least 2, so G(N d ) is well defined and has two sides s 1 and s 2 leaving v ρ .We next construct a directed binary phylogenetic network N d from N d as follows.First, for each side s of G(N d ) that is neither s 1 nor s 2 and contains at least two leaves, delete all except one of the leaves of N d on s and suppress the resulting vertices of in-degree one and out-degree one.At this stage of the construction, it is easily seen that the resulting directed binary phylogenetic network remains tree-child, as no stack and no sibling reticulations have been created.Continuing the construction, delete all leaves of N d that are on either s 1 or s 2 of G(N d ), and suppress the resulting vertices of in-degree one and out-degree one.This gives N d .Like the first part, the second part of the construction also preserves the property of being tree-child.To see this, observe that at most one of s 1 and s 2 has a reticulation as an endvertex; otherwise, N has a reticulation cut, contradicting Proposition 2. Hence, N d has no sibling reticulations.Moreover, as the root of N d is not a reticulation, it follows that N d has no stack reticulations.Hence N d is tree-child.Let N denote the underlying undirected binary phylogenetic network of N d , and let s ρ be the side of G(N ) containing x ρ .We next show that each side s = s ρ of G(N ) contains at most three leaves of N .To see this, s corresponds to at most two sides of G(N d ); if s corresponds to exactly two sides, then these sides meet at a reticulation of N d with a leaf as a child (see Figure 12).Thus s contains at most three leaves of N .On the other hand, the side s ρ of G(N ) corresponds to at most three sides of G(N d ).Namely, s 1 , s 2 , and a third side s 3 if an internal vertex of s ρ corresponds to a reticulation r of N d (see Figure 12).If a third side s 3 exists, then r is the parent of a leaf of N d .Sides s 1 and s 2 of G(N d ) contain no leaves of N d and, if it exists, s 3 contains at most one leaf of N d .In addition, the leaf x ρ is on the side s ρ of G(N ) and, if s 3 exists and r has a child that is a leaf, then this leaf is also on the side s ρ of G(N ).Hence the side s ρ also contains at most three leaves of N in total, where x ρ is either the first or the last leaf when the leaves of N on s ρ are ordered.
Let N r be the undirected binary phylogenetic network obtained from N by applying a rooted 3-chain reduction with respect to e ρ .Since G(N r ) = G(N ), it follows that N r can be obtained from N by adding leaves and, if necessary, relabelling leaves.Therefore, as N can be tree-child rooted at e ρ and the class of tree-child networks is leaf-addable, N r can be tree-child rooted at e ρ .Hence N is 3-chain reducible with respect to e ρ .It now follows that the class of binary tree-child networks is 3-chain reducible.By Lemmas 7 and 8, the algorithms of Section 4 are applicable to the class of binary tree-child networks.Thus, by Theorem 4, Theorem 7 holds provided g(L, ) is a computable function.We end this subsection with the following lemma, which shows that this is indeed the case.
Lemma 9. Let C be the class of binary tree-child networks, and let N be a directed binary phylogenetic network.Then deciding if N is in C takes O(n) time, where n is the number of vertices in N .Proof.To check whether N is tree-child, we simply need to check that no reticulation is in a stack or in a pair of sibling reticulations.Since this only requires checking the (local) neighbourhood of each vertex, which is of size at most three as N is binary, this check can be executed in linear time.

Discussion
We have answered several foundational questions regarding the orientation of undirected phylogenetic networks.We have also shown that some of our results apply to partly-directed phylogenetic networks.Nevertheless, many interesting questions remain open.
Our results do not apply directly to some of the phylogenetic networks published in the biological literature.The reason for this is that these phylogenetic networks fall outside the framework of our definition.It would be interesting to consider modifications of the definition given here that allow for the study of such networks from a mathematical point of view.For example, the phylogenetic network of grape cultivars in [MBO + 11, Fig. 3] contains several interesting complications.Firstly, it can be directly observed that any orientation of this phylogenetic network needs to have multiple roots (this can, for example, be concluded from the part of the network containing Muscat of Alexandria, Muscat Hamburg, and Trollinger).Secondly, as well as undirected and directed edges, the phylogenetic network contains dotted edges joining pairs of cultivars which are siblings or equivalent.Other examples include the phylogenetic network of bears in [KLB + 17, Fig. 4] and the phylogenetic network of the evolutionary history of Europeans in [Laz18, Fig. 1].The first of these phylogenetic networks contains bidirected arcs, which we have not taken into account in this paper, while the second has dotted edges indicating that the direction is either unclear (corresponding to our undirected edges) or bidirectional.
More explicit (computational) questions are the following.Given an undirected binary phylogenetic network N , the problem of deciding if N has a tree-based orientation is NP-complete (Section A.6).Although we have shown that the analogous decision problems for the classes of binary tree-child and binary stack-free networks are fixed-parameter tractable with respect to the level of N , it remains open whether these problems are polynomialtime solvable.We expect both decision problems to be NP-complete, but have not found a proof.A related question concerns undirected nonbinary phylogenetic networks.It is common in the literature for directed nonbinary phylogenetic networks to have the restriction that each reticulation has exactly one outgoing arc.Calling such phylogenetic networks with this restriction funneled, an open question is whether one can decide in polynomial time if a given undirected nonbinary phylogenetic network has a funneled orientation.This is not always the case, as can be seen (with some effort) from the example shown in Figure 13.Another question is whether our results generalize to directed phylogenetic networks with a root of outdegree 1 or out-degree greater than 2. This only makes sense when we are allowed to root an undirected phylogenetic network at an existing vertex, instead of at an edge as we have assumed in this paper.Note that, for directed binary phylogenetic networks that are blob determined, rooting at an edge is equivalent to adding a leaf to that edge, and rooting along the resulting pendant edge.Similarly, rooting at a vertex is equivalent to attaching a leaf to the vertex via a new edge, and rooting along this new edge.For these reasons, we expect our results to generalize.Finally, it would be interesting to find out whether the results in Section 5 generalize to partly-directed phylogenetic networks.

A.1 Some classes of directed binary phylogenetic networks
For a class C of directed phylogenetic networks, we say that an undirected phylogenetic network N is Corientable if N is the underlying phylogenetic network of some directed phylogenetic network N in C. If this is the case, N is called a C-orientation of N .We consider the following prominent classes of directed binary phylogenetic networks, see also Figure 14.A vertex v of a directed binary phylogenetic network N is visible if there is a leaf ∈ X such that every path from the root of N to traverses v. tree-child valid stack-free tree-based orchard reticulation-visible Figure 14: An overview of the directed binary phylogenetic network classes considered in this paper.Note that there are eleven regions and each of them can be shown to be nonempty.Also note that, in the nonbinary case, the landscape looks a bit different.
Let N be a directed binary phylogenetic network on X.Then • N is tree-child if every non-leaf vertex has a child that is a tree vertex.It is straightforward to show that N is tree-child if and only if every vertex is visible.For example, the directed phylogenetic network in Figure 1 is tree-child.
• N is stack-free if no reticulation has a reticulation as a child.Clearly, the class of tree-child networks is contained in the class of stack-free networks.See Figure 15 for an example of an undirected binary phylogenetic network that is orientable, but not stack-free orientable (and hence not tree-child orientable).
• N is tree-based if it can be obtained from a directed binary phylogenetic tree, called a base-tree, in which the root may have out-degree 1 or 2, by subdividing arcs of the tree (any number of times) and adding arcs (called linking arcs) between the subdividing vertices [FS15,JI18].The class of binary tree-based networks contains the class of binary stack-free networks [Zha16].For an example of an undirected binary phylogenetic network that is orientable but has no tree-based orientation, consider the undirected binary phylogenetic network N in Figure 16.It is easily checked that N is orientable.To see that N is not tree-based orientable, suppose N has such an orientation.Now N has, as subgraphs, two vertex-disjoint subdivisions of the Petersen graph, and at least one of these subdivisions does not contain the root edge.Thus, ignoring the orientation of the arcs, a base-tree of this orientation would realise (together with an extra edge) a Hamiltonian cycle of the Petersen graph.But it is well known that the Petersen graph is not Hamiltonian.
• N is valid if deleting any reticulation arc and suppressing its end-vertices results in a directed binary phylogenetic network.The class of valid networks is contained in the class of stack-free networks and contains the class of tree-child networks [MvIJ + 19].
• N is reticulation-visible (or stable) if every reticulation is visible, in which case N is stack-free (see [SS18]).
We list a few relations between classes of directed binary phylogenetic networks.The class of level-1 networks is contained in the class of tree-child networks.To see this, first note that a directed binary phylogenetic network is tree-child precisely if it has no vertex whose two children are both reticulations, and no reticulation whose only child is also a reticulation (see [Sem16]).It is easily checked that, if a directed binary phylogenetic network has such a pair of reticulations (that have a common parent or are adjacent), then this pair is in the same biconnected component.Therefore all level-1 networks are tree-child.Furthermore, the class of level-2 networks is not contained in the class of stack-free networks (consider a network with exactly two reticulations, one of which is the child of the other) and the class of level-3 networks is not contained in the class of tree-based networks (see e.g.[JI18, Figure 3]).
x y x 1 x 2 x 3 x 4 x 5 Figure 15: Two undirected binary phylogenetic networks that are orientable (where the root can be inserted into any edge) but not stack-free orientable.The network to the right can be extended to any number of leaves.
A further class of directed binary phylogenetic networks is defined based on the notion of cherry picking.Let N be a directed binary phylogenetic network.A cherry of N is a pair of leaves with the same parent.Picking a cherry means deleting one leaf of the cherry and suppressing its parent (where suppressing a vertex v with exactly one parent u and exactly one child w means that we delete v and add an arc (u, w)).A reticulated cherry of N is a pair of leaves connected by an (underlying) undirected path with two internal vertices, exactly one of which is a reticulation.Picking a reticulated cherry consists of deleting the middle arc of this path and suppressing its endpoints.We say N is an orchard network if it can be reduced to a single cherry by repeatedly picking cherries and reticulated cherries.In particular, all tree-child networks are orchard networks [BS16].If N is an orchard network and N is obtained from N by picking either a cherry or a reticulated cherry, then N is an orchard network.This leads to a linear-time algorithm for deciding whether an arbitrary directed binary network is an orchard network [ESS19,JM21].It is also used in the proof of the following proposition which shows that all orchard networks are tree-based.Proposition 6.The class of binary orchard networks is contained in the class of binary tree-based networks.
Proof.Let N be an binary orchard network.The proof is by induction on the number k of arcs of N .If k = 2, then N consists of a pair of leaves adjoined to the root, and so N is tree-based.Now suppose that k ≥ 3 and that all binary orchard networks with at most k − 1 reticulation arcs are tree-based.Since N is orchard, it contains either a cherry or a reticulated cherry.Let N be the binary orchard network obtained from N by picking a cherry or reticulated cherry.Since N is orchard, it follows by the induction assumption that N can be obtained from a directed binary phylogenetic tree T by subdividing arcs of T and adding linking arcs between the subdividing vertices.
First suppose that N is obtained from N by picking a cherry consisting of leaves x and y, and say that leaf y is deleted.Let T be the directed binary phylogenetic tree obtained from T by adding leaf y as a sibling of x, i.e., subdividing the pendant arc directed into x with a vertex p and adding the arc (p, y).Then N can be obtained from T by subdividing arcs of T and adding linking arcs between the subdividing vertices in exactly the same way as N is obtained from T .Now suppose that N is obtained from N by picking a reticulated cherry in which the arc (u, v) is deleted.Then N can be obtained from T by subdividing arcs of T and adding linking arcs between the subdividing vertices in the same way as N is obtained from T except that the arc (u, v) is also added as a linking arc.The result now follows.
x y Figure 16: An undirected binary phylogenetic network N that is orientable but not tree-based orientable.
In the remainder of this section, we prove the following.
Theorem 7. Let C be a class of directed binary phylogenetic networks.If C is tree-child, stack-free, tree-based, reticulation-visible, valid, or orchard, then Algorithm 4 is an FPT algorithm for deciding whether an undirected binary phylogenetic network N has a C-orientation, where the level of N is the parameter.
The proof for stack-free is completely analogous to the proof for tree-child, which has been dealt with in Theorem 6.The remaining classes are treated in the following subsections A.2-A.5.

A.2 Tree-based networks
In this section, we establish Theorem 7 for the class of tree-based networks.There are several characterizations of tree-based networks, and we will use the following due to [Zha16] (also see [Hay21,JI18]).Let N be a directed binary phylogenetic network.A chain of sibling reticulations of N is a sequence of (not necessarily distinct) vertices u 1 , v 1 , u 2 , . . ., u k , v k , u k+1 such that, for all i ∈ {1, 2, . . ., k}, the vertex v i is a reticulation and a child of u i and u i+1 .Observe that u 2 , u 3 , . . ., u k are necessarily tree vertices.If, in addition, u 1 and u k+1 are both reticulations, we say this chain is terminating.The above-mentioned characterization is that N is tree-based if and only if N has no terminating chain of sibling reticulations.
Let N be a directed binary phylogenetic network.If N is tree-based, then, as adding leaves to N cannot create a terminating chain of sibling reticulations, it follows that the class of binary tree-based networks is leaf-addable.Moreover, by a similar argument to that proving Lemma 7, this class is blob-determined because if N has a terminating chain of sibling reticulations, it must be contained in a blob of N .The next lemma shows that the class of binary tree-based networks is rooted 2-chain reducible.
Lemma 10.The class of binary tree-based networks is rooted 2-chain reducible.
Proof.Let N be an undirected binary phylogenetic network that can be tree-based rooted at a pendant edge e ρ = {v ρ , x ρ }, where x ρ is a leaf, and let N d be a tree-based orientation of N rooted at e ρ .Note that v ρ is a tree vertex in N d .Let s 1 and s 2 denote the two sides of G(N d ) leaving v ρ .We next construct a directed binary phylogenetic network N d from N d based on G(N ).
Let s ρ be the side of G(N ) containing the root, and let P sρ be an undirected path of N corresponding to s ρ .First consider the sides s = s ρ of G(N ).If s corresponds to a single side of G(N d ), delete all except one of the leaves of N d that are on s, and suppress any resulting vertices of in-degree one and out-degree one.This creates no terminating chain of sibling reticulations.If s corresponds to two sides of G(N d ) meeting at a reticulation r with a leaf-child x r , then delete all leaves of N d on s except for x r and one other leaf, and suppress any resulting vertices of in-degree one and out-degree one.This again ensures that no terminating chain of sibling reticulations are introduced.Now consider s ρ ,which corresponds to at most three sides of G(N d ), namely s 1 , s 2 and, if an internal vertex of P sρ corresponds to a reticulation r in N d adjacent to a leaf, a third side s 3 (see Figure 12).If there is no such third side, then delete all leaves of N d on s 1 and s 2 , and suppress any resulting vertices of in-degree one and out-degree one.If there is such a third side s 3 , delete all leaves of N d on s 1 , s 2 , and s 3 , and suppress any resulting vertices of in-degree one and out-degree one.Note that, by definition, x ρ and the child of r are not deleted.Again, no terminating chain of sibling reticulations are created as one end-vertex of either s 1 or s 2 is a tree vertex of N d whose parent is also a tree vertex.This gives N d .Taking the same approach as that which concluded the proof of Lemma 8, it now follows that the class of binary tree-based networks is rooted 2-chain reducible.
Since deciding if a directed binary phylogenetic network with n vertices is tree-based takes O(n) time [Zha16,Hay21], it now follows that Theorem 7 holds for the class of tree-based networks.cherries until the only leaf of the pendant subtree that remains is x .Hence, by omitting these cherry-picking operations from S, we can continue to apply the resulting sequence to N d .Now assume that we have reached (ii).Then, applying S to N d , the child of r is a leaf, y say.At this point, in the analogous application of S to N d , the next operation involves picking a reticulated cherry R, where y ∈ R.There are two possibilities depending on whether x ∈ R. If R = {x, y}, then picking {x, y} results in each of u and u being the roots of pendant phylogenetic subtrees, in which case we may assume that the leaves in the pendant phylogenetic subtree rooted at u are systematically deleted via picking cherries until x is a child of u and, similarly, the leaves in the pendant phylogenetic subtree rooted at u are systematically deleted via picking cherries until y is a child of u .Therefore, by picking the reticulated cherry {x, y}, and omitting the operations involving the picking cherries of the two pendant phylogenetic subtrees from S, we can continue to apply the resulting sequence to N d .
If R = {y, z}, then z is a leaf of N d on side s .Here, picking {y, z} again results in u and u being the roots of pendant phylogenetic subtrees, and so we may assume that the leaves in each of these pendant phylogenetic subtrees are systematically deleted until x is a child of u and z is a child of u .Therefore, by replacing {x, y} with {y, z} in S and omitting the operations involving the picking of cherries of the two pendant phylogenetic subtrees, we can continue to apply the resulting sequence to N d but with z replaced by y.A routine induction argument now shows that N d is orchard.
Let N denote the underlying undirected binary phylogenetic netwoork of N d .Using an argument analogous to that in the proof that showed the class of binary tree-child networks is rooted 3-chain reducible, each side of G(N ) contains at most three leaves.Furthermore, if N r is the undirected binary phylogenetic network obtained from N by applying a rooted 3-chain reduction rooted at e ρ , then N r can be obtained from N by adding leaves and, if necessary, relabelling leaves.It follows by Lemma 11 that, as N can be orchard rooted at e ρ , the class of binary orchard networks is rooted 3-chain reducible.
Since deciding if a directed binary phylogenetic network with n vertices is orchard takes O(n) time [JM21], it follows by combining Proposition 5 with Lemmas 11, 12, and 13 that Theorem 7 holds for the class of orchard networks.

A.4 Valid networks
Recall that a directed binary phylogenetic network is valid if deleting any reticulation arc and suppressing its end-vertices results in a directed binary phylogenetic network.In particular, this implies that the resulting directed graph has no parallel arcs and no unlabelled out-degree-0 vertices.It is shown in [MvIJ + 19] that a directed binary phylogenetic network N is valid if and only if N contains no stack reticulations and no camels.A camel is two sibling reticulations in which the common parent and one of the reticulations share a common parent.An illustration of a camel is shown in Figure 17.Using this characterization and taking the same approach as that taken for binary tree-child and binary stack-free networks, it can be shown that the class of binary valid networks is rooted 3-chain reducible, leaf-addable, and blob-determined, and that deciding if a directed binary phylogenetic network N is valid takes O(n) time, where n is the number of vertices of N .It now follows that Theorem 7 holds for the class of binary valid networks.Left, the undirected binary phylogenetic network, N say, from [FHM18], in which all potential root edges are solid.It follows from the discussion related to Figure 16 that N has no base-tree.Right, a tree-based orientation of N , where the root is indicated with a square vertex.The base-tree of the orientation (solid arcs) does not induce a base-tree of N .

A.5 Reticulation-visible networks
Lastly, in this section, we show that Theorem 7 holds for the class of reticulation-visible networks.Recall that a directed binary phylogenetic network N is reticulation-visible if, for each reticulation r, there is a leaf x such that every path from the root of N to x traverses r, in which case r is said to be visible from x.It is easy to see that the class of binary reticulation-visible networks is leaf-addable and blob-determined.We now show that this class is rooted 3-chain reducible.
Lemma 14.The class of binary reticulation-visible networks is rooted 3-chain reducible.
Proof.Let N be an undirected binary phylogenetic network that can be reticulation-visible rooted at a pendant edge e ρ = {v ρ , x ρ }, where x ρ is a leaf, and let N d be a reticulation-visible orientation of N rooted at e ρ .In a now familiar way, we next construct a directed binary phylogenetic network N d from N d as follows.Let s 1 and s 2 denote the two sides of G(N d ) leaving v ρ .First, for each side of G(N d ) that is neither s 1 nor s 2 , delete all except one of the leaves of N d on s and suppress the resulting vertices of in-degree one and out-degree one.At this stage of the construction, the resulting directed binary phylogenetic network is reticulation-visible since, if a reticulation r of N d is visible from a leaf x that is on side s of G(N d ), then r is visible from each leaf on side s.Continuing the construction, delete all leaves on s 1 and s 2 .As no reticulation of N d is visible from any of these leaves, the resulting directed binary phylogenetic network N d is reticulation-visible. Analogous to the way in which the proof of Lemma 8 is completed, it can now be shown that the class of binary reticulation-visible networks is rooted 3-chain reducible.
We next show that deciding if a directed binary phylogenetic network is reticulation-visible can be computed in polynomial time, thereby, in combination with the above, establishes Theorem 7 for the class of reticulationvisible networks.
Lemma 15.Let N be a directed binary phylogenetic network.Deciding if N is reticulation-visible can be done in time O(kn), where k and n are the number of reticulations and vertices of N , respectively.Proof.To decide if N is reticulation-visible, it suffices to check, for each reticulation r, whether or not, for each leaf x of N , there is directed path from the root of N to x in the directed graph obtained from N by deleting r and its incident arcs.If there is no such path for some leaf y, then r is visible from y; otherwise r is not visible from any leaf.In a digraph with n vertices, determining which vertices can be reached from some fixed vertex, in this case the root of N , can be done in O(n) time.As N has k reticulations, the lemma now follows.

A.6 Undirected tree-based networks
In this subsection, we prove that the decision problem of deciding whether an undirected binary phylogenetic network has a tree-based orientation is NP-complete but can be solved with our FPT algorithms.To prove NP-hardness, we use a reduction from the NP-complete problem of deciding whether an undirected binary phylogenetic network N is tree-based, which is defined as follows [FHM18].Such a network N is tree-based if N can be obtained from an undirected binary phylogenetic tree, called a base-tree, by subdividing the edges of the tree, and adding edges between the subdividing vertices.While it can be decided in polynomial-time whether a Figure3: Left, a partly-directed phylogenetic network that is semi-directed (it can be rooted along the pendant edge incident with z).Right, a partly-directed phylogenetic network that is not semi-directed.If it were semidirected, then a directed phylogenetic network from which it is obtained would have to be rooted along either the pendant edge incident with x or one of the arcs incident to the neighbour of x; otherwise, there is no directed path from the root to x.This makes (p, z) an arc, which implies that p has the incoming arc (s, p).For similar reasons, the orientation must include (r, s) and (q, r).But then, together with (p, q), these arcs form a directed cycle, a contradiction.

Figure 4 :
Figure4: Two non-isomorphic directed phylogenetic networks that are both orientations of the same undirected phylogenetic network with the same root location and the same set of reticulations.

Figure 5 :Figure 6 :
Figure 5: Illustration of a degree cut.Shown is the graph N ρ obtained from an undirected phylogenetic network N by subdividing an edge e ρ by a new vertex ρ.Each vertex v with d − N (v) > 1, represented by an unfilled vertex, is labelled by d − N (v).A degree cut (V , E ) for (N, e ρ , d − N ) is indicated by taking V to be the set of unfilled vertices and E to be the set of dashed edges.
incoming oriented edges and at least one incident unoriented edge then 6 orient all unoriented edges incident to v away from v 10 return the resulting orientation Algorithm 1: Orientation Algorithm(N, e, d − N )

Figure 7 :
Figure 7: The graph N ρ obtained from the undirected binary phylogenetic network in Figure 2 by subdividing e ρ (the edge indicated with an arrow) by a new vertex ρ.The set E consisting of the dotted edges and the set R consisting of the two square vertices form the reticulation cut (R , E ).

5
Compute N (e, R) = Orientation Algorithm(N, e, d − N ) (using Algorithm 1);6 if N (e,R) is a C-orientation then 7 L := L ∪ {(e, N (e, R))}; 8 Quit the inner for-loop 9 end 10 end 11 end 12 return L Algorithm 2: A simple exponential-time C-orientation algorithm for a class C of directed binary phylogenetic networks.

Lemma 2 .
Let N = (V, E, X) be an undirected binary phylogenetic network with reticulation number k.Then Algorithm 2 applied to N is correct and runs in O(n k+1 (n + f C (n, k))) time, where n = |V | and f C (n, k) is the time-complexity of checking whether a directed binary phylogenetic network with n vertices and k reticulations is in the class C of directed binary phylogenetic networks.Proof.Let e be an edge of N .If N can be C-rooted at e, then there is a set R of k reticulations such that, by Theorem 2, Orientation Algorithm(N, e, R) returns a C-orientation of N rooted along e.Since Algorithm 2 checks all possible locations for the k reticulations, it will find such a C-orientation.The correctness of Algorithm 2 now follows.

Figure 9 :
Figure9: An illustration of an -chain reduction, and (i) and (ii) of Definition 5 applied to an undirected binary phylogenetic network N .The undirected binary phylogenetic network N has been obtained from N by an -chain reduction, where = 5.Here the side s = {u, v} of G(N ) is reduced from n s = 9 to = 5.Now suppose that N is 5-chain reducible.To illustrate (i) of Definition 5, if N can be C-rooted at leaf {u 4 , c 4 } (that is, i = 4), then N can be C-rooted at all edges incident with u j for all j ∈ {4, 5, . . ., 8} (dashed edges).Furthermore, to illustrate (ii) of Definition 5, if N can be C-rooted at the pendant edge incident with u 7 , then N can be C-rooted at {u i , c i } for some i ∈ {1, 2, . . ., 5} satisfying 7 ∈ {i, i + 1, . . ., i + 4}, that is, for some i ∈ {3, 4, 5} (dashed edges).

Figure 10 :
Figure10: An example where (iii) of Definition 5 is not satisfied.Suppose that C is the class of stack-free networks (or reticulation-visible networks) and = 2. Then the undirected binary phylogenetic network N can be C-rooted at e since the directed network N r is a C-orientation of N .However, a routine check shows that the undirected binary phylogenetic network N obtained by performing an -chain reduction on N cannot be C-rooted at e. Furthermore, both (i) and (ii) of Definition 5 vacuously hold since neither N nor N can be C-rooted at any of the dashed edges.

19ifLfor
does not contain a pair with f as the first element yet then 20 Set L = L ∪ {(f, N f )}; each j ∈ {i − 1, i, . . ., n s − ( − i)} do 24 Let f = e j ; 25

26ifL
does not contain a pair with f as the first element yet then 27 Set L = L ∪ {(f, N f )}; s ≥ and e is not a pendant edge of N then 32 Do nothing as e is incident with a pendant C-rooted edge of N , and any corresponding C-orientation of N is constructed in Lines 23-29; 33 end 34 end 35 return L; Algorithm 3: An FPT algorithm for C-orientation with the reticulation number of N as the parameter, where C is an -chain reducible, leaf-addable, and blob-determined class of directed binary phylogenetic networks.

Proposition 4 .
Let C be a blob-determined class of directed binary phylogenetic networks, and let N be an undirected binary phylogenetic network.Then N has a C-orientation if and only if, for each blob B of N , the undirected binary phylogenetic network induced by B has a C-orientation, and T C (N ) is a rooted tree.Proof.First assume that N has a C-orientation N , and let B be a blob of N .Since C is blob-determined, N induces a C-orientation of the undirected binary phylogenetic network N B induced by B. Now let {u, v} be a cut-edge of N , where u is a vertex of B. If {u, v} is directed away from B in N o

Lemma 4 . 8
Let N = (V, E, X) be an undirected binary phylogenetic network.Then Algorithm 4 applied to N is correct and runs in time O(g(L, )n+ (L−1)n 3 )) if C is an -chain reducible, leaf-addable, and blob-determined Input: An undirected binary phylogenetic network N with no non-trivial pendant phylogenetic subtrees.Output: A C-orientation of N if it exists, and NO otherwise.1 Find the set of blobs of N ; 2 for each blob B of N do 3 Apply Algorithm 3 to the undirected binary phylogenetic network N B induced by B and let L B be the returned set of pairs (e, B e ) consisting of C-rooted edge e and corresponding orientation B e of N B ; Construct N o C from N by orienting each cut-edge e of N incident to a vertex of a blob B away from B if there is no pair in L B with e as first element (possibly orienting edges in two directions); 9 Construct T C (N ) from N o C by contracting all non-oriented edges in N o C ; 10 if T C (N ) is a rooted tree then 11 Determine the subgraph K of N that is contracted, in Line 9, to the root of T C (N ); 12 if K consists of a single blob B of N then 13 Pick an arbitrary element (e, B e ) ∈ L B and orient B in N according to B e , calling the root vertex ρ; 14 end 15 if K contains a cut-edge then 16 Subdivide an arbitrary cut-edge e by the root ρ; 17 end 18 Orient all cut-edges of N away from ρ; 19 for each unoriented blob B of N do 20 Find the cut-arc (u, v) entering B ; 21 Let {v, x} be the cut-edge incident to v in the network induced by B ; 22 Find a pair ({v, x}, B {v,x} ) ∈ L B ; 23 Orient the edges of B in N as in B {v,x} ; An FPT algorithm for C-orientation with the level of N as the parameter, where C is an -chain reducible, leaf-addable, and blob-determined class of directed binary phylogenetic networks.class of directed binary phylogenetic networks, where n = |V |, L is the level of N , and g is a function of L and independent of n.

ByFigure 11 :
Figure11: An example of rooted 3-chain reductions.Subfigure (a) shows an undirected binary phylogenetic network N that has a tree-child orientation rooted at edge e ρ as shown below it.The side of the generator G(N ) that contains the root is denoted s ρ = {u, v}.As the class of tree-child networks is rooted 3-chain reducible, with respect to e ρ , a rooted 3-chain reduction on N from at least one of u and v results in an undirected binary phylogenetic network that can be tree-child rooted at e ρ .Subfigure (b) shows a rooted 3-chain reduction on N from u, but, as indicated in (b), it cannot be tree-child rooted at e ρ .However, as shown in Subfigure (c), a rooted 3-chain reduction from v results in an undirected binary phylogenetic network that can be tree-child rooted at e ρ .

Figure 12 :
Figure 12: The (generic) correspondence of the undirected sides of the generator of an undirected binary phylogenetic network N to the directed sides of the generator of an orientation N of N .If a side {u, v} of G(N ) does not contain the root edge, this side corresponds to either (a) one side of G(N ) or (b) two sides of G(N ) separated by a reticulation with a leaf child.If the side {u, v} of G(N ) does contain the root ρ, this side corresponds to either (c) the two sides of G(N ) incident with ρ, or to three sides of G(N ) as shown in (d).In this figure, all degree-one vertices are leaves, except the ones labeled u or v.

Figure 13 :
Figure 13: An undirected nonbinary phylogenetic network that has no funneled orientation.

Figure 17 :
Figure 17: A camel, where the common parent v of the two reticulations and w, one of the two reticulations, share a common parent (also see [Hay21, Figure 3]).

Figure 18 :
Figure18: An undirected binary phylogenetic network that has a tree-based orientation, but is not tree-based.Left, the undirected binary phylogenetic network, N say, from[FHM18], in which all potential root edges are solid.It follows from the discussion related to Figure16that N has no base-tree.Right, a tree-based orientation of N , where the root is indicated with a square vertex.The base-tree of the orientation (solid arcs) does not induce a base-tree of N .