Phylogenetic networks allow modeling reticulate evolution, capturing events such as hybridization and horizontal gene transfer. A fundamental computational problem in this context is the Tree Containment problem, which asks whether a given phylogenetic network is compatible with a given phylogenetic tree. However, the classical statement of the problem is not robust to poorly supported branches in biological data, possibly leading to false negatives. In an effort to address this, a relaxed version that accounts for uncertainty, called Soft Tree Containment, has been introduced by Bentert, Malík, and Weller [SWAT’18]. We present an algorithm that solves Soft Tree Containment in \(2^{\mathcal{O}(\Delta_T \cdot k \cdot \log(k))} \cdot n^{\mathcal{O}(1)}\) time, where \(k \mathrel{\vcenter{:}}= \operatorname{sw}(\Gamma) + \Delta_N\), with \(\Delta_T\) and \(\Delta_N\) denoting the maximum out-degrees in the tree and the network, respectively, and \(\operatorname{sw}(\Gamma)\) denoting the “scanwidth” [Berry, Scornavacca, and Weller, SOFSEM’20] of a given tree extension of the network, while \(n\) is the input size. Our approach leverages the fact that phylogenetic networks encountered in practice often exhibit low scanwidth, making the problem more tractable.
2026 10.48550/arXiv.2511.20771 2026-03-12; 2026-06-28
Evolutionary processes are not always represented well by tree-like models, as hybridization, horizontal gene transfer, and other reticulate events often give rise to more complex structures [3], [4]. To capture these evolutionary relationships, researchers use phylogenetic networks, which generalize phylogenetic trees by allowing for “reticulations” that represent non-tree-like events (see the monographs by Gusfield [5] and Huson, Rupp, and Scornavacca [6]).
A fundamental computational problem arising in this context is the Tree Containment problem, which asks whether a given phylogenetic network is “compatible” with (“firmly displays” (see 5)) a given phylogenetic tree, that is, whether the network contains a subdivision of the tree (as a subdigraph respecting leaf-labels). This question is important for reconstruction methods and in the estimation of distances between evolutionary scenarios.
While the Tree Containment problem is known to be NP-hard [7], [8], numerous special cases of practical interest have been shown to admit polynomial-time solutions [7]–[15]. However, the classical formulation of Tree Containment is not robust against branches that are only poorly supported by the biological data. Indeed, to be compatible, all branches must be represented as-is, even when they are weakly supported (see 1 for an example).
To address this limitation, a relaxed version of Tree Containment, called Soft Tree Containment, was proposed by Bentert and Weller [16]. This relaxed framework allows “undoing” contractions of poorly supported branches (contracting low-support branches is a common preprocessing step in network analysis), effectively allowing uncertainty in the form of so-called “soft polytomies”. The corresponding notion of “soft display” (see 5) permits us to resolve each high-degree vertex into a binary tree. Then, the resulting binary resolution of the network ought to firmly display the resulting binary resolution of the tree.
Although Soft Tree Containment, like Tree Containment, remains NP-hard [16], we aim to solve even large instances in practice. To achieve this, we leverage the fact that phylogenetic networks occurring in empirical studies are expected to exhibit a certain degree of tree-likeness, which can be effectively quantified using the recently introduced measure of tree-likeness called “scanwidth” [17]. Our algorithm solves Soft Tree Containment in \(2^{\mathcal{O}(\Delta_{T} \cdot k \cdot \log(k))} \cdot n^{\mathcal{O}(1)}\) time, where \(k \mathrel{\vcenter{:}}=\mathop{\mathrm{sw}}(\Gamma) + \Delta_{N}\), with \(\Delta_{T}\) and \(\Delta_{N}\) denoting the maximum out-degrees in the tree and the network, respectively, and \(\mathop{\mathrm{sw}}(\Gamma)\) denoting the scanwidth of a tree extension that is given as part of the input. (Tree extensions resemble tree decompositions and will be defined formally later.) The algorithm first makes the network binary through “stretching” and “in-splitting”. This special case (where the network is binary but the tree need not be) is then solved via bottom-up dynamic programming along the given tree extension.
On a binary network \(N\) and a binary tree \(T\), the Tree Containment problem can be solved in \(2^{\mathcal{O}(t^2)} \cdot \lvert A(N)\rvert\) time, where \(t\) denotes the treewidth of \(N\) and \(A(N)\) is its arc set [18]. This special case of Tree Containment is also a special case of Soft Tree Containment, as the notions of “firm” and “soft” display coincide when \(N\) and \(T\) are both binary [19]. Additionally, Soft Tree Containment is a generalization of the Cluster Containment problem [19]. Van Iersel, Semple, and Steel [8] show that the latter problem can be solved in polynomial time on binary networks of constant “level”. Note that level-\(c\) networks have scanwidth at most \(c + 1\) [20]. A comparison of the level, scanwidth, and treewidth of real-world phylogenetic networks was conducted by Holtgrefe [20], concluding that treewidth is not much smaller than scanwidth in practice. He further points out that “edge-treewidth” by Magne et al. [21] is the undirected analogue of scanwidth. We also remark that Soft Tree Containment is conceptually similar to Minor Containment: The question of whether a binary network \(N\) softly displays a possibly non-binary tree \(T\) is equivalent to asking if \(T\) can be obtained from a subtree of \(N\) through arc contraction (while preserving leaf-labels). In fact, the reduction of general Soft Tree Containment to this special case is the subject of 4.2. Janssen and Murakami [22] study a similar containment notion based on arc contraction.
A directed graph (or digraph for short) is an ordered pair \(D = (V, A)\) that consists of a non-empty, finite set \(V\) of vertices and a set \(A \subseteq \{(u, v) \in V^2 \mid u \neq v\}\) of arcs. We also use the notation \(V(D) \mathrel{\vcenter{:}}= V\) and \(A(D) \mathrel{\vcenter{:}}= A\). The in-neighbors of a vertex \(v \in V\) are referred to as its parents (denoted \(V^-_D (v)\)), and its out-neighbors are referred to as its children (denoted \(V^+_D (v)\)). The set of incoming arcs of \(v\) is denoted \(A^-_D (v)\), and the set of outgoing arcs of \(v\) is denoted \(A^+_D (v)\). The in-degree of \(v\) is \(\deg^-_D (v) \mathrel{\vcenter{:}}=\lvert V^-_D (v)\rvert\), the out-degree of \(v\) is \(\deg^+_D (v) \mathrel{\vcenter{:}}=\lvert V^+_D (v)\rvert\), and the degree of \(v\) is \(\deg_D (v) \mathrel{\vcenter{:}}=\deg^-_D (v) + \deg^+_D (v)\). The maximum out-degree of any vertex in \(D\) is denoted \(\Delta_{D}\). If the maximum in-degree and the maximum out-degree of \(D\) are both at most \(2\), then \(D\) is called binary. Note that this definition permits a vertex in a binary digraph to have in-degree \(1\) and out-degree \(1\) simultaneously, and also in-degree \(2\) and out-degree \(2\) simultaneously, making it slightly more permissive than the definition often used in phylogenetics that requires every non-root non-leaf vertex in a binary digraph to have degree exactly \(3\). We define the terms root and leaf in a digraph as follows: A root of \(D\) is a vertex with in-degree \(0\), and \(D\) is called rooted if it has exactly one root (denoted \(\mathop{\mathrm{root}}(D)\)). A leaf of \(D\) is a vertex with out-degree \(0\), and the set of all leaves of \(D\) is denoted \(L(D)\). We use \({\geq_D} \subseteq V^2\) to denote the reachability relation of \(D\) (so \(u \geq_D v\) means that there is a directed path from \(u\) to \(v\), possibly having length \(0\)). The irreflexive kernel of \(\geq_D\) is denoted \(>_D\). We say that \(D\) is weakly connected if the underlying graph of \(D\) is connected. The result of removing \(v\) from \(D\) is denoted \(D - v\). We also use the notation \(D - U\) when removing a set of vertices \(U\) from \(D\). If a digraph \(D'\) can be obtained by removing vertices and arcs from \(D\), then \(D'\) is a subdigraph of \(D\), denoted \(D' \subseteq D\), and \(D'\) is called leaf-monotone if, additionally, \(L(D')\subseteq L(D)\). The subdigraph induced by a non-empty set \(U \subseteq V\) is \(D[U] \mathrel{\vcenter{:}}=(U, \{(u, v) \in A \mid u, v \in U\})\). When subdividing an arc \((u, v) \in A\) with a new vertex \(w \notin V\), the arc \((u, v)\) is removed from \(D\), while the vertex \(w\) and the arcs \((u, w)\) and \((w, v)\) are added. The inverse operation, removing \(w\) with its incident arcs and adding \((u, v)\), is called suppression of \(w\). When contracting \((u, v)\), the parents of \(v\), except for \(u\), become parents of \(u\), and the children of \(v\), except for possibly \(u\), become children of \(u\); the vertex \(v\) and its incident arcs are then removed. If \(D\) can be obtained from a digraph \(D'\) by subdividing arcs, then \(D\) is a subdivision of \(D'\). The union of two digraphs \(D\) and \(D'\) is \(D \cup D' \mathrel{\vcenter{:}}=(V(D) \cup V(D'), A(D) \cup A(D'))\). A directed acyclic graph (DAG) is a digraph without directed cycles. An out-tree is a rooted DAG in which every vertex has in-degree at most \(1\).
A (phylogenetic) network is a rooted DAG whose root has out-degree at least \(2\) and in which each non-root vertex either has in-degree \(1\) (and is called a tree vertex) or has out-degree \(1\) (and is called a reticulation), but not both (see 1 (A)). The root of a network is also considered to be a tree vertex. If a network has no reticulations (that is, it is an out-tree), then it is called a (phylogenetic) tree.
Undoubtedly, one of the most successful concepts in algorithmic graph theory is the notion of treewidth [23]. While some problems in phylogenetics yield efficient algorithms on networks of bounded treewidth, the “undirected nature” of treewidth often makes dynamic programming prohibitively complicated or outright unimplementable [24]. Since phylogenetic networks exhibit a “natural flow of information” along the direction of the arcs, Berry, Scornavacca, and Weller [17] introduced a width measure similar to treewidth, but respecting the direction of the arcs (see [25], [26] for previous efforts to port the notion of treewidth to directed graphs), called “scanwidth”. The idea is to “inscribe” the arcs of the network \(N\) into an out-tree \(\Gamma\) (called a “tree extension”) on \(V(N)\), such that all network arcs are directed away from the root of \(\Gamma\) (see 2). This structure allows a bottom-up dynamic-programming approach whose exponential part depends on the size of the set \(\mathop{\mathrm{GW}}_v (\Gamma)\) of arcs of \(N\) that would be cut when slicing just above any vertex \(v\) of \(\Gamma\).
We now give a more comprehensive account of scanwidth and define it formally. Let \(D\) be a DAG. The purpose of scanwidth is to measure how similar \(D\) is to an out-tree. This is motivated by the observation that algorithmic problems can often be solved efficiently on (out-)trees, with the hope that this generalizes to DAGs that have low scanwidth (and are, thus, “similar” to out-trees). Specifically, low scanwidth is supposed to ensure that bottom-up dynamic programming works like on out-trees: Solutions for separate subtrees can be computed independently, and these solutions can be combined efficiently once the parent that connects the subtrees is encountered. Since \(D\) is an arbitrary DAG and not necessarily an out-tree, we first need an appropriate notion of “subtree”. For scanwidth, the subtrees to consider are those of a tree extension of \(D\), which is an out-tree \(\Gamma\) on \(V(\Gamma) = V(D)\) with \(A(D) \subseteq {>_\Gamma}\). That is, the out-tree \(\Gamma\) has the same vertex set as \(D\) and, for every arc \((u, v)\) of \(D\), there is a directed path from \(u\) to \(v\) in \(\Gamma\). This ensures that reachability in \(D\) implies reachability in \(\Gamma\) (but there is generally no direct correspondence between arcs of \(D\) and arcs of \(\Gamma\)). Note that tree extensions generalize topological orderings, and so every DAG has at least one tree extension (which may be a directed path corresponding to a topological ordering).
So we want to solve algorithmic problems on \(D\) via bottom-up dynamic programming along \(\Gamma\), where separate subtrees of \(\Gamma\) represent parts of \(D\) that should be solved independently. Crucially, we need to be able to extend solutions for small subtrees to obtain solutions for larger subtrees. For this to work efficiently, we want the vertices of each subtree of \(\Gamma\) to represent a part of \(D\) that is mostly “self-contained” in the sense that only few arcs in \(D\) cross into the part from the outside. For the subtree of \(\Gamma\) rooted at a vertex \(t \in V(\Gamma)\), these are precisely the arcs of the set \(\mathop{\mathrm{GW}}^D_t (\Gamma) \mathrel{\vcenter{:}}=\{(u, v) \in A(D) \mid u >_\Gamma t \geq_\Gamma v\}\).2 We want even the largest of these sets to be small, and so we define \(\mathop{\mathrm{sw}}_D (\Gamma) \mathrel{\vcenter{:}}=\max_{t \in V(\Gamma)} \lvert\mathop{\mathrm{GW}}^D_t (\Gamma)\rvert\). Then, the scanwidth of \(D\), denoted \(\mathop{\mathrm{sw}}(D)\), is the minimum \(\mathop{\mathrm{sw}}_D (\Gamma)\) over all tree extensions \(\Gamma\) of \(D\).
Scanwidth can be visualized via “scanner lines”, explaining its name: First, lay out the vertices of \(D\) according to \(\Gamma\), where the root of \(\Gamma\) is at the top and the leaves of \(\Gamma\) are at the bottom. Second, draw the arcs of \(D\). The definition of a tree extension ensures that all arcs of \(D\) now point downward. Third, imagine horizontal scanner lines, one above each leaf of \(\Gamma\). Every scanner line cuts through some set of arcs of \(D\). We observe which arcs are cut as a scanner line moves through the drawing from bottom to top, where distinct scanner lines merge into one scanner line once they meet at a vertex. Indeed, the arcs cut by a scanner line that is directly above a vertex \(t \in V(\Gamma)\) are precisely those of the set \(\mathop{\mathrm{GW}}^D_t (\Gamma)\). We will also be interested in the arcs that are cut by scanner lines directly below the vertex \(t\). These are given by the set \(\mathop{\mathrm{HW}}^D_t (\Gamma) \mathrel{\vcenter{:}}=\{(u, v) \in A(D) \mid u \geq_\Gamma t >_\Gamma v\}\). The scanner-line visualization is depicted in 2.
For the purpose of dynamic programming, it will be helpful to assume that we are given a tree extension with special structure: If \(D\) is rooted, then a canonical tree extension \(\Gamma\) of \(D\) is such that \(D[\{v \in V(D) \mid t \geq_\Gamma v\}]\) is weakly connected for all \(t \in V(\Gamma)\) [20]; that is, the part of \(D\) represented by the vertices of the subtree of \(\Gamma\) that is rooted at \(t\) is always weakly connected. This is desirable because it guarantees that \(L(\Gamma) = L(D)\) and \(\deg^+_\Gamma (v) \leq \deg^+_D (v)\) for each \(v \in V(D)\) [17]. In particular, if \(D\) is binary, then so is \(\Gamma\). These properties hold in a canonical tree extension because a vertex \(v\) with greater out-degree in \(\Gamma\) than in \(D\) would be the root of a subtree of \(\Gamma\) corresponding to a part of \(D\) that is not weakly connected. The assumption that a given tree extension is canonical comes at no cost with respect to scanwidth, and only minor cost in running time: Given a non-canonical tree extension \(\Gamma\) of a rooted DAG \(D\), a canonical tree extension \(\Gamma'\) of \(D\) with \(\mathop{\mathrm{sw}}_D (\Gamma') \leq \mathop{\mathrm{sw}}_D (\Gamma)\) can be constructed in polynomial time [20].
Assuming that no ambiguity arises, we may omit sub- or superscripts.
In this paper, we develop a parameterized algorithm for Soft Tree Containment. Informally speaking, this problem, first considered by Bentert, Malík, and Weller [19], asks us to decide if a given phylogenetic tree can be embedded in a given phylogenetic network while taking into account uncertainty in the form of soft polytomies (high-degree vertices to be resolved into a binary tree). We build up to its formal definition ([prob:stc]) in a way that differs slightly from the original. First, we adapt the notion of splitting [16], [22].
Definition 1. Let \(N\) be any network, let \(v \in V(N)\) have out-degree at least \(3\), and let \(u, w \in V^+_N (v)\) be two distinct children of \(v\). Then, out-splitting \(u\) and \(w\) from \(v\) produces the network \(N' \mathrel{\vcenter{:}}=(V(N) \uplus \{x\}, A)\), where \(x \notin V(N)\) is a new vertex and \(A \mathrel{\vcenter{:}}=(A(N) \setminus \{(v, u), (v, w)\}) \cup \{(v, x), (x, u), (x, w)\}\).
Exhaustive out-splitting enables us to resolve a high-out-degree tree vertex into a binary out-tree. Its dual for high-in-degree reticulations is defined below. The definitions are illustrated in 3.
Definition 2. Let \(N\) be any network, let \(v \in V(N)\) have in-degree at least \(3\), and let \(u, w \in V^-_N (v)\) be two distinct parents of \(v\). Then, in-splitting \(u\) and \(w\) from \(v\) produces the network \(N' \mathrel{\vcenter{:}}=(V(N) \uplus \{x\}, A)\), where \(x \notin V(N)\) is a new vertex and \(A \mathrel{\vcenter{:}}=(A(N) \setminus \{(u, v), (w, v)\}) \cup \{(u, x), (w, x), (x, v)\}\).
We now introduce terminology for partially and fully resolved networks. Note that we use a different definition of binary resolution than Bentert, Malík, and Weller [19]. This avoids corner cases violating the intuition behind soft polytomies.
Definition 3. Let \(N\) be a network. Any network that is obtained from \(N\) through exhaustive out-splitting is called a binary out-resolution of \(N\), and any network that is obtained from \(N\) through exhaustive in-splitting is called a binary in-resolution of \(N\). A binary resolution of \(N\) is a binary out-resolution of a binary in-resolution of \(N\).
Note that, to obtain a binary resolution, it does not matter whether in-splitting is performed before out-splitting or after; the order is arbitrary.
When discussing firm and soft display, we want to treat leaves as labeled and all other vertices as unlabeled. This is achieved via the following notion of an isomorphism that agrees with the identity function on all leaves.
Definition 4. Let \(D\) and \(D'\) be DAGs with \(L(D) = L(D')\). Let \(\iota \colon V(D) \to V(D')\) be an isomorphism between \(D\) and \(D'\) with \(\iota |_{L(D)} = \mathrm{id}_{L(D)}\), where \(\iota |_{L(D)} \colon L(D) \to V(D')\) denotes the restriction of \(\iota\) to \(L(D)\). Then, \(\iota\) is called leaf-respecting.
At this point, we have everything needed to define the central notions of display for this work. Recall that, when taking a leaf-monotone subdigraph, no new leaves can be created.
Definition 5 ([19]). Let \(N\) be any network and let \(T\) be any tree. We say that \(N\) firmly displays \(T\) if there is a leaf-respecting isomorphism between a subdivision of \(T\) and a leaf-monotone subdigraph of \(N\). We say that \(N\) softly displays \(T\) if there is a binary resolution \(N'\) of \(N\) as well as a binary resolution \(T'\) of \(T\) such that \(N'\) firmly displays \(T'\).
We are now ready to define the problem under consideration. Note that, for technical reasons, we restrict the input slightly more than Bentert, Malík, and Weller [19]; in particular, networks in our sense cannot contain any vertex that has both in-degree and out-degree \(1\). We believe the problem to become computationally harder with such vertices permitted, despite their insignificance in practice.
A phylogenetic network \(N\) and a phylogenetic tree \(T\) with \(L(T) \subseteq L(N)\). Does \(N\) softly display \(T\)? [19]
We solve this problem in two steps, corresponding to the next two sections. In 4.1, we consider the special case where the given network \(N\) is binary. In 4.2, we describe a reduction mapping an arbitrary network to a binary one.
A \(\mathtt{YES}\)-instance and a \(\mathtt{NO}\)-instance of Soft Tree Containment are depicted in 4. The figure also illustrates some of the notions defined and used in 4.1.
Van Iersel, Jones, and Weller [15] present a dynamic-programming algorithm that uses tree extensions, thereby leveraging low scanwidth, to solve the Tree Containment problem, which asks for firm rather than soft containment. In the following, we adapt their algorithm for our purposes. Although our approach closely follows theirs, the presentation we give here is self-contained. We will highlight both similarities and differences between the two approaches. To start with, we use their definition of a downward-closed subforest and of top arcs in \(T\), which are mapped into the “bags” of a given tree extension of \(N\).
In contrast to the definition of a phylogenetic network/tree, it will be more convenient to work with \(N\) and \(T\) whose roots have out-degree \(1\). This is for technical reasons, a standard practice, and does not limit practical applicability. We also assume to be given a tree extension, ideally of low scanwidth, which might be more problematic in practice, but it allows us to separate the problem of computing/approximating low-scanwidth tree extensions from the problem of deciding soft containment. The following assumption formally introduces these objects, but its scope is restricted to this section and we drop it for 4.2.
Assumption 1. Let \(N^*\) be any binary phylogenetic network, and let \(T^*\) be an arbitrary phylogenetic tree with \(L(T^*) = L(N^*)\). We construct the rooted DAG \(N \mathrel{\vcenter{:}}=(V(N^*) \uplus \{\rho_N\}, A(N^*) \cup \{(\rho_N, \mathop{\mathrm{root}}(N^*))\})\) by attaching a new root \(\rho_N \notin V(N^*)\), and we construct the out-tree \(T \mathrel{\vcenter{:}}=(V(T^*) \uplus \{\rho_T\}, A(T^*) \cup \{(\rho_T, \mathop{\mathrm{root}}(T^*))\})\) by attaching a new root \(\rho_T \notin V(T^*)\). Also, let \(\Gamma\) be a canonical tree extension of \(N\).
We generalize the strict reachability relation defined earlier in order to define reachability between arcs and vertices/arcs. The new reachability relation agrees with the old relation when comparing two vertices.
Definition 6 ([15]). Let \(D\) be a DAG, \(u, v \in V(D)\) vertices, and \((w, x), (y, z) \in A(D)\) arcs. Then, the relation \({>_D} \subseteq (V(D) \uplus A(D))^2\) is defined as follows:
We have \(u >_D v\) if and only if \(u \geq_D v\) and \(u \neq v\),
we have \((w, x) >_D (y, z)\) if and only if \(x \geq_D y\),
we have \(u >_D (y, z)\) if and only if \(u \geq_D y\), and
we have \((w, x) >_D v\) if and only if \(x \geq_D v\) (read: \(v\) is reachable from \((w, x)\)).
This relation lets us describe parts of \(N\) or \(T\) that are “below” a specified set of arcs. In particular, our dynamic-programming table will indicate whether the parts of \(T\) that are below an anti-chain of arcs (called “top arcs”) can be embedded below a set of arcs in \(N\) (see 4).
Definition 7 ([15]). A downward-closed subforest of \(T\) is a subdigraph \(F\) of \(T\) that does not contain isolated vertices and whose arc set is such that, for all arcs \(a \in A(F)\) and \(b \in A(T)\), if \(a >_T b\), then \(b \in A(F)\). An arc \((x, y) \in A(F)\) is called a top arc of \(F\) if \(\deg^-_F (x) = 0\). The set \(S \subseteq A(F)\) that contains exactly the top arcs of \(F\) is called a top-arc set for \(L(F)\), and \(F\) is called the forest below \(S\).
In contrast to firm containment, soft containment allows embedding distinct arcs \((x, y)\) and \((x, z)\) of \(T\) as paths in \(N\) that may start with the same arcs but separate further down. We call such paths eventually arc-disjoint.
Definition 8. Two distinct paths \(P, Q \subseteq N\) are called eventually arc-disjoint if they have length at least \(1\) and (a) \(P\) and \(Q\) are arc-disjoint or (b) \(P\) and \(Q\) start at the same vertex \(v \in V(N)\) and \(P - v\) and \(Q - v\) are eventually arc-disjoint.
We remark that the union of several pairwise eventually arc-disjoint paths that all start with the same vertex can be used to form an out-tree. To witness soft containment, we associate each vertex of \(T\) with such a collection of paths in \(N\). Formalizing this intuition, we adapt the notion of a pseudo-embedding [15] to work with eventually arc-disjoint paths. Then, we show that such an embedding of \(T\) into \(N\) witnesses \(N^*\) softly displaying \(T^*\).
Definition 9. A soft pseudo-embedding of a downward-closed subforest \(F\) of \(T\) into the rooted DAG \(N\) is a function \(\phi\) that maps every arc \((x, y) \in A(F)\) to some directed path \(\phi(x, y) \subseteq N\) of length at least \(1\) in \(N\) and satisfies the following:
For any two arcs of the form \((x, y), (y, z) \in A(F)\), the last vertex of \(\phi(x, y)\) is the first vertex of \(\phi(y, z)\).
For all arcs \((x, y), (x', y') \in A(F)\) with \(x \neq x'\), the two directed paths \(\phi(x, y)\) and \(\phi(x', y')\) are arc-disjoint.
For all arcs \((x, y), (x, y') \in A(F)\) with \(y \neq y'\), the two directed paths \(\phi(x, y)\) and \(\phi(x, y')\) are eventually arc-disjoint.
For every arc \((x, \ell) \in A(F)\) with \(\ell \in L(T)\), the last vertex of \(\phi(x, \ell)\) is \(\ell\).
Also, for any arc \((x, y) \in A(F)\), we use \(\phi(y)\) to denote the last vertex of \(\phi(x, y)\).
If there is a pseudo-embedding (in the sense of Van Iersel, Jones, and Weller [15]) of a downward-closed subforest of \(T\) into \(N\), then it is a soft pseudo-embedding as well, but not vice versa. We have to use this more general notion because Soft Tree Containment is intentionally more permissive than Tree Containment. In fact, handling these generalized embeddings is the primary novelty of the dynamic-programming algorithm that we develop in this section (6): We inherit the idea of computing embeddings of parts of \(T\) that are below a top-arc set into parts of \(N\), where we only store how each top arc is to be embedded in a “bag” of \(\Gamma\), but the details differ significantly for Soft Tree Containment. Crucially, a soft pseudo-embedding can map two distinct arcs to paths that share some arcs; the paths might only be eventually arc-disjoint. This changes how we generate the embeddings and, thus, changes the analysis. Moreover, our generalized embeddings can be more numerous (compare [lem:vsigbound] with [15]). We prove now that these generalized embeddings indeed capture Soft Tree Containment.
lemmalemsdiffspe The binary network \(N^*\) softly displays the tree \(T^*\) if and only if there is a soft pseudo-embedding of \(T\) into \(N\).
Proof. There are two directions to consider.
“\(\Rightarrow\)”: Assume that \(N^*\) softly displays \(T^*\). There exists a leaf-respecting isomorphism \(\iota\) between a subdivision \(T^\dagger\) of a binary resolution of \(T^*\) and a leaf-monotone subdigraph \(N^\dagger\) of \(N^*\). Note that, since \(N^*\) is binary, it is its own unique binary resolution. We construct a soft pseudo-embedding \(\phi\) of \(T\) into \(N\) as follows:
For every \((x, y) \in A(T^*)\), we define \(\phi(x, y)\) as the path from \(\iota(x)\) to \(\iota(y)\) in \(N^\dagger\).
We define \(\phi(\rho_T, \mathop{\mathrm{root}}(T^*))\) as a path from \(\rho_N\) to \(\iota(\mathop{\mathrm{root}}(T^*))\) in \(N\).
This defines \(\phi\) for all arcs of \(T\) because \(A(T) = A(T^*) \cup \{(\rho_T, \mathop{\mathrm{root}}(T^*))\}\). Moreover, \(\phi\) maps each arc of \(T\) to a directed path of length at least \(1\) in \(N\).
We show that (SPE[spe:last-to-first]) is satisfied: Let \((x, y), (y, z) \in A(T)\). By construction of \(\phi\), the last vertex of \(\phi(x, y)\) is \(\iota(y)\). Since \(x\) is a parent of \(y\) in \(T\), we have \(y \neq \rho_T\). Thus, the first vertex of \(\phi(y, z)\) is also \(\iota(y)\).
We show that (SPE[spe:paths-disjoint]) is satisfied: Let \((x, y), (x', y') \in A(T)\) with \(x \neq x'\). Because \(T\) is an out-tree, we have \(y \neq y'\). The case where \(x = \rho_T\) or \(x' = \rho_T\) is easy. Hence, we now assume that \((x, y), (x', y') \in A(T^*)\). Then, \(\phi(x, y), \phi(x', y') \subseteq N^\dagger\). To infer that \(\phi(x, y)\) and \(\phi(x', y')\) are arc-disjoint, it is sufficient to argue that, in \(T^\dagger\), the path from \(x\) to \(y\) and the path from \(x'\) to \(y'\) are arc-disjoint, as \(\iota\) is a leaf-respecting isomorphism between \(T^\dagger\) and \(N^\dagger\). In \(T^*\), the path from \(x\) to \(y\) and the path from \(x'\) to \(y'\) are clearly arc-disjoint. When out-splitting or subdividing, the corresponding paths continue to be arc-disjoint, as a consequence of \(x \neq x'\).
We show that (SPE[spe:fork-eventually-disjoint]) is satisfied: Let \((x, y), (x, y') \in A(T)\) with \(y \neq y'\). Since \(y \neq y'\), we know that \(x \neq \rho_T\). Thus, we have \((x, y), (x, y') \in A(T^*)\), and so \(\phi(x, y), \phi(x, y') \subseteq N^\dagger\). It then suffices to argue that, in \(T^\dagger\), the path from \(x\) to \(y\) and the path from \(x\) to \(y'\) are eventually arc-disjoint. This holds in \(T^*\) and continues to hold when out-splitting or subdividing.
We show that (SPE[spe:leaf]) is satisfied: Let \((x, \ell) \in A(T)\) with \(\ell \in L(T)\). By construction of \(\phi\), the last vertex of \(\phi(x, \ell)\) is \(\iota(\ell) = \ell\), using the fact that \(\iota\) is leaf-respecting.
“\(\Leftarrow\)”: Let \(\phi\) be a soft pseudo-embedding of \(T\) into \(N\). We perform the following steps:
We construct the out-tree \(N' \mathrel{\vcenter{:}}=\bigcup_{a \in A(T)} \phi(a)\).
We construct the set \(R \mathrel{\vcenter{:}}=\{v \in V(N') \mid \forall u \geq_{N'} v \colon \deg^+_{N'} (u) = 1\}\).
We construct the out-tree \(N'' \mathrel{\vcenter{:}}= N' - R\).
It is easy to see that \(N''\) is a leaf-monotone subdigraph of \(N^*\). We argue that there is a leaf-respecting isomorphism between a subdivision of a binary resolution of \(T^*\) and \(N''\). To this end, we define a function \(\tau\) mapping each non-leaf \(x\) of \(T^*\) to the binary out-tree to which the outgoing arcs of \(x\) in \(T^*\) are mapped by \(\phi\). Then, each \(\tau(x)\) can be obtained by out-splitting and subdividing around \(x\) in \(T^*\), except when \(x\) is the root of \(T^*\); we have to handle the root separately using the set \(R\).
Formally, for every vertex \(x \in V(T^*) \setminus L(T^*)\), we define \(\tau(x) \mathrel{\vcenter{:}}=\bigcup_{a \in A^+_{T^*} (x)} \phi(a)\), and note that \((\bigcup_{x \in V(T^*) \setminus L(T^*)} \tau(x)) - R = N''\). Let \(x, x' \in V(T^*) \setminus L(T^*)\) be distinct. The constraint (SPE[spe:paths-disjoint]) implies that \(\tau(x)\) and \(\tau(x')\) are arc-disjoint. By (SPE[spe:fork-eventually-disjoint]), we know that \(\tau(x)\) is an out-tree. It is binary, its root is \(\phi(x)\), and its leaves are \(L(\tau(x)) = \{\phi(y) \mid y \in V^+_{T^*} (x)\}\). Starting from \(T^*\), for every \(x \in (V(T^*) \setminus L(T^*)) \setminus \{\mathop{\mathrm{root}}(T^*)\}\), an out-tree corresponding to \(\tau(x)\) can be constructed through out-splitting and subdividing; for \(x = \mathop{\mathrm{root}}(T^*)\), an out-tree corresponding to \(\tau(x) - R\) can be constructed. ◻
Recall that we assume to be given a canonical tree extension \(\Gamma\) of \(N\) (see 1) and that we define \(\mathop{\mathrm{HW}}_t (\Gamma) \mathrel{\vcenter{:}}=\{(u, v) \in A(N) \mid u \geq_\Gamma t >_\Gamma v\}\) for every \(t \in V(\Gamma)\). When visualizing scanwidth via scanner lines (see 2), the set \(\mathop{\mathrm{HW}}_t (\Gamma)\) may be thought of as containing the arcs of \(N\) cut directly below \(t \in V(\Gamma)\), whereas \(\mathop{\mathrm{GW}}_t (\Gamma)\) contains the arcs cut directly above \(t\).
In the following, we develop a dynamic-programming algorithm that computes its table entries (“signatures”) bottom-up along \(\Gamma\). Intuitively, for each vertex \(t \in V(\Gamma)\), each top-arc set \(S\) in \(T\), and each \(\psi \colon S \to \mathop{\mathrm{GW}}_t (\Gamma)\), we set the table entry / signature \([\mathop{\mathrm{GW}}_t (\Gamma), S, \psi]\) to “valid” if the forest below \(S\) in \(T\) is softly displayed by the network below \(\mathop{\mathrm{GW}}_t (\Gamma)\) in such a way that each arc \(a \in S\) is embedded in a path starting with \(\psi(a) \in \mathop{\mathrm{GW}}_t (\Gamma)\). An example of a valid signature is depicted in 5. Note that \(\psi\) is not required to be injective.
Definition 10. A signature is an ordered triple \([B, S, \psi]\) containing a set \(B \subseteq A(N)\) of arcs of \(N\), a top-arc set \(S \subseteq A(T)\) for the set of leaves reachable from \(B\) in \(N\), and a function \(\psi \colon S \to B\). Such a signature \([B, S, \psi]\) is called valid if there is a soft pseudo-embedding \(\phi\) of the forest below \(S\) into \(N\) such that, for every arc \((x, y) \in S\), the first arc of the path \(\phi(x, y)\) is \(\psi(x, y)\); then, \(\phi\) is a witness for the valid signature \([B, S, \psi]\).
Our dynamic-programming algorithm, 6, decides whether \(N^*\) softly displays \(T^*\) by, in some sense, exhaustively generating valid signatures. Once it has generated them, it can easily read off the final answer ([lem:vsigtoparc]). To prove the main result of this section (1), we establish the correctness of 6 and bound its running time. This involves showing that 6 generates its valid signatures correctly ([lem:vsigleaf] [lem:vsigHW] [lem:vsigGW]) and that there are not too many valid signatures to generate ([lem:vsigbound]). We start with the latter.
lemmalemvsigbound For each set \(B \subseteq A(N)\), there are at most \((4 \cdot \lvert B\rvert)^{\Delta_{T} \cdot \lvert B\rvert}\) valid signatures of the form \([B, S, \psi]\).
Proof. Let \(B \subseteq A(N)\) be a set of arcs. For all valid signatures of the form \([B, S, \psi]\), it holds that \(\lvert S\rvert \leq \Delta_{T} \cdot \lvert B\rvert\), since \(\lvert\psi^{-1} (u, v)\rvert \leq \Delta_{T}\) for every arc \((u, v) \in B\). This is because, when \(\psi\) maps multiple arcs of \(S\) to a single arc in \(B\), these arcs of \(S\) must have the same tail in order to permit eventual arc-disjointness. Therefore, to construct a valid signature of the form \([B, S, \psi]\), the number of choices for \(S\) is at most \(4^{\Delta_{T} \cdot \lvert B\rvert}\): This bound on the number of top-arc sets of bounded size for a fixed set of leaves is derived from a bound on the number of important separators due to Chitnis, Hajiaghayi, and Marx [27]. Specifically, from every top-arc set \(S\), an important \(\{\rho_T\}\)–\(L(F)\) separator in a slight modification of \(T\) can be obtained using the heads of the arcs in \(S\), where \(F\) is the forest below \(S\) (see also [15]). For each choice of \(S\), the number of choices for \(\psi\) is at most \(\lvert B\rvert^{\lvert S\rvert} \leq \lvert B\rvert^{\Delta_{T} \cdot \lvert B\rvert}\). Multiplying \(4^{\Delta_{T} \cdot \lvert B\rvert}\) with \(\lvert B\rvert^{\Delta_{T} \cdot \lvert B\rvert}\) gives the promised bound. ◻
For every non-root vertex \(v \in V(\Gamma)\), 6 constructs the set \(\mathit{GWS}_v\) of pairs \((S, \psi)\) for which \([\mathop{\mathrm{GW}}_v (\Gamma), S, \psi]\) is a valid signature (and analogously for \(\mathit{HWS}_v\)). The construction has three steps: First, handling the case where \(v\) is a leaf. Second, constructing \(\mathit{HWS}_v\) when \(v\) is not a leaf. Third, constructing \(\mathit{GWS}_v\) when \(v\) is not a leaf. The next three lemmas imply the steps’ correctness.
lemmalemvsigleaf For each leaf \(v \in L(\Gamma)\), there is exactly one ordered pair \((S, \psi)\) such that \([\mathop{\mathrm{GW}}_v (\Gamma), S, \psi]\) is a valid signature.
Proof. Let \(v \in L(\Gamma) = L(N) = L(T)\) be a leaf. We observe that a signature of the form \([\mathop{\mathrm{GW}}_v (\Gamma), S, \psi]\) is valid if and only if (a) \(S = A^-_T (v)\) and (b) \(\psi\) maps the unique arc in \(S\) to the unique arc in \(\mathop{\mathrm{GW}}_v (\Gamma) = A^-_N (v)\). ◻
Recall that \(N\) is binary. Since \(\Gamma\) is canonical, it too is binary in consequence [17], and so any vertex has at most two children in \(\Gamma\). For every non-root, non-leaf \(v \in V(\Gamma)\), 6 constructs \(\mathit{HWS}_v\) by combining pairs from \(\mathit{GWS}_{q_1}\) and \(\mathit{GWS}_{q_2}\), where \(q_1\) and \(q_2\) are the children of \(v\) in \(\Gamma\). We define \(D_u \mathrel{\vcenter{:}}= D[\{w \in V(D) \mid u \geq_D w\}]\) for each \(u \in V(D)\) in a DAG \(D\), to refer to subtrees of \(T\) and \(\Gamma\). Recall that \(\psi |_Z\) is the restriction of \(\psi\) to \(Z\).
lemmalemvsigHW Let \(v \in (V(\Gamma) \setminus \{\mathop{\mathrm{root}}(\Gamma)\}) \setminus L(\Gamma)\) have children \(V^+_\Gamma (v) = \{q_1, q_2\}\) in \(\Gamma\), where \(q_1\) and \(q_2\) are not necessarily distinct, and let \([\mathop{\mathrm{HW}}_v (\Gamma), S, \psi]\) be a signature. Further, for each \(i \in \{1, 2\}\), let \(S_i \mathrel{\vcenter{:}}=\{(x, y) \in S \mid L(T_y) \subseteq L(\Gamma_{q_i})\}\). Then, the signature \([\mathop{\mathrm{HW}}_v (\Gamma), S, \psi]\) is valid if and only if (a) \(S = S_1 \cup S_2\) and (b) \([\mathop{\mathrm{GW}}_{q_i} (\Gamma), S_i, \psi |_{S_i}]\) is a valid signature for each \(i \in \{1, 2\}\).
Proof. “\(\Rightarrow\)”: Suppose that \([\mathop{\mathrm{HW}}_v (\Gamma), S, \psi]\) is valid, and let \(\phi\) be a witness for it.
First, we show \(S \subseteq S_1 \cup S_2\). Because \(S_1 \cup S_2 \subseteq S\) by definition, this then implies \(S = S_1 \cup S_2\). Let \((x, y) \in S\) be an arc of \(T\) and let \((u, w) \mathrel{\vcenter{:}}=\psi(x, y)\). Since \((u, w) \in \mathop{\mathrm{HW}}_v (\Gamma)\), we have \(v >_\Gamma w\) and, hence, \(q_i \geq_\Gamma w\) for some \(i \in \{1, 2\}\). In the following, we prove that \(L(T_y) \subseteq L(\Gamma_{q_i})\) and, thus, \((x, y) \in S_i\). To this end, let \(\ell \in L(T_y)\) be a leaf and let \(P \subseteq T_y\) be the \(y\)–\(\ell\) path in \(T_y\). Then, \(\bigcup_{a \in A(P)} \phi(a)\) is a path from \(\phi(y)\) to \(\ell\) in \(N\) unless \(\phi(y) = \ell\). Either way, \(w \geq_N \phi(y) \geq_N \ell\), so \(q_i \geq_\Gamma w \geq_\Gamma \ell\) and, consequently, \(\ell \in L(\Gamma_{q_i})\).
Second, let \(i \in \{1, 2\}\) and let \(F \subseteq T\) be the forest below \(S_i\). Then, \(\phi |_{A(F)}\) is a witness for the valid signature \([\mathop{\mathrm{GW}}_{q_i} (\Gamma), S_i, \psi |_{S_i}]\).
“\(\Leftarrow\)”: We assume that \(S = S_1 \cup S_2\) and that \([\mathop{\mathrm{GW}}_{q_i} (\Gamma), S_i, \psi |_{S_i}]\) is a valid signature for each \(i \in \{1, 2\}\), witnessed by \(\phi_i\). If \(q_1 = q_2\), then \(\mathop{\mathrm{HW}}_v (\Gamma) = \mathop{\mathrm{GW}}_{q_1} (\Gamma)\), \(S = S_1\), and \(\psi = \psi |_{S_1}\), so \([\mathop{\mathrm{HW}}_v (\Gamma), S, \psi]\) is valid. If \(q_1 \neq q_2\), then \(S_1 \cap S_2 = \varnothing\) and \(\phi \mathrel{\vcenter{:}}=\phi_1 \uplus \phi_2\) is a witness for \([\mathop{\mathrm{HW}}_v (\Gamma), S, \psi]\). ◻
The next lemma concerns the correctness of the procedure PopulateGWS. Given a non-root, non-leaf vertex \(v \in V(\Gamma)\), this procedure constructs the set \(\mathit{GWS}_v\) based on the elements of \(\mathit{HWS}_v\). Informally speaking, this step from \(\mathop{\mathrm{HW}}_v (\Gamma)\) to \(\mathop{\mathrm{GW}}_v (\Gamma)\) unlocks the incoming arcs of \(v\) in \(N\). There are three ways in which these arcs may be used: (1) not at all, (2) to elongate paths of an existing embedding, or (3) to enlarge the downward-closed subforest to be embedded.
lemmalemvsigGW Let \(v \in (V(\Gamma) \setminus \{\mathop{\mathrm{root}}(\Gamma)\}) \setminus L(\Gamma)\) be a vertex and \([\mathop{\mathrm{GW}}_v (\Gamma), S, \psi]\) a signature. Then, \([\mathop{\mathrm{GW}}_v (\Gamma), S, \psi]\) is valid if and only if at least one of the three conditions below is met:
(1) \(\psi(x, y) \notin A^-_N (v)\) for every \((x, y) \in S\), and \([\mathop{\mathrm{HW}}_v (\Gamma), S, \psi]\) is a valid signature.
(2) \((u, v) \in \psi(S)\) for exactly one vertex \(u \in V^-_N (v)\); further, it holds that
1. $X \mathrel{\vcenter{:}}=\psi^{-1} (u, v) \subseteq A^+_T (x)$
for some $x \in V(T)$, and
2. $[\mathop{\mathrm{HW}}_v (\Gamma), S, \psi']$ is a valid
signature, where
$\psi' \colon S \to \mathop{\mathrm{HW}}_v (\Gamma)$ is some
function with $\psi'(X) \subseteq A^+_N (v)$ and, for all
$(x', y') \in S \setminus X$, we have
$\psi'(x', y') = \psi(x', y')$.
(3) \(\psi(x, y) \in A^-_N (v)\) for exactly one \((x, y) \in S\); further, it holds that
1. $y \notin L(T)$, and
2. $[\mathop{\mathrm{HW}}_v (\Gamma), S_{x, y}, \psi']$ is a valid
signature, where
$S_{x, y} \mathrel{\vcenter{:}}=(S \setminus \{(x, y)\}) \cup A^+_T (y)$
and $\psi' \colon S_{x, y} \to \mathop{\mathrm{HW}}_v (\Gamma)$
is some function with $\psi'(A^+_T (y)) \subseteq A^+_N (v)$
and, for all $(x', y') \in S \setminus \{(x, y)\}$, we have
$\psi'(x', y') = \psi(x', y')$.
Proof. “\(\Rightarrow\)”: Suppose that \([\mathop{\mathrm{GW}}_v (\Gamma), S, \psi]\) is valid, and let \(\phi\) be a witness for it. Then, at least one of the following holds, and we consider them individually:
(a) \(\psi(x, y) \notin A^-_N (v)\) for every arc \((x, y) \in S\).
(b) \(\psi(x, y) \in A^-_N (v)\) for some arc \((x, y) \in S\) with \(\phi(y) \neq v\).
(c) \(\psi(x, y) \in A^-_N (v)\) for some arc \((x, y) \in S\) with \(\phi(y) = v\).
Case (a): Because \(\psi(S) \subseteq \mathop{\mathrm{GW}}_v (\Gamma) \setminus A^-_N (v) \subseteq \mathop{\mathrm{HW}}_v (\Gamma)\), we know that \([\mathop{\mathrm{HW}}_v (\Gamma), S, \psi]\) is a valid signature witnessed by \(\phi\), so (1) is met.
Case (b): Based on \(\phi\), we construct a new soft pseudo-embedding \(\phi'\) of the forest below \(S\) into \(N\). To this end, we distinguish between two kinds of arcs in \(S\): those that \(\psi\) maps into \(A^-_N (v)\) and those that \(\psi\) maps to elsewhere. Only on the former arcs is \(\phi'\) defined differently than \(\phi\). Namely, for every such arc, we remove the first vertex of the path to which the arc is mapped. We do this because \(A^-_N (v)\) and \(\mathop{\mathrm{HW}}_v (\Gamma)\) are disjoint. We now describe the steps formally. We observe that \(\psi(S) \cap A^-_N (v)\) contains a single arc \((u, v)\). Consider the set \(X \mathrel{\vcenter{:}}=\psi^{-1} (u, v)\), and note that \((x, y) \in X\) and \(X \subseteq A^+_T (x)\). For each arc \((x, z) \in X\), we define \(\phi'(x, z)\) as the path obtained by removing \(u\) from the path \(\phi(x, z)\). For each arc \((x', y') \in A(F) \setminus X\), where \(F\) is the forest below \(S\), we define \(\phi'(x', y') \mathrel{\vcenter{:}}=\phi(x', y')\). Further, we construct \(\psi' \colon S \to \mathop{\mathrm{HW}}_v (\Gamma)\) by setting \(\psi'(a)\) to be the first arc of \(\phi'(a)\) for all \(a \in S\). Then, \([\mathop{\mathrm{HW}}_v (\Gamma), S, \psi']\) is a valid signature, and \(\phi'\) is a witness for it. We observe that (2) is met now.
Case (c): We use that no arc of \(S\) other than \((x, y)\) is mapped into \(A^-_N (v)\) by \(\psi\). This lets us construct a new soft pseudo-embedding \(\phi'\) by simply taking the restriction of \(\phi\) to the arcs of the forest below \(S_{x, y}\). Formally, we do the following: As \(\phi(y) = v\) and \(v \notin L(\Gamma) = L(N) = L(T)\), we have \(y \notin L(T)\). The existence of an arc \((x', y') \in S \setminus \{(x, y)\}\) with \(\psi(x', y') \in A^-_N (v)\) would lead to violations of (eventual) arc-disjointness, so no such arc \((x', y')\) exists. We construct \(\phi' \mathrel{\vcenter{:}}=\phi |_{A(F)}\), where \(F\) is the forest below \(S_{x, y}\), and we define \(\psi'(a)\) to be the first arc of \(\phi'(a)\) for each \(a \in S_{x, y}\). Then, \(\phi'\) is a witness for the valid signature \([\mathop{\mathrm{HW}}_v (\Gamma), S_{x, y}, \psi']\). We can infer that (3) is met.
“\(\Leftarrow\)”: We argue the three cases, assuming that (1), (2), or (3) holds, individually.
Case (1): Let \(\phi'\) be a witness for the valid signature \([\mathop{\mathrm{HW}}_v (\Gamma), S, \psi]\). Then, \(\phi'\) is a witness for \([\mathop{\mathrm{GW}}_v (\Gamma), S, \psi]\) as well, proving its validity.
Case (2): Let \(\phi'\) be a witness for the valid signature \([\mathop{\mathrm{HW}}_v (\Gamma), S, \psi']\). For each \((x, y) \in X\), we define \(\phi(x, y)\) to be the path obtained by prepending the vertex \(u\) and the arc \((u, v)\) to the path \(\phi'(x, y)\). For each \((x', y') \in A(F) \setminus X\), where \(F\) is the forest below \(S\), we define \(\phi(x', y') \mathrel{\vcenter{:}}=\phi'(x', y')\). Then, \(\phi\) is a witness for the valid signature \([\mathop{\mathrm{GW}}_v (\Gamma), S, \psi]\).
Case (3): Let \(\phi'\) be a witness for the valid signature \([\mathop{\mathrm{HW}}_v (\Gamma), S_{x, y}, \psi']\). We define \(\phi(x, y)\) to be the length-\(1\) path containing the arc \(\psi(x, y)\), and we define \(\phi(x', y') \mathrel{\vcenter{:}}=\phi'(x', y')\) for every \((x', y') \in A(F)\), where \(F\) is the forest below \(S_{x, y}\). Then, \(\phi\) witnesses the validity of \([\mathop{\mathrm{GW}}_v (\Gamma), S, \psi]\). ◻
While the previous lemmas established that 6 constructs its valid signatures correctly (that is, the \((S, \psi)\) pairs it generates correspond precisely to the valid signatures of interest), the next lemma implies that its final answer is correct.
lemmalemvsigtoparc Let \(v \in V(N)\) be the child of the root of \(N\), and let \(a \in A(T)\) be the top arc of \(T\). Then, \(N^*\) softly displays \(T^*\) if and only if there exists a valid signature of the form \([\mathop{\mathrm{GW}}_v (\Gamma), \{a\}, \psi]\).
Proof. “\(\Rightarrow\)”: Suppose that \(N^*\) softly displays \(T^*\). From the proof of [lem:sdiffspe], we deduce that there is a soft pseudo-embedding \(\phi\) of \(T\) into \(N\) such that the first arc of the path \(\phi(a)\) is \((\rho_N, v)\). We define the function \(\psi(a) \mathrel{\vcenter{:}}=(\rho_N, v)\). Then, \([\mathop{\mathrm{GW}}_v (\Gamma), \{a\}, \psi]\) is a valid signature, and \(\phi\) is a witness for it.
“\(\Leftarrow\)”: Let \([\mathop{\mathrm{GW}}_v (\Gamma), \{a\}, \psi]\) be a valid signature, and let \(\phi\) be a witness for it. Then, \(\phi\) is a soft pseudo-embedding of \(T\) into \(N\). Thus, \(N^*\) softly displays \(T^*\) by [lem:sdiffspe]. ◻
We now piece the previous lemmas together to conclude this section.
Proposition 1. Given \(N\), \(T\), and \(\Gamma\) fulfilling 1, 6 decides whether \(N^*\) softly displays \(T^*\) in \(\mathcal{O}^* (2^{\Delta_{T} \cdot (\mathop{\mathrm{sw}}(\Gamma) + 1) \cdot \log_2 (4 \cdot \mathop{\mathrm{sw}}(\Gamma) + 4)})\) time.
Proof. Let \(v \in V(\Gamma) \setminus \{\mathop{\mathrm{root}}(\Gamma)\}\) be a vertex. Whenever 6 adds a pair \((S, \psi)\) to \(\mathit{GWS}_v\) (or \(\mathit{HWS}_v\)), it is true that \([\mathop{\mathrm{GW}}_v (\Gamma), S, \psi]\) (or \([\mathop{\mathrm{HW}}_v (\Gamma), S, \psi]\)) is a signature. From [lem:vsigleaf] [lem:vsigHW] [lem:vsigGW], it follows that 6 generates precisely every such signature that is valid. Then, the correctness of 6 is a consequence of [lem:vsigtoparc]. The bound on the running time may be deduced as follows: Because \(N\) is binary, we have \(\lvert\mathop{\mathrm{HW}}_v (\Gamma)\rvert \leq \lvert\mathop{\mathrm{GW}}_v (\Gamma)\rvert + 1 \leq \mathop{\mathrm{sw}}(\Gamma) + 1\). Hence, by [lem:vsigbound], the sets \(\mathit{GWS}_v\) and \(\mathit{HWS}_v\) contain at most \(2^{\Delta_{T} \cdot (\mathop{\mathrm{sw}}(\Gamma) + 1) \cdot \log_2 (4 \cdot \mathop{\mathrm{sw}}(\Gamma) + 4)}\) elements each. This also bounds the number of iterations of the loop in [line:loop], as each iteration adds a new pair to \(\mathit{HWS}_v\). ◻
Note that 6 decides Soft Tree Containment without explicitly constructing a full soft pseudo-embedding of \(T\) into \(N\). However, it is not difficult to adapt the algorithm so as to output such a soft pseudo-embedding on a \(\mathtt{YES}\)-instance: Let \(v \in (V(\Gamma) \setminus \{\mathop{\mathrm{root}}(\Gamma)\}) \setminus L(\Gamma)\). Simply have the algorithm store, for each pair \((S, \psi) \in \mathit{GWS}_v\), a single pair from \(\mathit{HWS}_v\) from which \((S, \psi)\) was constructed. Similarly, have the algorithm store, for each pair in \(\mathit{HWS}_v\), the one or two pairs from which it was constructed. In case of a \(\mathtt{YES}\)-instance, these separately stored pairs would allow the algorithm, at the end, to construct a soft pseudo-embedding of \(T\) into \(N\) through backtracing.
In this section, we devise a reduction that maps any network to a binary one while preserving the trees that the network softly displays. The reduction can be performed in polynomial time, and the resulting increase in the scanwidth of the network can be bounded. Relying on the considerations of the previous section, we then obtain our main result (1). The reduction consists of two steps:
We stretch the network. This means that we modify the network using gadgets that are conceptually very similar to the universal networks by Zhang [28] (see 7, also compare [28]). Like these universal networks, our gadgets consist of a triangular upper part and a lower part that is based on a sorting network.
The triangular upper part is essentially one half of a grid that was slightly modified to obtain a phylogenetic network. In it, any binary phylogenetic tree (up to some number of leaves) can be embedded. As each high-out-degree vertex is replaced by a gadget when stretching, the stretched network represents all possible binary out-resolutions.
However, embedding a binary tree in the triangular upper part artificially enforces an order on the leaves of the binary tree. The lower part allows us to undo this. We choose a different sorting network than Zhang [28].
We compute an arbitrary binary in-resolution of the stretched network through exhaustive in-splitting. This does not affect which trees are firmly displayed.
The purpose of stretching, defined below, is to get rid of vertices with high out-degree in a network, so that we can assume the resulting network to have maximum out-degree \(2\).
Definition 11. Let \(N\) be any arbitrary network, and let \(v \in V(N)\) be a vertex of out-degree \(d \mathrel{\vcenter{:}}=\deg^+_N (v)\) at least \(3\). When stretching \(v\), we modify \(N\) as follows: First, we remove the arcs between \(v\) and its children \(V^+_N (v) = \{c_1, c_2, \dots, c_d\}\). Then, we insert a gadget consisting of two parts.
For the first part, we start by inserting a triangular half of a grid rooted at \(v\). The construction proceeds in layers: The new children of \(v\) are two new vertices \(u_{2, 1}\) and \(u_{2, 2}\) now. Below this layer, there are \(d - 2\) additional layers. Each layer has an index \(i \in \{2, 3, \dots, d\}\) and consists of the vertices \(\{u_{i, j} \mid j \in [i]\}\). For \(i < d\), every vertex \(u_{i, j}\) has the children \(u_{i + 1, j}\) and \(u_{i + 1, j + 1}\). This triangular half-grid can contain some vertices \(u_{i, j}\) that simultaneously have in-degree \(2\) and out-degree \(2\). We fix this by making the two children of such a vertex \(u_{i, j}\) the children of a new vertex \(u'_{i, j}\) instead, and we add an arc from \(u_{i, j}\) to \(u'_{i, j}\). Further, we suppress the two vertices \(u_{d, 1}\) and \(u_{d, d}\) later, since otherwise they would have in-degree \(1\) and out-degree \(1\) simultaneously in the final gadget.
For now, we start constructing the second part of the gadget by adding \(d\) arcs, each one from \(u_{d, j}\) to \(c_j\) for \(j \in [d]\). We subdivide these arcs repeatedly to obtain \(d\) paths, and we add arcs between the paths to obtain a sorting network. Specifically, we construct \((d - 1)^2\) so called crossovers [29]: A crossover has indices \(i, j \in [d - 1]\) and involves four vertices, denoted \(w_{i, j, k}\) for \(k \in [4]\). These vertices all lie on the \(d\) paths that we created through repeated subdivision. Each crossover has four arcs: from \(w_{i, j, 1}\) to \(w_{i, j, 3}\) and to \(w_{i, j, 4}\), as well as from \(w_{i, j, 2}\) to \(w_{i, j, 3}\) and to \(w_{i, j, 4}\). We place these crossovers so that they resemble a bubble-sort network with \(d - 1\) passes (indexed by \(i\)) where, per pass, \(d - 1\) comparisons (indexed by \(j\)) are performed. Each crossover represents one such comparison.
When stretching \(N\) we stretch every vertex of \(N\) that has an out-degree of at least \(3\), and we denote the resulting network \(\mathop{\mathrm{str}}(N)\).
In the appendix, we provide an equivalent definition where the vertices and the arcs of a stretch gadget are listed explicitly (12).
An anonymous reviewer suggested a simple alternative to stretching that, in a network \(N\), below any vertex \(v\) of out-degree \(d \geq 1\) with children \(c_1, c_2, \dots, c_d\), inserts a recursively defined gadget \(G_d\) instead (again replacing the outgoing arcs of \(v\)): If \(d = 1\), then \(G_d\) simply consists of \(v\) and its child \(c_1\), with the arc in between exactly as it exists in \(N\). If \(d \geq 2\), then \(G_d\) is constructed by first inserting the gadget \(G_{d - 1}\) between \(v\) and children \(c_1, c_2, \dots, c_{d - 1}\), and then subdividing each arc \(a\) of \(G_{d - 1}\) with a new vertex \(u_a\). Finally, arcs from every \(u_a\) to \(c_d\) are added. Note that, in the end, \(v\) has a single outgoing arc. To obtain a phylogenetic network, this arc needs to be contracted if \(d \geq 2\), but only once, after the recursion is fully done. This gadget mimics the property that removing a leaf from a tree with \(k \geq 3\) leaves produces what is essentially a subdivision of a tree with \(k - 1\) leaves (but its root may now have out-degree \(1\)).
These alternative gadgets can be described simply and concisely; however, they can cause an increase in scanwidth that is exponential in the initial maximum out-degree of the network. This is because, to add one more child, the number of arcs of the gadget is doubled through subdivision. The next child to add then has high in-degree, which causes the gadget to have high scanwidth. To obtain the running time reported in 1, we use stretch gadgets, since these can only cause an increase in scanwidth that is linear in the initial maximum out-degree of the network ([lem:swstr]).
The proof of 1 relies on four key claims: [lem:strsd] [lem:binressd], which state that stretching and in-splitting preserve the collection of trees softly displayed a network, and [lem:swstr] [lem:swin], which state that the increase in scanwidth when stretching and in-splitting is bounded, using the network’s maximum out-degree. To prove [lem:strsd], we first formalize the intuition that the stretched network “represents” all possible binary out-resolutions.
Lemma 1. Let \(N\) be a network and let \(T\) be a tree. Then, \(\mathop{\mathrm{str}}(N)\) firmly displays \(T\) if and only if there is a binary out-resolution of \(N\) that firmly displays \(T\).
Proof. “\(\Rightarrow\)”: Suppose \(\mathop{\mathrm{str}}(N)\) firmly displays \(T\), that is, there is some leaf-monotone subdigraph \(N'\) of \(\mathop{\mathrm{str}}(N)\) that is isomorphic (respecting leaves) to some subdivision \(T'\) of \(T\), and let \(\iota \colon V(T') \to V(N')\) denote this isomorphism. Without loss of generality, we can assume that \(\mathop{\mathrm{root}}(N') \in V(N)\) (so the root of \(N'\) is not strictly inside a stretch gadget). We note that \(T\) is necessarily binary. We then aim to establish the existence of a binary out-resolution of \(N\) that firmly displays \(T\). To this end, we want to extract the structure of paths corresponding to \(T\) in stretch gadgets. This structure then allows us to construct a suitable binary out-resolution of \(N\). Informally, we first suppress all suppressible vertices of \(N'\) that are strictly inside the stretch gadgets of \(\mathop{\mathrm{str}}(N)\). Now, there might be some vertices \(u\) of \(N\) with out-degree \(1\) left that have bifurcating vertices in their stretch gadgets, and so we contract the top bifurcation onto \(u\). More formally,
we construct the set \(S_1 \mathrel{\vcenter{:}}=\{v \in V(N') \setminus V(N) \mid \deg^-_{N'} (v) = \deg^+_{N'} (v) = 1\}\),
we obtain \(N''\) from \(N'\) by suppressing all vertices that are in \(S_1\),
we obtain \(T''\) from \(T'\) by suppressing all vertices that are in \(\iota^{-1} (S_1)\),
we construct the leaf-respecting isomorphism \(\kappa \mathrel{\vcenter{:}}=\iota |_{V(T'')}\) between \(T''\) and \(N''\),
we construct \(S_2 \mathrel{\vcenter{:}}=\{u \in V(N'') \cap V(N) \mid \deg^+_{N''} (u) = 1 \land V^+_{N''} (u) \nsubseteq V^+_N (u)\}\),
we obtain \(N'''\) from \(N''\) by, for each \(u \in S_2\), contracting the child of \(u\) into \(u\), and
we obtain \(T'''\) from \(T''\) by suppressing all vertices that are in \(\kappa^{-1} (S_2)\).
We argue that \(T'''\) is a subdivision of \(T\): This is because \(T'\) is a subdivision of \(T\) by assumption and we obtained \(T'''\) from \(T'\) by suppressing in-degree-\(1\) out-degree-\(1\) vertices, which are not present in \(T\) by definition of a phylogenetic tree. We also argue that there is a leaf-respecting isomorphism between \(T'''\) and \(N'''\): By assumption, \(\iota\) is a leaf-respecting isomorphism between \(T'\) and \(N'\); from these two, we constructed \(T'''\) and \(N'''\) while maintaining isomorphism (respecting leaves) throughout. To finish this direction of the proof, we show that there is a subdivision of \(N'''\) that simultaneously is a leaf-monotone subdigraph of some binary out-resolution of \(N\). We can then conclude that such a binary out-resolution of \(N\) firmly displays \(T\). To this end, we argue that any vertex \(v \in V(N''')\), together with all its outgoing arcs in \(N'''\), also exists in a suitably chosen binary out-resolution of \(N\), possibly after performing subdivisions in \(N'''\): Note that \(N'''\) is binary, and so \(v\) has out-degree \(0\), \(1\), or \(2\). If \(\deg^+_{N'''} (v) = 0\), then \(v\) is a leaf in any binary out-resolution of \(N\). If \(\deg^+_{N'''} (v) = 1\), then \(v\) and its child \(c \in V^+_{N'''} (v)\) both exist in \(N\) and are connected by the arc \((v, c)\) in \(N\) too, and this arc also exists in a suitably chosen binary out-resolution of \(N\). If \(\deg^+_{N'''} (v) = 2\), then we proceed as follows: Either \(v \in V(N)\) holds or \(v\) originates from a stretch gadget. We assume that \(v \in V(N)\) holds and handle all vertices originating from a possible stretch gadget involving \(v\) together with \(v\). Directly below \(v\) in \(N'''\), there is a binary tree (generally using vertices of a stretch gadget) that leads to a subset of \(V^+_N (v)\). Any binary tree leading to exactly \(V^+_N (v)\) can be recreated in a binary out-resolution of \(N\) through out-splitting below \(v\). To ensure that \(N'''\) is a subdigraph of such a binary out-resolution, we can subdivide an arc of the binary tree below \(v\) in \(N'''\) to account for vertices of \(V^+_N (v)\) that do not appear in \(N'''\) but do exist in any binary out-resolution of \(N\) regardless. In the binary out-resolution of choice, these extra vertices can be placed in a binary tree that dangles off the vertex added through subdivision below \(v\).
“\(\Leftarrow\)”: Suppose \(T\) is firmly displayed by a binary out-resolution \(N'\) of \(N\). To show that \(\mathop{\mathrm{str}}(N)\) firmly displays \(T\), we argue that there is a subdivision of \(N'\) that is isomorphic (respecting leaves) to a leaf-monotone subdigraph of \(\mathop{\mathrm{str}}(N)\). Concretely, for any vertex \(v \in V(N')\), there is an equivalent vertex in \(\mathop{\mathrm{str}}(N)\), possibly after subdividing arcs in \(N'\): Since \(N'\) is a binary out-resolution, \(v\) has an out-degree of at most \(2\) in \(N'\). If \(\deg^+_{N'} (v) = 0\), then \(v\) is a leaf of \(N\) and, thus, a leaf of \(\mathop{\mathrm{str}}(N)\). If \(\deg^+_{N'} (v) = 1\), then we know that \(v\) is a reticulation and also present in \(N\) and \(\mathop{\mathrm{str}}(N)\), always with the same neighborhood as in \(N'\). If \(\deg^+_{N'} (v) = 2\), then we proceed as follows: Note that either \(v \in V(N)\) holds or \(v\) was introduced in \(N'\) through out-splitting. We assume that \(v \in V(N)\) holds and handle all vertices introduced through out-splitting below \(v\) in \(N'\) together with \(v\). Rooted at \(v\), these vertices form a binary tree whose leaves are \(V^+_N (v)\) (although these are not necessarily leaves of \(N'\) itself and \(v\) is not necessarily the root of \(N'\)). To finish the proof, we show that, for the vertices of this binary tree rooted at \(v\) in \(N'\), there are equivalent vertices in \(\mathop{\mathrm{str}}(N)\), possibly after subdividing arcs of the binary tree in \(N'\). If \(\deg^+_N (v) = 2\), then the binary tree has exactly two leaves and exists identically in \(\mathop{\mathrm{str}}(N)\). If \(\deg^+_N (v) \geq 3\), then \(v\) was stretched to obtain \(\mathop{\mathrm{str}}(N)\), and it remains to argue that a subdivision of the binary tree rooted at \(v\) in \(N'\) is isomorphic (respecting the leaves \(V^+_N (v)\)) to a leaf-monotone subdigraph of the stretch gadget rooted at \(v\) in \(\mathop{\mathrm{str}}(N)\). We use \(B \subseteq N'\) to denote the binary tree rooted at \(v\), and we use \(S \subseteq \mathop{\mathrm{str}}(N)\) to denote the stretch gadget rooted at \(v\). Note that \(\mathop{\mathrm{root}}(B) = \mathop{\mathrm{root}}(S) = v\) and that \(L(B) = L(S) = V^+_N (v)\). What is left to show is equivalent to the claim that \(S\) firmly displays \(B\). This follows from an argument that is analogous to that of Zhang [28]. It is not essential that the stretch gadgets use different sorting networks than the universal networks by Zhang do. ◻
With 1 at hand, we now show that stretching preserves the collection of trees that a network softly displays.
lemmalemstrsd Let \(N\) be any network and let \(T\) be any tree. Then, \(N\) softly displays \(T\) if and only if \(\mathop{\mathrm{str}}(N)\) softly displays \(T\).
Proof. “\(\Rightarrow\)”: First, assume that \(N\) softly displays \(T\). There is a binary out-resolution \(N''\) of a binary in-resolution \(N'\) of \(N\) as well as a binary resolution \(T'\) of \(T\) such that \(N''\) firmly displays \(T'\). From 1, it follows that \(\mathop{\mathrm{str}}(N')\) firmly displays \(T'\). Since \(\mathop{\mathrm{str}}(N')\) is a binary resolution of \(\mathop{\mathrm{str}}(N)\), we conclude that \(\mathop{\mathrm{str}}(N)\) softly displays \(T\).
“\(\Leftarrow\)”: Second, suppose that \(\mathop{\mathrm{str}}(N)\) softly displays \(T\). Then, there is a binary resolution \(T'\) of \(T\) that is firmly displayed by some binary resolution of \(\mathop{\mathrm{str}}(N)\). Any such binary resolution of \(\mathop{\mathrm{str}}(N)\) may be assumed to have the form \(\mathop{\mathrm{str}}(N')\) for some binary in-resolution \(N'\) of \(N\). To summarize, \(\mathop{\mathrm{str}}(N')\) firmly displays \(T'\). From 1, it follows that there is a binary out-resolution \(N''\) of \(N'\) that firmly displays \(T'\). Because \(N''\) is a binary resolution of \(N\), this implies that \(N\) softly displays \(T\). ◻
We argue that a stretched network can be made binary through in-splitting without altering the collection of softly displayed trees; the collection of firmly displayed trees also stays unaltered. In stretched networks, the maximum out-degree is \(2\); that is, we can assume that \(\Delta_{N} = 2\). The in-degrees, however, are generally unbounded. The lemma below justifies arbitrary in-splitting (taking any binary (in-)resolution) to make a stretched \(N\) binary indeed.
lemmalembinressd Let \(N\) be any network such that \(\Delta_{N} = 2\), let \(N'\) be any binary (in-)resolution of \(N\), and let \(T\) be any tree. Then,
(1) \(N\) firmly displays \(T\) if and only if \(N'\) firmly displays \(T\), and
(2) \(N\) softly displays \(T\) if and only if \(N'\) softly displays \(T\).
Proof. The “firmly”-part (1) is a slight adaptation of a proposition by Gunawan [30]. As the proof is analogous, we omit it here and show only the “softly”-part (2).
“\(\Rightarrow\)”: Suppose that \(N\) softly displays \(T\). Then, there are binary resolutions \(N''\) of \(N\) and \(T'\) of \(T\) such that \(N''\) firmly displays \(T'\). Applying the “firmly”-part (1) from right to left, from \(N''\) firmly displaying \(T'\), it follows that \(N\) firmly displays \(T'\). By applying the “firmly”-part (1) from left to right, from \(N\) firmly displaying \(T'\), we infer that \(N'\) firmly displays \(T'\). Since \(N'\) is its own binary resolution, we can conclude that \(N'\) softly displays \(T\).
“\(\Leftarrow\)”: Suppose that \(N'\) softly displays \(T\). Then, \(N'\) firmly displays some binary resolution of \(T\). As \(N'\) is a binary resolution of \(N\), we deduce that \(N\) softly displays \(T\). ◻
Finally, we show that neither stretching nor in-splitting to obtain a binary in-resolution can blow up the scanwidth too much, in order to prove 1.
lemmalemswstr Let \(N\) be any network. Then, \(\mathop{\mathrm{sw}}(\mathop{\mathrm{str}}(N)) \leq \mathop{\mathrm{sw}}(N) + 2 \cdot \Delta_{N}\).
Proof. Let \(\Gamma\) be any tree extension of \(N\). We prove the lemma in two steps.
First, let \(v \in V(N)\) be a vertex with \(d \mathrel{\vcenter{:}}=\deg^+_N (v) \geq 3\), and let \(N'\) be obtained from \(N\) by stretching \(v\), thereby adding several new vertices (see 12 in the appendix): \[\begin{align} V(N') = V(N) &\uplus (\{u_{i, j} \mid i \in [2, d - 1] \land j \in [1, i]\} \\ &\uplus (\{u'_{i, j} \mid i \in [3, d - 1] \land j \in [2, i - 1]\} \\ &\uplus (\{u_{d, j} \mid j \in [2, d - 1]\} \\ &\uplus \{w_{i, j, k} \mid i, j \in [1, d - 1] \land k \in [1, 4]\}))) \text{\,.} \end{align}\] We construct a tree extension \(\Gamma'\) of \(N'\) by inserting the new vertices, \(V(N') \setminus V(N)\), in the form of a path right below \(v\) in \(\Gamma\), above the children of \(v\) in \(\Gamma\). The new vertices are inserted one after the other according to the following procedure:
For \(i \gets 2\) to \(d - 1\):
For \(j \gets 1\) to \(i\), insert \(u_{i, j}\).
For \(j \gets 2\) up to \(i - 1\), insert \(u'_{i, j}\).
For \(j \gets 2\) to \(d - 1\), insert \(u_{d, j}\).
For \(i \gets 1\) to \(d - 1\), for \(j \gets 1\) to \(d - 1\), for \(k \gets 1\) to \(4\), insert \(w_{i, j, k}\).
It is easy to verify that the resulting out-tree \(\Gamma'\) is a tree extension of \(N'\).
Second, we construct a tree extension \(\Gamma''\) of \(\mathop{\mathrm{str}}(N)\) as follows: Starting from \(\Gamma\), we perform the above procedure for each vertex of \(N\) that was stretched to obtain \(\mathop{\mathrm{str}}(N)\), inserting a new path each time. We observe that \(\mathop{\mathrm{sw}}(\Gamma'') \leq \mathop{\mathrm{sw}}(\Gamma) + 2 \cdot \Delta_{N}\) and, since \(\Gamma\) was chosen arbitrarily, \(\mathop{\mathrm{sw}}(\mathop{\mathrm{str}}(N)) \leq \mathop{\mathrm{sw}}(N) + 2 \cdot \Delta_{N}\). ◻
The last ingredient for 1 is the monotonicity of scanwidth under in-splitting.
lemmalemswin Let \(N'\) arise from any network \(N\) through in-splitting. Then, \(\mathop{\mathrm{sw}}(N') \leq \mathop{\mathrm{sw}}(N)\).
Proof. Let \(N\) be any arbitrary network, let \(v \in V(N)\) have in-degree at least \(3\) in \(N\), let \(u, w \in V^-_N (v)\) be two distinct parents of \(v\) in \(N\), and let \(N'\) be the result of in-splitting \(u\) and \(w\) from \(v\) in \(N\), thereby adding a new vertex \(x \in V(N') \setminus V(N)\). Also, let \(\Gamma\) be any tree extension of \(N\). Clearly, \(v\) cannot be the root of \(\Gamma\); let \(s \in V^-_\Gamma (v)\) be the parent of \(v\) in \(\Gamma\). We construct \(\Gamma'\) by subdividing the arc \((s, v) \in A(\Gamma)\) with \(x\) in \(\Gamma\). It is easy to see that \(\Gamma'\) is a tree extension of \(N'\). To conclude that \(\mathop{\mathrm{sw}}(N') \leq \mathop{\mathrm{sw}}(N)\), as \(\mathop{\mathrm{sw}}_{N'} (\Gamma') \leq \mathop{\mathrm{sw}}_N (\Gamma)\), we make the following observations: Let \(t \in V(\Gamma') \setminus \{x, v\} \subseteq V(\Gamma)\) be a vertex.
We have \(\mathop{\mathrm{GW}}_t (\Gamma') \setminus \{(u, x), (w, x)\} \subseteq \mathop{\mathrm{GW}}_t (\Gamma) \setminus \{(u, v), (w, v)\}\).
If \((u, x) \in \mathop{\mathrm{GW}}_t (\Gamma')\), then \((u, v) \in \mathop{\mathrm{GW}}_t (\Gamma)\).
If \((w, x) \in \mathop{\mathrm{GW}}_t (\Gamma')\), then \((w, v) \in \mathop{\mathrm{GW}}_t (\Gamma)\).
We have \(\mathop{\mathrm{GW}}_x (\Gamma') \uplus \{(u, v), (w, v)\} \subseteq \mathop{\mathrm{GW}}_v (\Gamma) \uplus \{(u, x), (w, x)\}\).
We have \(\mathop{\mathrm{GW}}_v (\Gamma') \uplus \{(u, v), (w, v)\} \subseteq \mathop{\mathrm{GW}}_v (\Gamma) \uplus \{(x, v)\}\).
Therefore, \(\lvert\mathop{\mathrm{GW}}_t (\Gamma')\rvert \leq \lvert\mathop{\mathrm{GW}}_t (\Gamma)\rvert\), \(\lvert\mathop{\mathrm{GW}}_x (\Gamma')\rvert \leq \lvert\mathop{\mathrm{GW}}_v (\Gamma)\rvert\), and \(\lvert\mathop{\mathrm{GW}}_v (\Gamma')\rvert \leq \lvert\mathop{\mathrm{GW}}_v (\Gamma)\rvert\). ◻
We finish with the main result of this paper.
Theorem 1. Given a network \(N\), a tree \(T\), and a tree extension \(\Gamma\) of \(N\), we can decide whether \(N\) softly displays \(T\) in \(\mathcal{O}^* (2^{\mathcal{O}(\Delta_{T} \cdot k \cdot \log(k))})\) time, where \(k \mathrel{\vcenter{:}}=\mathop{\mathrm{sw}}_N (\Gamma) + \Delta_{N}\).
Proof. Let \(N'\) be a binary (in-)resolution of \(\mathop{\mathrm{str}}(N)\). By [lem:strsd] [lem:binressd], we know that \(N\) softly displays \(T\) if and only if \(N'\) softly displays \(T\). Based on \(\Gamma\), we construct a tree extension \(\Gamma'\) of \(N'\) such that \(\mathop{\mathrm{sw}}_{N'} (\Gamma')\) is bounded from above by some linear function of \(\mathop{\mathrm{sw}}_N (\Gamma) + \Delta_{N}\), as described in the proofs of [lem:swstr] [lem:swin]. It is easy to modify \(N'\) and \(\Gamma'\) so as to fulfill the requirements of 1, since we reject if \(L(T) \nsubseteq L(N)\). This involves removing excess leaves from \(N'\), updating \(\Gamma'\) accordingly, and making it canonical. Finally, we invoke 6, from which we derive the promised running time; see 1. ◻
We devised a parameterized algorithm for the Soft Tree Containment problem, where it has to be decided whether a phylogenetic network softly displays a phylogenetic tree. This algorithm consists of two steps: solving the problem via dynamic programming when the network is binary and reducing any non-binary network to an equivalent binary one. The running time of this algorithm depends exponentially on a function of the network’s and the tree’s maximum out-degree and of the scanwidth attained by a given tree extension of the network. The dependence on the input size is polynomial.
Future work can attempt to eliminate the superpolynomial dependence on the maximum out-degrees or, alternatively, rule out the existence of such an algorithm. Because of the dependence on scanwidth, it is essential to be able to obtain low-scanwidth tree extensions in a reasonable amount of time. This further motivates the search for exact or approximate algorithms to construct such tree extensions. Additionally, it is of interest to tackle Soft Tree Containment with parameters stronger than scanwidth, such as node-scanwidth [20], edge-treewidth [21], or treewidth. Even weaker parameters could be of interest, when they give rise to algorithms that perform better in practice for example. Finally, it is worth exploring whether our techniques can be adapted to approach other containment problems, for instance, Network Containment in the sense of Janssen and Murakami [22].
In the following, we list the vertices and arcs of a stretch gadget explicitly (compare with 11). We hope that this can aid in possible implementation projects.
Definition 12. Let \(N\) be any arbitrary network, and let \(v \in V(N)\) be a vertex of out-degree \(d \mathrel{\vcenter{:}}=\deg^+_N (v)\) at least \(3\). Then, stretching \(v\) produces the network \(N' \mathrel{\vcenter{:}}=(V, A)\) by adding several new vertices, that is, \[\begin{align} V \mathrel{\vcenter{:}}= V(N) &\uplus (\{u_{i, j} \mid i \in [2, d - 1] \land j \in [1, i]\} \\ &\uplus (\{u'_{i, j} \mid i \in [3, d - 1] \land j \in [2, i - 1]\} \\ &\uplus (\{u_{d, j} \mid j \in [2, d - 1]\} \\ &\uplus \{w_{i, j, k} \mid i, j \in [1, d - 1] \land k \in [1, 4]\}))) \text{\,,} \end{align}\] while using the arcs \[\begin{align} A \mathrel{\vcenter{:}}={}& (A(N) \setminus A^+_N (v)) \\ &\cup \{(v, u_{2, 1}), (v, u_{2, 2})\} \\ &\cup \{(u_{i, 1}, u_{i + 1, 1}), (u_{i, 1}, u_{i + 1, 2}) \mid i \in [2, d - 2]\} \\ &\cup \{(u_{i, i}, u_{i + 1, i}), (u_{i, i}, u_{i + 1, i + 1}) \mid i \in [2, d - 2]\} \\ &\cup \{(u_{i, j}, u'_{i, j}) \mid i \in [3, d - 1] \land j \in [2, i - 1]\} \\ &\cup \{(u'_{i, j}, u_{i + 1, j}), (u'_{i, j}, u_{i + 1, j + 1}) \mid i \in [3, d - 1] \land j \in [2, i - 1]\} \\ &\cup \{(u_{d - 1, 1}, w_{1, 1, 1}), (u_{d - 1, 1}, u_{d, 2})\} \\ &\cup \{(u_{d - 1, d - 1}, u_{d, d - 1}), (u_{d - 1, d - 1}, w_{1, d - 1, 2})\} \\ &\cup \{(u_{d, j}, w_{1, j - 1, 2}) \mid j \in [2, d - 1]\} \\ &\cup \{(w_{i, j, 1}, w_{i, j, 3}), (w_{i, j, 1}, w_{i, j, 4}) \mid i, j \in [1, d - 1]\} \\ &\cup \{(w_{i, j, 2}, w_{i, j, 3}), (w_{i, j, 2}, w_{i, j, 4}) \mid i, j \in [1, d - 1]\} \\ &\cup \{(w_{i, j, 4}, w_{i, j + 1, 1}) \mid i \in [1, d - 1] \land j \in [1, d - 2]\} \\ &\cup \{(w_{i, 1, 3}, w_{i + 1, 1, 1}) \mid i \in [1, d - 2]\} \\ &\cup \{(w_{i, d - 1, 4}, w_{i + 1, d - 1, 2}) \mid i \in [1, d - 2]\} \\ &\cup \{(w_{i, j, 3}, w_{i + 1, j - 1, 2}) \mid i \in [1, d - 2] \land j \in [2, d - 1]\} \\ &\cup \{(w_{d - 1, j, 3}, c_j) \mid j \in [1, d - 1]\} \\ &\cup \{(w_{d - 1, d - 1, 4}, c_d)\} \text{\,,} \end{align}\] assuming that the children of \(v\) in \(N\) are \(V^+_N (v) = \{c_1, c_2, \dots, c_d\}\). Further, stretching \(N\) refers to stretching every vertex of \(N\) that has an out-degree of at least \(3\), and it produces the network \(\mathop{\mathrm{str}}(N)\).
This paper presents a result from the first author’s master’s thesis [1], which was supervised by the second author. An extended abstract of this paper appeared in the proceedings of SOFSEM’26 [2].↩︎
Scanwidth can alternatively be defined in terms of topological orderings instead of tree extensions [17]. The analogous sets are denoted \(\mathop{\mathrm{SW}}\). The notation \(\mathop{\mathrm{GW}}\) reflects that tree extensions are often denoted using a Greek Gamma. We later use the notation \(\mathop{\mathrm{HW}}\) for related sets because H is the successor of G in the Latin alphabet.↩︎