1 Introduction

In graph editing problems, we are given a (directed or undirected) graph G and a number k, and we search for a set of at most k vertices, edges or arcs whose removal or addition produces a graph with a desired property. There are several variants of these problems, and in this paper we consider the problem of removing arcs from a digraph in order to obtain a digraph in a given class \(\mathcal {C}\). When \(\mathcal {C}\) is the class of all directed acyclic graphs (DAGs), the problem is called Directed Feedback Arc Set (DFAS). If we remove vertices instead of arcs, the problem is called Directed Feedback Vertex Set (DFVS).

There are simple reductions between DFAS and DFVS. We can reduce DFAS to DFVS by taking the line digraph of the input. Removing a vertex from the reduced instance corresponds to removing an arc from the input instance and vice versa. For a reduction in the other direction, we split each vertex v into two vertices, say, \(v_o\) and \(v_i\), connect them with an arc \((v_i, v_o)\) and shift all outgoing arcs of v to \(v_o\) and all incoming arcs to \(v_i\). In the context of parameterized complexity, such reductions are called parameterized as the parameter k is preserved. Hence, parameterized results are often stated for DFVS (refer to [1, 2] for an introduction to parameterized complexity).

In a breakthrough paper it was proven that there is an algorithm for DFVS with running time \(4^kk!\cdot n^{\mathcal {O}(1)}\) [3], showing that the problem is fixed-parameter tractable (FPT) with respect to k. After obtaining an FPT result, it is natural to ask if the problem also admits a polynomial kernel, that is, if there is a polynomial-time algorithm which reduces the input instance to an instance of size at most \(\mathcal {O}(k^c)\) for some constant c. Such an algorithm is called a kernelization algorithm.

The existence of a polynomial kernel for DFVS is a fundamental open question in the field of parameterized complexity. One approach towards solving this question is to consider different parametrizations or restrictions of the input digraph. By considering progressively smaller parameters or more general digraph classes, one can hope to eventually close the gap between the restricted cases and the general case of DFVS.

On tournaments, DFVS admits a polynomial kernel [4]; this was extended to generalizations of tournaments as well [5]. When parameterized by solution size k and the size \(\ell \) of a treewidth \(\eta \)-modulator, DFVS admits a kernel of size \((k\cdot \ell )^{\mathcal {O}(\eta ^2)}\) [6].

One can also restrict the output instead, that is, we can consider \(\mathcal {C}\)-Vertex Deletion Set (\(\mathcal {C}\)-VDS) or \(\mathcal {C}\)-Arc Deletion Set (\(\mathcal {C}\)-ADS), where, for a fixed digraph class \(\mathcal {C}\), we search for a set of at most k vertices (arcs) whose removal turns the input into a digraph in \(\mathcal {C}\). Unlike DFVS and DFAS, \(\mathcal {C}\)-VDS and \(\mathcal {C}\)-ADS can belong to different complexity classes depending on \(\mathcal {C}\): While Out-Forest-ADS can be solved in polynomial time, Out-Forest-VDS is NP-hard [7]. Further, note that even if \(\mathcal {C'} \subseteq \mathcal {C}\), a polynomial kernel for \(\mathcal {C}\)-ADS does not immediately imply a polynomial kernel for \(\mathcal {C'}\)-ADS, and the implication also does not work in the other direction. Indeed, while the problem is trivial when \(\mathcal {C}\) is the class of all independent sets or the class of all digraphs, it is NP-hard if \(\mathcal {C}\) is the class of DAGs, which contains all independent sets and is a subclass of all digraphs. In a sense, the complexity landscapes of \(\mathcal {C}\)-ADS and \(\mathcal {C}\)-VDS are much more fine-grained than the landscape of DFVS, and may allow for smaller steps towards more general results.

Out-Forest-ADS and Pumpkin-ADS can be solved in polynomial time [7], while Out-Forest-VDS and Pumpkin-VDS are NP-hard and admit polynomial kernels [7, 8] of size \(\mathcal {O}(k^2)\) and \(\mathcal {O}(k^3)\), respectively [8]. \(\mathcal {F}_\eta \)-VDS admits a polynomial kernel for constant \(\eta \), where \(\mathcal {F}_\eta \) is the class of all digraphs with (undirected) treewidth at most \(\eta \) [6].

In this work we consider Funnel-ADS and provide a polynomial kernel with \(\mathcal {O}(k^6)\) vertices and \(\mathcal {O}(k^7)\) arcs. A digraph is a funnel if it is a DAG and every source to sink path has an arc which is not in any other source to sink path. Funnel-ADS is NP-hard even if the input is DAG, but it can be solved in \(\mathcal {O}(3^k\cdot (n+m))\) time [9], where k is the solution size. Out-forests and pumpkins are also funnels, but there are also dense funnels like complete bipartite digraphs (where all arcs go from the first partition to the second but not back).

Our results rely on characterizations for funnels based on forbidden subgraphs and on a “labeling” of the vertices [9]. We believe the techniques used here can be generalized to other digraph classes which are also similarly characterized, and hope they provide further insight about the classes \(\mathcal {C}\) for which \(\mathcal {C}\)-ADS admits a polynomial kernel.

2 Preliminaries

A (partial) function \(f: A \rightarrow B\) is a set of tuples \((a, f(a)) \in A \times B\) where for every \(a \in A\) there is at most one \(b \in B\) with \((a,b) \in f\) (that is, \(f(a) = b\)). We write \({\text {Dom}}(f)\) for the set of values \(a \in A\) for which f is defined. Hence, \(\emptyset \) is the undefined function, and \(f' \supseteq f\) if \(f'(x) = f(x)\) for every \(x \in {\text {Dom}}(f)\). All our functions are partial, that is, \({\text {Dom}}(f)\) is not necessarily A.

A parameterized language L is fixed-parameter tractable with respect to the parameter k if there is some algorithm with running time \(f(k)\cdot n^{\mathcal {O}(1)}\) deciding whether \((x, k) \in L\), where f is some computable function, and k is the parameter (refer to [1, 2] for an introduction to parameterized complexity). We say that L admits a problem kernel if there is a polynomial-time algorithm which transforms an instance (xk) into an instance \((x', k')\) such that \((x,k) \in L\) if and only if \((x', k') \in L\), \(k' \le k\) and for some computable function f. If f is a polynomial, we say that L admits a polynomial kernel with respect to k.

When describing a kernelization algorithm, it is common to define reduction rules. These rules have a condition and an effect, and we say that a reduction rule is applicable if the condition is true. The effect of the reduction rule produces a new instance \((x', k')\) of the problem, and a rule is said to be safe if \((x', k') \in L\) if and only if the original instance is in L. We refer the reader to [10, 11] for surveys on kernelization and to [12] for a book on the topic.

We only consider directed graphs (digraphs) without loops or parallel arcs (but we allow arcs in opposite directions) in this paper. Let D be a digraph. The set of arcs of D is denoted by A(D), and its set of vertices is V(D). The set of outneighbors (inneighbors) in D of a vertex \(v \in V(D)\) is denoted by \({{\textsf {out}}}_{D}(v)\) (\({{\textsf {in}}}_{D}(v)\)); the outdegree (indegree) of v is (). If the digraph D is clear from context, we omit it from the index. For a set \(U \subseteq V(D)\) we write \({{\textsf {out}}}_{}(U)\) for the set \(\{{{\textsf {out}}}_{}(u) \mid u \in U\} {\setminus } U\) (and analogously for \({{\textsf {in}}}_{}(U)\)). A vertex v is a source if \({{\textsf {indeg}}}_{}(v) = 0\), and it is a sink if \({{\textsf {outdeg}}}_{}(v) = 0\). We write \(H \subseteq D\) if H a subgraph of D; the subgraph of D induced by U is given by \(D[U]\). We write \(D - X\) for the operation of deleting a set of vertices or arcs X from D. Similarly, we add a set of arcs or vertices to D with \(D + X\).

A directed acyclic graph (DAG) is a digraph which does not contain any directed cycle. A digraph D is a funnel if D is a DAG and for every path P from a source to a sink of D of length at least one there is some arc \(a \in A(P)\) such that for any different path Q from a (possibly different) source to a sink we have \(a \not \in A(Q)\). We repeat below several known characterizations for funnels, as they are particularly useful for our results.

Fig. 1
figure 1

\(D_1\), a forbidden subgraph for funnels

Theorem 2.1

([9], Theorem 1) Let D be a DAG. The following statements are equivalent.

  1. 1.

     D is a funnel.

  2. 2.

    V(D) can be partitioned into two sets F and M such that: (1) F induces an out-forest; (2) M induces an in-forest; and (3) \((M \times F) \cap A(D) = \emptyset \).

  3. 3.

    No digraph in \(\mathcal {F} = \{D_i \mid i \in \{0,1, \dots \}\}\) is contained in D as a (not necessarily induced) subgraph, where (see Fig. 1 for an example)

    • \(V(D_k) = \{u_1, u_2, w_1, w_2\} \cup \{v_i \mid 0 \le i \le k\}\), and

    • \(A(D_k) = \{(u_1,v_0), (u_2, v_0), (v_k, w_1), (v_k, w_2)\} \cup \{(v_i, v_{i+1}) \mid 0 \le i \le k - 1\}\)

  4. 4.

     D does not contain \(D_0\) as a butterfly minor.

The digraphs in \(\mathcal {F}\) are called forbidden subgraphs for funnels. For a digraph D we define a labeling as a function \(\ell : V(D) \rightarrow \{\textsc {F}, \textsc {M}\}\). We say that \(\ell \) is a funnel labeling for D if \({\text {Dom}}(\ell ) = V(D)\), the set \(F = \{v \in V(D) \mid \ell (v) = \textsc {F}\}\) induces an out-forest in D, the set \(M = \{v \in V(D) \mid \ell (v) = \textsc {M}\}\) induces an in-forest in D and \((M \times F) \cap A(D) = \emptyset \). Due to theorem 2.1(2), a digraph D is a funnel if and only if there exists a funnel labeling for D.

In the feedback arc set problem, we are given a digraph D and a \(k \in \mathbb {N}\) as an input, and we search for a set \(S \subseteq A(D)\) such that \(D - S\) is a DAG and . We consider a variant of this problem where we want \(D - S\) to be a funnel instead, which is formally defined below.

figure a

To make better use of theorem 2.1 (2), we consider a more general problem in which some vertices might already be labeled with F or M, and the funnel we obtain in the end must respect this labeling. Formally, the problem is defined as follows.

figure b

We say that \((D,\ell ,k)\) is the input instance and \((S, \hat{\ell })\) is a solution for the input instance. This more general version of the problem allows us to decide which label a vertex will take and encode this in the instance itself. While technically not necessary, using FADL instead of FADS simplifies the kernelization algorithm and also the proofs.

3 Basic Reduction Rules

We construct our kernelization algorithm by defining a series of reduction rules and then showing that, if no reduction rule is applicable, the input size is bounded in a polynomial of k. Our strategy is to partition the vertex set into labeled and unlabeled vertices, then bound the number of unlabeled vertices (Sect.  3.1) and use this to bound the number of labeled vertices (Sect. 3.2) as well. In this section we define some reduction rules which are useful both in Sect. 3.1 as well as in Sect. 3.2. For brevity, we assume that a reduction rule is no longer applicable to the input instance after it has been defined. Further, we refer to the instance after application of a reduction rule as the reduced instance. Similarly, the reduced digraph is the digraph obtained after applying a reduction rule.

Let \((D, \ell , k)\) be the input instance. From theorem 2.1(3) we can see that every vertex v in a funnel has \({{\textsf {indeg}}}_{}(v) \le 1\) or \({{\textsf {outdeg}}}_{}(v) \le 1\). Further, \({{\textsf {indeg}}}_{}(v) \le 1\) if \(\ell (v) = \textsc {F}\), and \({{\textsf {outdeg}}}_{}(v) \le 1\) if \(\ell (v) = \textsc {M}\). Hence, by simply counting the number of vertices disrespecting each case, we can obtain a lower bound for the number of arcs that need to be removed from D in order to obtain a funnel. As removing one arc changes the degree of two vertices, we obtain a bound of at most 2k such vertices. The safety of the following reduction rule follows easily from theorem 2.1.

Reduction Rule 3.1

(Lower Bound) Let \(V_I \subseteq V(D)\) be the set of vertices with indegree greater than one, let \(V_O\) be the set of vertices with outdegree greater than one and let \(V_X = V_O \cap V_I\). Output a trivial “no”-instance if

$$\begin{aligned}&\sum _{u \in V_O, \ell _{}(u) = \textsc {M}}({{\textsf {outdeg}}}_{}(u) - 1) + \sum _{u \in V_I, \ell _{}(u) = \textsc {F}}({{\textsf {indeg}}}_{}(u) - 1) \\&\qquad +\sum _{u \in V_X, u \not \in {\text {Dom}}(\ell _{})}(\min \{{{\textsf {indeg}}}_{}(u), {{\textsf {outdeg}}}_{}(u)\} - 1) > 2k. \end{aligned}$$

The following reduction rule is based on [9], with some modifications since the original reduction rule is applied as an intermediate step in an FPT algorithm and is not safe for kernelization. For certain vertices it is possible to optimally decide which label they should receive in an optimal solution. For example, vertices with outdegree greater than \(k + 1\) can always be labeled with \(\textsc {F}\), as otherwise we would need to remove at least \(k+1\) of its outgoing arcs, which is not possible.

Reduction Rule 3.2

(Set Label) Let \(v \in V(D)\) be an unlabeled vertex.

Set \(\ell _{}(v) {:}{=}\textsc {F}\) if at least one of the following is true: (1)\({{\textsf {indeg}}}_{}(v) = 0\); (2) v has a single inneighbor u and \(\ell _{}(u) = \textsc {F}\); (3) there are at least \({{\textsf {indeg}}}_{}(v)+1\) vertices \(u \in {{\textsf {out}}}_{}(v)\) with \(\ell _{}(u) = \textsc {M}\) or \(\ell _{}(u) = \textsc {F} \wedge {{\textsf {indeg}}}_{}(u) = 1\); or (4) \({{\textsf {outdeg}}}_{}(v) > k+1\). Set \(\ell _{}(v) {:}{=}\textsc {M}\) if at least one of the following is true: (1) \({{\textsf {outdeg}}}_{}(v) = 0\); (2) v has a single outneighbor u and \(\ell _{}(u) = \textsc {M}\); (3) there are at least \({{\textsf {outdeg}}}_{}(v)+1\) vertices \(u \in {{\textsf {in}}}_{}(v)\) with \(\ell _{}(u) = \textsc {F}\) or \(\ell _{}(u) = \textsc {M} \wedge {{\textsf {outdeg}}}_{}(u) = 1\); or (4) \({{\textsf {indeg}}}_{}(v) > k + 1\).

Proof of safety of Set Label (RR 3.2)

Clearly, a solution for the reduced instance is also a solution for the original instance. For the other direction, we consider only the case where we set \(\ell _{}(v) {:}{=}\textsc {F}\), as the other case is symmetric. Let \(\ell _r\) be the labeling obtained by the reduction rule. Let \((S, \hat{\ell })\) be a solution for the original instance. We set \(\hat{\ell }_r{:}{=}\hat{\ell }\) and \(\hat{\ell }_r(v) {:}{=}\textsc {F}\). If \(\hat{\ell }(v) = \textsc {F}\), then clearly \((S, \hat{\ell }_r)\) is a solution for the reduced instance. So assume \(\hat{\ell }(v) = \textsc {M}\). This implies that \({{\textsf {outdeg}}}_{}(v) \le k+1\), as otherwise .

If \({{\textsf {indeg}}}_{}(v) = 0\), or \({{\textsf {indeg}}}_{}(v) = 1\) and there is some \(u \in {{\textsf {in}}}_{}(v)\) with \(\ell (u) = \textsc {F}\), then \(\hat{\ell }_r\) is clearly also a funnel labeling for \(D - S\).

Let \(U = \{ u \in {{\textsf {out}}}_{}(v) \mid \ell (u) = \textsc {M} \text { or } \ell (u) = \textsc {F} \wedge {{\textsf {indeg}}}_{}(u) = 1\}\). If , we construct an \(S_r\) from S as follows. We add all incoming arcs of v to \(S_r\) and remove from \(S_r\) all outgoing arcs (vu) where \(u \in U\). Since \(\hat{\ell }(v) = \textsc {M}\), at least \({{\textsf {outdeg}}}_{}(v) - 1 \ge {{\textsf {indeg}}}_{}(v)\) outgoing arcs of v are in S. Hence, we remove at least \({{\textsf {indeg}}}_{}(v)\) arcs from S and add at most \({{\textsf {indeg}}}_{}(v)\). Thus, .

The digraph \(D - S_r\) does not contain cycles, as all incoming arcs of v were removed, so any cycle in \(D - S_r\) is also in \(D - S\), which is a funnel. To see that \(\hat{\ell }_r\) is a funnel labeling of \(D - S_r\), first note that we can always keep arcs (vu) in \(D - S_r\) where \(\ell _{}(u) = \textsc {M}\). We can also keep arcs (vu) in \(D - S_r\) where \(\ell (u) = \textsc {F}\) and \({{\textsf {indeg}}}_{}(u) = 1\). As v has no incoming arcs in \(D - S_r\), it lies in an out-forest. Hence, \(\hat{\ell }_r\) is a funnel labeling of \(D - S_r\). \(\square \)

Fig. 2
figure 2

A digraph which is not a funnel. Removing the arcs (vu) and (uw) results in a funnel

Replacing an arc in a funnel by a directed path cannot create any cycles nor any forbidden subgraph for funnels. The next reduction rule reverses this operation: We can contract certain paths where all vertices have in- and outdegree one to a single arc. However, we cannot replace any such path: In the example in Fig. 2, if we remove u and add the arc (vw), then the size of an optimal solution set decreases by one. Some cases where contracting an arc is safe are identified below.

Reduction Rule 3.3

(Dissolve Vertex) Let uvw be a path such that the following is true: (1) \(v,u \in {\text {Dom}}(\ell )\) implies \(\ell (v) = \ell (u)\); and (2) \(v,w \in {\text {Dom}}(\ell )\) implies \(\ell (v) = \ell (w)\).

If \({{\textsf {indeg}}}_{}(v) = {{\textsf {outdeg}}}_{}(v) = 1\) and \(({{\textsf {indeg}}}_{}(w) = 1 \vee {{\textsf {outdeg}}}_{}(u) = 1)\), delete the vertex v and add the arc (uw).

Proof of safety of Dissolve Vertex (RR 3.3)

Let \(D'\) be the reduced digraph. It is easy to see that we can obtain a solution for the reduced instance from a solution for the original instance: If we remove (uv) or (vw) from D, we can instead remove (uw) from \(D'\). As this is equivalent to removing v from D, the result is also a funnel and we can keep the same labeling (up to v, which is not in \(D'\)). If neither (uv) nor (vw) were removed, we simply keep the same arc-deletion set and labeling.

Now let \((S_r, \hat{\ell }_r)\) be a solution for the reduced instance. We start by setting \(\hat{\ell }{:}{=}\hat{\ell }_r\). If \((u,w) \not \in S_r\), we set \(\hat{\ell }(v) {:}{=}\hat{\ell }_r(u)\). It is easy to see that \(\hat{\ell }\) is a funnel labeling for \(D - S_r\).

If \((u,w) \in S_r\), we distinguish two cases. If \({{\textsf {outdeg}}}_{D}(u) = 1\), we set \(\hat{\ell }(v) {:}{=}\hat{\ell }(u)\) and \(S{:}{=}(S_r{\setminus } \{(u,w)\}) \cup \{(v,w)\}\). Regardless of whether \(\hat{\ell }(u) = \textsc {M}\) or \(\hat{\ell }(u) = \textsc {F}\), we do not need to remove (uv). Since the neighborhood of w did not change and any cycle in \(D - S\) is also a cycle in \(D' - S_r\), we have that \(\hat{\ell }\) is a funnel labeling for \(D - S\).

If \({{\textsf {outdeg}}}_{D}(u) > 1\) and \({{\textsf {indeg}}}_{D}(w) = 1\), we set \(\hat{\ell }(v) {:}{=}\hat{\ell }(w)\) and \(S{:}{=}(S_r{\setminus } \{(u,w)\}) \cup \{(u,v)\}\). As before, we may keep the arc (wu) in \(D - S\), and \(\hat{\ell }\) is a funnel labeling for \(D - S\). Since the case \({{\textsf {outdeg}}}_{D}(u) > 1\) and \({{\textsf {indeg}}}_{D}(w) > 1\) does not occur, this concludes the proof. \(\square \)

3.1 Bounding the Number of Unlabeled Vertices

From Lower Bound (RR 3.1) we know there are few vertices with both in- and outdegree greater than one. In this section we bound the number of unlabeled vertices by considering the remaining unlabeled vertices, that is, vertices v with \({{\textsf {indeg}}}_{}(v) \le 1\) or \({{\textsf {outdeg}}}_{}(v) \le 1\). Our strategy is to group such vertices into subgraphs of D with specific properties which we define later, and then develop reduction rules to both bound the maximum number of such subgraphs and also their size in any “yes”-instance of FADL.

Even if the previous reduction rules are not applicable, there can still exist some “large” subgraph \(H \subseteq D\) for which there is a “small” set \(S\subseteq A(D)\) such that the weakly-connected component of H is a funnel in \(D - S\). Our goal is to bound the size of such subgraphs H.

We first define a specific type of subgraph of D which behaves like a funnel in the sense that the degrees of the vertices match theorem 2.1(2). We call such subgraphs local funnels and formally define them below.

Definition 3.1

An induced subgraph \(H \subseteq D\) is a local funnel in D if H is a funnel, H has only one source and its vertex set can be partitioned into \(F \uplus M = V(H)\) such that \({{\textsf {indeg}}}_{D}(v) \le 1\) for all \(v \in F\); \({{\textsf {outdeg}}}_{D}(v) \le 1\) for all \(v \in M\); and \((M \times F) \cap A(H) = \emptyset \).

Unlike local funnels, we might still have to remove many arcs from an induced funnel in D, as it can have, for example, several vertices v with \({{\textsf {indeg}}}_{D}(v) >1\) and \({{\textsf {outdeg}}}_{D}(v) > 1\). Our goal is to bound the size of each unlabeled local funnel (that is, each local funnel where none of the vertices have a label) and the number of unlabeled local funnels in D. We start by “pushing” as many vertices as we can to the neighborhood of the roots of the in- and out-forests of a local funnel. Consider for example a path uvw as in Fig. 3, whose vertices have indegree one but can have higher outdegree. Intuitively, a cycle containing v and x must also contain u. To destroy this cycle, we can remove the unique incoming arc of u, as this will potentially destroy further cycles that contain u but not v. Hence, replacing the arc (vx) with (ux) in this case does not change the size of the solution.

By moving vertices in an out-tree towards its root s, we increase the outdegree of s. If the outdegree of s increases beyond \(k+1\), we can apply Set Label (RR 3.2) to s, giving it a label. By further applying Set Label (RR 3.2) to the neighbors of s which are in its out-tree, we can label the entire tree. As we are only considering unlabeled local funnels in this section, we can use the idea above to limit the branching of any in- or out-tree of an unlabeled local funnel.

we provide here a somewhat more general reduction rule which can also be applied if some vertices are labeled. Later, this reduction rule will again be useful to bound the number of labeled vertices. However, we need to carefully consider the possible labels of the vertices, as in some cases the rule would not be safe.

Fig. 3
figure 3

Example application of shift neighbors (RR 3.4)

Reduction Rule 3.4

(Shift Neighbors) Let uvw be a path.

  • If \({{\textsf {indeg}}}_{}(u) = {{\textsf {indeg}}}_{}(v) = {{\textsf {indeg}}}_{}(w) = 1\), \((u, \textsc {M}) \not \in \ell \), \((v, \textsc {M}) \not \in \ell \) and there is an \(x \in {{\textsf {out}}}_{}(v) {\setminus } {{\textsf {out}}}_{}(u)\) with \(w \ne x\), then remove the arc (vx) and add the arc (ux).

  • If \({{\textsf {outdeg}}}_{}(u) = {{\textsf {outdeg}}}_{}(v) = {{\textsf {outdeg}}}_{}(w) = 1\), \((v, \textsc {F})\not \in \ell \), \((w, \textsc {F}) \not \in \ell \) and there is an \(x \in {{\textsf {in}}}_{}(v) {\setminus } {{\textsf {in}}}_{}(w)\) with \(u \ne x\), then remove the arc (xv) and add the arc (xw).

Before proving that Shift Neighbors (RR 3.4) is safe, we need two simple observations about certain cases where we can safely exchange two arcs or add an arc.

Observation 3.2

Let H be a funnel with funnel labeling \(\ell _{}\) and let \(x,u,v \in V(H)\) such that \((v,x) \in A(H)\), \((u,x) \not \in A(H)\) and at least one of the following is true: (1) \(\ell _{}(u) = \textsc {F}\); or (2) \(\ell _{}(u) = \textsc {M} = \ell _{}(v)\) and \({{\textsf {outdeg}}}_{H}(u) = 0\). Let \(H' = H - (v,x) + (u,x)\). Then \(\ell _{}\) is also a funnel labeling for \(H'\) if \(H'\) is a DAG.

Proof

Assume \(H'\) is a DAG.

Case 1: \(\ell _{}(u) = \textsc {F}\). If \(\ell (x) = \textsc {M}\), then both \(H + (u,x)\) and \(H - (v,x) + (u,x)\) are funnels. If \(\ell (x) = \textsc {F}\), then \(H'\) is the result of switching the unique inneighbour of x in the out-forest induced by vertices labeled with \(\textsc {F}\). This is clearly an out-forest, and hence \(\ell _{}\) is a funnel labeling for \(H'\).

Case 2: \(\ell (u) = \textsc {M} = \ell (v)\) and \({{\textsf {outdeg}}}_{H}(u) = 0\). As \((v,x) \in A(H)\), we have \(\ell (x) = \textsc {M}\). Since \({{\textsf {outdeg}}}_{H}(u) = 0\)\(\ell \) is a funnel labeling for \(H + (u,x)\) and, hence, also for \(H'\). \(\square \)

Observation 3.3

Let H be a DAG and \(x,u,v \in V(H)\) such that \(\{u\} = {{\textsf {in}}}_{}(v)\). Then \(H + (u,x)\) contains a cycle if and only if \(H + (v,x)\) contains a cycle.

Proof

Assume \(H + (v,x)\) contains a cycle C. As \(\{u\} = {{\textsf {in}}}_{}(v)\), we get \((u,v) \in A(C)\). Hence, replacing (uv) and (vx) with (ux) in C produces a cycle in \(H + (u,x)\).

If \(H + (u,x)\) contains a cycle C, then we can replace (ux) by the path from u to x in \(H + (v,x)\) going through v. This constructs a cycle in \(H + (v,x)\), as desired. \(\square \)

Proof of safety of Shift Neighbors (RR 3.4)

Consider the case where \({{\textsf {indeg}}}_{}(u) = {{\textsf {indeg}}}_{}(v) = {{\textsf {indeg}}}_{}(w) = 1\), \((u, \textsc {M}) \not \in \ell \), \((v, \textsc {M}) \not \in \ell \) and there is an \(x \in {{\textsf {out}}}_{}(v) {\setminus } {{\textsf {out}}}_{}(u)\) with \(w \ne x\). The other case follows analogously. Let \((D', \ell , k)\) be the reduced instance and \((S_r, \hat{\ell }_r)\) be a solution for it. We construct a solution \((S, \hat{\ell })\) for the input instance \((D, \ell , k)\).

First observe that, if \((u,x) \in S_r\), we can replace it with (vx) in S, which means that \(D' - S_r\) and \(D - S\) are isomorphic. By setting \(\hat{\ell }{:}{=}\hat{\ell }_r\), we obtain the desired solution. If \((u,x) \not \in S_r\), we consider the following cases.

Case 1: \(\hat{\ell }_r(v) = \textsc {F}\). We set \(\hat{\ell }{:}{=}\hat{\ell }_r\) and \(S {:}{=}S_r\). Let \(D^\star = D - S\). Clearly, \(D^\star = D' - S_r- (u,x) + (v,x)\). As u is the only inneighbor of v, from Observation 3.3 we know \(D^\star \) is a DAG. From Observation 3.2, we know that \(\hat{\ell }= \hat{\ell }_r\) is a funnel labeling for \(D^\star \).

Case 2: \(\hat{\ell }_r(v) = \textsc {M} = \hat{\ell }_r(u)\). If \(D' - S_r+ (u,v)\) is a DAG, we can assume that \((u,v) \not \in S_r\), implying \((u,x) \in S_r\) (which was already considered).

If \(D' - S_r+ (u,v)\) is not a DAG, then it contains a cycle with v and u, implying \((u,v) \in S_r\). In particular, \({{\textsf {indeg}}}_{D' - S_r}(v) = 0\). We set \(\hat{\ell }{:}{=}\hat{\ell }_r\) and \(\hat{\ell }(v) {:}{=}\textsc {F}\). Clearly, \(\hat{\ell }\) is a funnel labeling for \(D' - S_r\). From Observation 3.2 we have that \(\hat{\ell }\) is a funnel labeling for \(D - S_r\) as well.

Case 3: \(\hat{\ell }_r(v) = \textsc {M}\) and \(\hat{\ell }_r(u) = \textsc {F}\). We set \(\hat{\ell }{:}{=}\hat{\ell }_r\), \(\hat{\ell }(v) {:}{=}\textsc {F}\) and \(S {:}{=}S_r\). As \(\{u\} = {{\textsf {in}}}_{D}(v)\) and \(\hat{\ell }_r(u) = \textsc {F}\)\(\hat{\ell }\) is a funnel labeling for \(D' - S_r\). Let \(D^\star = D - S\).

From Observation 3.3 we know \(D^\star = D' - S_r- (u,x) + (v,x)\) is a DAG since \(D' - S_r\) is a DAG. Hence, from Observation 3.2 we obtain that \((S_r, \hat{\ell })\) is a solution for the input instance. In all cases a solution for the reduced instance implies a solution for the original instance.

Now assume there is a solution \((S, \hat{\ell })\) for the original instance. We show that there is solution \((S_r, \hat{\ell }_r)\) for the reduced instance. As in the previous direction, if \((v,x) \in S\), we can replace it with (ux) and obtain the desired solution. So assume \((v,x) \not \in S\).

If \((u,v) \in S\), let \(S_1 = S \cup \{(y,u)\}\), where \(\{y\} = {{\textsf {in}}}_{}(u)\). Clearly, \(\hat{\ell }\) is a funnel labeling for \(D - S_1\). We set \(\hat{\ell }_r{:}{=}\hat{\ell }\) and \(\hat{\ell }_r(u) {:}{=}\textsc {F}\). As \({{\textsf {indeg}}}_{D - S_1}(u) = 0\)\(\hat{\ell }_r\) is also a funnel labeling for \(D - S_1\). From Observation 3.2 we know that \(\hat{\ell }_r\) is a funnel labeling for \(D_1 = D' - S_1\). Since \({{\textsf {indeg}}}_{D_1}(v) = 0 = {{\textsf {indeg}}}_{D_1}(u)\) and \(\hat{\ell }_r(u) = \textsc {F}\), we have that \(\hat{\ell }_r\) is a funnel labeling for \(D_1 + (u,v)\). Hence, \((S{\setminus } \{(u,v)\}, \hat{\ell }_r)\) is a solution for the reduced instance.

In the following we consider the remaining cases where \(\{(u,v), (v,x)\} \cap S =~\emptyset \). Note that the case \(\hat{\ell }(u) = \textsc {M}\) and \(\hat{\ell }(v) = \textsc {F}\) does not happen under this assumption.

Case 1: \(\hat{\ell }(v) = \textsc {F} = \hat{\ell }(u)\). We set \(\hat{\ell }_r{:}{=}\hat{\ell }\) and \(S_r{:}{=}S\). Clearly, \(D' - S_r= D - S- (v,x) + (u,x)\). From Observation 3.3 there is no cycle in \(D - S+ (u,x)\) and, hence, \(D' - S_r\) is a DAG. Thus, from Observation 3.2 we have that \(\hat{\ell }_r\) is a funnel labeling for \(D' - S_r\).

Case 2: \(\hat{\ell }(v) = \textsc {M} = \hat{\ell }(u)\). Since \((v,x) \not \in S\), we have \((v,w) \in S\) and \(\hat{\ell }(x) = \textsc {M}\). Further, we know that \(D' - S\) is a DAG due to Observation 3.3. Let \(S_1 = S\cup \{(u,v)\}\). Clearly, \(\hat{\ell }\) is a funnel labeling for \(D - S_1\), and \(D' - S_1\) is also a DAG. From Observation 3.2 we have that \(\hat{\ell }\) is a funnel labeling for \(D' - S_1\).

We set \(\hat{\ell }_r{:}{=}\hat{\ell }\) and \(\hat{\ell }_r(v) {:}{=}\textsc {F}\). Since \({{\textsf {indeg}}}_{D' - S_1}(w) = 0 = {{\textsf {indeg}}}_{D' - S_1}(v)\), we have that \(\hat{\ell }_r\) is a funnel labeling for \(D' - S_1 + (v,w)\), regardless of the label of w. By setting \(S_r{:}{=}(S {\setminus } \{(v,w)\}) \cup \{(u,v)\}\), we get that \(\hat{\ell }_r\) is a funnel labeling for \(D' - S_r\) and .

Case 3: \(\hat{\ell }(v) = \textsc {M}\) and \(\hat{\ell }(u) = \textsc {F}\). Let \(S_r= S\) and \(\hat{\ell }_r= \hat{\ell }\). Since \((u,v) \not \in S_r\), from Observation 3.3 we know that \(D - S_r- (v,x) + (u,x)\) is a DAG. From Observation 3.2 we have that \(\hat{\ell }_r\) is a funnel labeling for \(D' - S_r\).

In all cases we found a solution \((S_r, \hat{\ell }_r)\) for the reduced instance, concluding the proof. \(\square \)

It is not always possible to exhaustively apply Shift Neighbors (RR 3.4): If uvw forms a cycle, we would shift x indefinitely through this cycle. To prevent this from happening, we need the following reduction rule:

Reduction Rule 3.5

(Break Cycle) Let C be a cycle in D. If every vertex in C has indegree (outdegree) one and either every vertex in C is unlabeled or every vertex in C is labeled with \(\textsc {F}\) (\(\textsc {M}\)), then delete one arc of C and decrease k by one.

Proof of safety of Break Cycle (RR 3.5)

Let (vu) be the arc removed by the reduction rule. Clearly, a solution for the reduced instance together with the arc (vu) is a solution for the original instance. Let \((S, \hat{\ell })\) be a solution for the original instance, and assume that \((v,u) \not \in S\). Let (wx) be an arc of C contained in \(S\). Without loss of generality, we assume that (wx) is the only incoming arc of x. The case where it is the only outgoing arc of w follows analogously.

We can assume that \(\hat{\ell }(v) = \textsc {F}\) for all \(v \in V(C)\): If they were not labeled by \(\ell \) when the rule was applied, then by repeatedly applying Set Label (RR 3.2) (starting with x) we can label them with \(\textsc {F}\). Because \({{\textsf {indeg}}}_{D}(v) = 1\) for every \(v \in C\), it follows that C is the only cycle in D using the arc (wx). Hence, \(D' = D - S+ (w,x) - (v,u)\) is a DAG. Further, as \(\hat{\ell }(w) = \hat{\ell }(x) = \textsc {F}\), it is easy to see that \(\hat{\ell }\) is a funnel labeling for \(D'\). \(\square \)

If Shift Neighbors (RR 3.4) is not applicable, then many vertices in a long path P in a local funnel must share a common out- or inneighbor w. However, from Set Label (RR 3.2) we know that w receives a label if it has too many neighbors. The next and final reduction rule needed for bounding the number of unlabeled vertices exploits this property and allows us to label some vertex u in P if its predecessor v in P is adjacent to a labeled vertex w.

Reduction Rule 3.6

(Labeled Neighbor) Let (vu) be an arc between unlabeled vertices. Set \(\ell _{}(u) {:}{=}\textsc {F}\) if \({{\textsf {indeg}}}_{}(u) = {{\textsf {indeg}}}_{}(v) = 1\) and \(\exists w \in {{\textsf {out}}}_{}(v) : \ell _{}(w) = \textsc {M}\). Set \(\ell _{}(v) {:}{=}\textsc {M}\) if \({{\textsf {outdeg}}}_{}(u) = {{\textsf {outdeg}}}_{}(v) = 1\) and \(\exists w \in {{\textsf {in}}}_{}(u) : \ell _{}(w) = \textsc {F}\).

Proof of safety of Labeled Neighbor (RR 3.6)

Assume, without loss of generality, that the first case of the rule was applied. The proof for the second case follows analogously (note that it is not possible for both cases to be applied simultaneously). Let \((D, \ell _r, k)\) be the reduced instance. First note that \(\ell _r\supseteq \ell \), which means that a solution for the reduced instance is already a solution for the original instance. Hence, it suffices to show that a solution \((S,\hat{\ell })\) for the original instance implies a solution \((S_r, \hat{\ell }_r)\) for the reduced instance.

If \(\hat{\ell }(u) = \textsc {F}\), we set \(\hat{\ell }_r{:}{=}\hat{\ell }\) and \(S_r{:}{=}S\) and we are done. So assume that \(\hat{\ell }(u) = \textsc {M}\).

Case 1: \((v,u) \in S\). We set \(S_r{:}{=}S\), \(\hat{\ell }_r{:}{=}\hat{\ell }\) and \(\hat{\ell }_r(u) {:}{=}\textsc {F}\). As \({{\textsf {indeg}}}_{D - S}(u) = 0\), we know that \(\hat{\ell }_r\) is also a funnel labeling for \(D - S\).

Case 2: \((v,u) \not \in S\) and \(\hat{\ell }(v) = \textsc {F}\). We set \(S_r{:}{=}S\), \(\hat{\ell }_r{:}{=}\hat{\ell }\) and \(\hat{\ell }_r(u) {:}{=}\textsc {F}\). As \(\hat{\ell }_r(v) = \textsc {F} = \hat{\ell }_r(u)\), we may keep the arc (vu) and \(\hat{\ell }_r\) is a funnel labeling for \(D - S_r\).

Case 3: \((v,u) \not \in S\) and \(\hat{\ell }(v) = \textsc {M}\). Then \((v,w) \in S\). We set \(\hat{\ell }_r{:}{=}\hat{\ell }\), \(\hat{\ell }_r(u) {:}{=}\textsc {F}\), \(\hat{\ell }_r(v) {:}{=}\textsc {F}\), \(S_r{:}{=}(S{\setminus } \{(v,w)\}) \cup \{(y,v)\}\), where y is the unique inneighbor of v.

The digraph \(D - S_r\) is a DAG: if it has a cycle, the cycle would have to use the arc (vw), yet \({{\textsf {indeg}}}_{D - S_r}(v) = 0\), a contradiction. We now argue that \(\hat{\ell }_r\) is a funnel labeling for \(D - S_r\). Since \({{\textsf {indeg}}}_{D - S_r}(v) = 0\), \({{\textsf {indeg}}}_{D - S_r}(u) = 1\) and \(\hat{\ell }_r(u) = \textsc {F}\), the vertex v is the unique inneighbor of u in the out-forest of the funnel \(D - S_r\). Finally, as \(\hat{\ell }_r(w) = \textsc {M}\), the arc (vw) is allowed in the funnel. Hence, \(\hat{\ell }_r\) is a funnel labeling for \(D - S_r\).

In all cases we find a solution \((\hat{\ell }_r\)\(S_r)\) for the reduced instance, concluding the proof. \(\square \)

Lemma 3.4

Let s be some source (sink) of some unlabeled local funnel H in the reduced digraph D. Let \(P_1, P_2, \dots , P_{a}\) be a sequence of paths in H starting (ending) at s such that \({{\textsf {indeg}}}_{}(u) \le 1\) \(({{\textsf {outdeg}}}_{}(u) \le 1)\) for each u in each \(P_i\), and \(V(P_j) \not \subseteq V(P_i)\) for all \(1 \le i,j \le a\) where \(i \ne j\). Let E be the set of end (start) points of all \(P_i\). Then all of the following hold.

  1. 1.

    \({{\textsf {outdeg}}}_{}(u) > 1\) \(({{\textsf {indeg}}}_{}(u) > 1)\) for any inner vertex u of any \(P_i\).

  2. 2.

    \({{\textsf {out}}}_{}(\bigcup _{i=1}^aV(P_i) {\setminus } E) \subseteq {{\textsf {out}}}_{}(s)\) \(({{\textsf {in}}}_{}(\bigcup _{i=1}^aV(P_i) {\setminus } E) \subseteq {{\textsf {in}}}_{}(s))\),

  3. 3.

    \(V(P_i) \cap V(P_j) = \{s\}\) for each \(1 \le i,j \le a\) where \(i \ne j\), and

  4. 4.

    \(a \le k+1\) and for each \(1 \le i \le a\).

Proof

We consider the case where s is a source of H. The other case follows analogously.

Let u be some inner vertex of some \(P_i\) and w the unique outneighbor of u in \(P_i\). By assumption on \(P_i\), we have \({{\textsf {indeg}}}_{D}(w) = 1\). As Dissolve Vertex (RR 3.3) is not applicable, we have that \({{\textsf {outdeg}}}_{}(u) > 1\) (proving (1)). In particular, u has some outneighbor x not in \(P_i\).

Let v be the inneighbor of u in \(P_i\). Since \({{\textsf {indeg}}}_{D}(v) = {{\textsf {indeg}}}_{D}(u) = {{\textsf {indeg}}}_{D}(w) = 1\) and Shift Neighbors (RR 3.4) is not applicable, we have \(x \in {{\textsf {out}}}_{D}(v)\). By repeating this argument to the predecessors of u in \(P_i\), we prove (2) (and also that \(a \le k+1\), as \({{\textsf {outdeg}}}_{D}(s) \le k+1\) due to Set Label (RR 3.2)).

Assume there are two paths \(P_i\) and \(P_j\) intersecting at more than one vertex. Let u be the last vertex of the intersection. Note that, if u is the last vertex of \(P_i\) or \(P_j\), then one path has to contain the other. Hence, u has two outneighbors \(w_i\) and \(w_j\) lying on \(P_i\) and \(P_j\), respectively, and \(w_i \ne w_j\). But due to (2), we have \(w_i, w_j \in {{\textsf {out}}}_{D}(s)\), implying \({{\textsf {indeg}}}_{D}(w_i) > 1\) and \({{\textsf {indeg}}}_{D}(w_j) > 1\), a contradiction to our assumptions on \(P_i\) and \(P_j\) (proving (3)).

Let \(v_1, v_2, \dots , v_m\) be the sequence of vertices of a path \(P_i\). From (1) we know that there is some \(w \in {{\textsf {out}}}_{D}(v_{m-1})\) outside of \(P_i\). We also have \(w \in {{\textsf {out}}}_{D}(v_j)\) for all \(1 \le j \le m-1\), implying \({{\textsf {indeg}}}_{D}(w) \ge m-1\). If \(m-1 > k+1\), then \(\ell (w) = \textsc {M}\), as Set Label (RR 3.2) is not applicable. However, as \({{\textsf {indeg}}}_{D}(v_{m-1}) = 1 = {{\textsf {indeg}}}_{D}(v_{m-2})\), \(w \in {{\textsf {out}}}_{D}(v_{m-2})\) and Labeled Neighbor (RR 3.6) is not applicable, we have \(\ell (v_{m-1}) = \textsc {F}\), a contradiction to the assumption that H is unlabeled. Hence, \(m - 1 \le k+1\), implying (proving (4)). \(\square \)

Lemma 3.5

Let H be an unlabeled local funnel in D. Then .

Proof

Let s be the source of H. Consider a partitioning of the vertices of H into an out-tree (since H has only one source) and an in-forest where the out-tree is maximal. Let \(P_1, P_2, \dots , P_a\) be a sequence of paths such that the out-tree is the union of all \(P_i\). From lemma 3.4 we know that \(a \le k + 1\) and that \(V(P_i) \cap V(P_j) = \{s\}\) for all \(i \ne j\). Let \(v_i\) be the endpoint of \(P_i\) which is not s and let \(X = \bigcup _{i=1}^a{{\textsf {out}}}_{}(v_i)\). As Set Label (RR 3.2) is not applicable, we have . Further, as , the out-tree of H has at most \((k+1)^2\) vertices.

Let Y be the set of sinks of H lying on its in-forest. Since H has only one source s, for every sink \(t \in Y\) there is a path Q from s to t. Let \(Q_1, Q_2, \dots , Q_b\) be the set of all paths from s to each sink in Y, and let \(R_i\) be the subpath of \(Q_i\) contained in the in-forest of H.

Let \(Q_i\) be one of such paths, and let u be the first vertex of \(R_i\) (which is not in any \(P_j\)). Note that this implies \({{\textsf {indeg}}}_{}(u) > 1\), otherwise the out-tree would not be maximal. Due to lemma 3.4 we have that no other \(R_\ell \) contains u and if \(u \not \in X\), then \(u \in {{\textsf {out}}}_{}(s)\). Since Set Label (RR 3.2) is not applicable and each distinct \(R_\ell \) implies the existence of a distinct outneighbor of s, there are at most k paths \(R_\ell \) not ending in a vertex in X. By definition, all inneighbors of any vertex of X lie in some \(P_i\). This implies that there are at most k paths \(Q_\ell \) not containing any vertex of X.

If \(Q_i\) contains a vertex of X, then \(R_i\) ends on a vertex \(u \in X\). Due to lemma 3.4, no other \(R_\ell \) contains u. As , we have that there are at most \(k^2 + k\) paths \(R_\ell \) which contain some vertex of X. Adding both cases, we obtain that there are at most \(k^2 + 2k\) paths \(Q_\ell \).

Due to lemma 3.4, the subpath \(R_i\) of \(Q_i\) has at most \(k+1\) vertices. Since the in-forest of H is the union over all \(R_i\), we have that this in-forest has at most \((k+1)(k^2 + k) = k^3 + 2k^2 + k\) vertices. Thus, , concluding the proof. \(\square \)

We conclude by bounding the number of maximal vertex-disjoint unlabeled local funnels in D. Since we can always partition unlabeled vertices with in- or outdegree at most one into local funnels, by bounding the number of local funnels in such a partitioning, together with the bound on the size of each local funnel, we obtain a bound for the number of unlabeled vertices with in- or outdegree at most one.

Let \(\mathcal {H} = \{H_1, H_2, \dots , H_{a}\}\) be a set of maximal vertex-disjoint unlabeled local funnels in D (in this context, maximal means that \(H_i \cup H_j\) is not a local funnel for any two distinct \(H_i,H_j \in \mathcal {H}\)). Let \(s_i\) be the unique source of \(H_i\) for each i. We now show that, if there is a solution removing at most k arcs, then  is “small”. By contraposition this means that, if  is “large”, then we have a “no”-instance and can stop the kernelization process.

We start with the simple observation that cycles intersecting inside a local funnel must also intersect outside it.

Observation 3.6

Let \(C_i\) and \(C_j\) be two distinct cycles in D such that \(V(C_i) \cap V(C_j) \subseteq H_\ell \) for some \(H_\ell \in \mathcal {H}\). Then \(V(C_i) \cap V(C_j) = \emptyset \).

Proof

Assume towards a contradiction that \(V(C_i) \cap V(C_j) \ne \emptyset \). Let \(v \in V(C_i) \cap V(C_j)\) such that the predecessor of v in \(C_i\) is different from the predecessor of v in \(C_j\). Then \({{\textsf {indeg}}}_{}(v) > 1\). As \(H_\ell \) is a local funnel, v can only reach one sink t of \(H_\ell \), implying that t is in both \(C_i\) and \(C_j\). The unique out-neighbor of t is however not in \(H_\ell \), but it has to be in both \(C_i\) and \(C_j\), a contradiction to the assumption that \(V(C_i) \cap V(C_j) \subseteq V(H_\ell )\). \(\square \)

We partition the set of maximal unlabeled local funnels \(\mathcal {H}\) into three sets (1) \(\mathcal {F} = \{H_i \in \mathcal {H} \mid \text {there is some } v \in V(H_i) \text { with }{{\textsf {outdeg}}}_{D}(v) > 1\}\); (2) \(\mathcal {M} = \{H_i \in \mathcal {H} \mid {{\textsf {indeg}}}_{D}(s_i) > 1\}\); and (3) \(\mathcal {X} = \{H_i \in \mathcal {H} \mid {{\textsf {indeg}}}_{D}(s_i) = 1 \text { and } \forall v \in V(H_i) : {{\textsf {outdeg}}}_{D}(v) = 1\}\).

Lemma 3.7

If there is a solution \((S, \hat{\ell })\) for \((D, \ell , k)\), then .

Proof

Let \(H_i \in \mathcal {X}\) and u be the unique inneighbor of \(s_i\). Note that \({{\textsf {outdeg}}}_{D}(s_i) = 1\). As Dissolve Vertex (RR 3.3) is not applicable, we have that \({{\textsf {outdeg}}}_{D}(u) > 1\) and \({{\textsf {indeg}}}_{D}(w) > 1\), where w is the unique outneighbor of \(s_i\).

Case 1: \(u \in {\text {Dom}}(\ell )\). Then \(\ell (u) = \textsc {M}\) since Set Label (RR 3.2) is not applicable. As \({{\textsf {outdeg}}}_{}(u) > 1\), each \(H_j \in \mathcal {X}\) with \(s_j \in {{\textsf {out}}}_{D}(u)\) requires one more arc of u to be in \(S\).

Case 2: \(u \not \in {\text {Dom}}(\ell )\). If \({{\textsf {indeg}}}_{D}(u) = 1\), then there is some \(v_i \in V(H_i)\) such that \((v_i,u) \in A(D)\), otherwise \(H_i\) would not be maximal. Hence, there is a cycle \(C_i\) containing \(u,s_i\) and \(v_i\). If there is any other \(H_j \in \mathcal {X}\) with \(s_j \in {{\textsf {out}}}_{D}(u)\) and with some \(v_j \in V(H_j)\) such that \((v_j, u) \in A(D)\), then the cycle \(C_j\) containing \(u,s_j\) and \(v_j\) is arc-disjoint to the cycle \(C_i\) due to Observation 3.6. Thus, \(S\) must contain at least one arc of each such \(C_j\), implying there are at most k local funnels \(H_j\) that fall into this case.

If \({{\textsf {indeg}}}_{D}(u) > 1\), one arc of u is in \(S\) as \({{\textsf {outdeg}}}_{D}(u) > 1\). Further, \({{\textsf {outdeg}}}_{D}(u) \le k\). This means that there are at most k local funnels \(H_j \in \mathcal {X}\) with \(s_j \in {{\textsf {out}}}_{D}(u)\). As there can be at most 2k such vertices u, we have that there are at most \(2k^2\) local funnels \(H_j \in \mathcal {X}\) which fall into this case.

In the worst case, we have . \(\square \)

Lemma 3.8

If there is a solution \((S, \hat{\ell })\) for \((D, \ell , k)\), then .

Proof

Let \(H_i \in \mathcal {F}\) and let u be the unique inneighbor of \(s_i\) in D. Assume u is in some local funnel \(H_j \in \mathcal {H}\) and let \(D_i = D[V(H_i) \cup V(H_j)]\).

Case 1: \(D_i\) is a DAG. Then there are \(w_j \in V(H_j)\) and \(w_i \in V(H_i)\) such that \({{\textsf {indeg}}}_{D}(w_j) > 1\), \({{\textsf {outdeg}}}_{D}(w_i) > 1\) and there is a path P from \(w_j\) to \(w_i\). If this were not the case, \(H_i\) and \(H_j\) would not be maximal, as \(D_i\) would be an unlabeled local funel containing \(H_i\) and \(H_j\). Let \(G_i \subseteq D\) be a subgraph containing P, two incoming neighbors of \(w_j\) and two outgoing neighbors of \(w_i\). Clearly, \(S\) contains some arc of \(G_i\). Since \(H_j\) and \(H_i\) are local funnels, \(w_j\) can only reach one sink of \(H_j\), namely u, and \(w_i\) can be reached by only one source of \(H_i\), namely \(s_i\). This means in particular that P is the only path from \(w_j\) to \(w_i\). Hence, if there is any other \(H_\ell \in \mathcal {F}\) that falls into this case, then the corresponding \(G_\ell \) constructed is arc-disjoint to \(G_i\). As there can be at most k arc-disjoint forbidden subgraphs for funnels in D, there are at most k local funnels in \(\mathcal {F}\) that fall into this case.

Case 2: \(D_i\) is not a DAG. Then there is some cycle \(C_i\) containing some \(w_i \in V(H_i)\) and some \(w_j \in V(H_j)\). Clearly, \(S\) contains some arc of \(C_i\). Assume there is some other \(H_\ell \in \mathcal {F}\) such that \({{\textsf {in}}}_{D}(s_\ell ) \cap V(H_j) \ne \emptyset \) and \(D_\ell = D[V(H_j) \cup V(H_\ell )]\) is not a DAG. Let \(C_\ell \) be a cycle in \(D_\ell \). From Observation 3.6 we know \(C_i\) and \(C_\ell \) are arc disjoint. As we need one arc in \(S\) for each such cycle, we get that there are at most k local funnels falling into this case.

Now assume u is not in any local funnel in \(\mathcal {H}\). We have two cases.

Case : \(u \in {\text {Dom}}(\ell )\). Then \(\ell (u) = \textsc {M}\), as Set Label (RR 3.2) is not applicable to \(s_i\). Since there is some \(v_i \in V(H_i)\) with \({{\textsf {outdeg}}}_{}(v_i) > 1\) and \(s_i\) can reach \(v_i\), we have that u can also reach \(v_i\) and so \((u,s_i) \in S\) or some arc of \(H_i\) is in \(S\). Hence, there are at most k local funnels \(H_j \in \mathcal {F}\) with \(s_j \in {{\textsf {out}}}_{}(u)\).

Case 2: \(u \not \in {\text {Dom}}(\ell )\). As u is not in a local funnel, we have \({{\textsf {indeg}}}_{}(u) > 1\) and \({{\textsf {outdeg}}}_{}(u) > 1\). Since Set Label (RR 3.2) is not applicable, \({{\textsf {outdeg}}}_{}(u) \le k\). Hence, there can be at most k local funnels \(H_j \in \mathcal {F}\) with \(u \in {{\textsf {in}}}_{}(s_j)\). Because Lower Bound (RR 3.1) is not applicable, we know there are at most 2k vertices \(u'\) with \({{\textsf {indeg}}}_{}(u') > 1\) and \({{\textsf {outdeg}}}_{}(u') > 1\). Thus, there can be at most \(2k^2\) local funnels \(H_j \in \mathcal {F}\) that fall into this case.

By adding the bounds obtained in each case, we get \(\mathcal {F} \le k + k + k + 2k^2 \in \mathcal {O}(k^2)\). \(\square \)

Lemma 3.9

If there is a solution \((S, \hat{\ell })\) for \((D, \ell , k)\), then .

Proof

Let \(H_i \in \mathcal {M}\).

Case 1: \(\forall u \in {{\textsf {in}}}_{}(s_i) : u \in {\text {Dom}}(\ell )\). As Set Label (RR 3.2) is not applicable, there is some \(u \in {{\textsf {in}}}_{}(s_i)\) with \(\ell (u) = \textsc {M}\) and \({{\textsf {outdeg}}}_{}(u) > 1\). Hence, \(S\) contains some outgoing arc of u. Any additional \(H_j \in \mathcal {M}\) that falls into this case increases the outdegree of some \(u'\) with \(\ell (u') = \textsc {M}\) and \({{\textsf {outdeg}}}_{}(u') > 1\). Thus, if there are more than k local funnels \(H_j \in \mathcal {M}\) that fall into this case, then .

Case 2: There is some \(u \in {{\textsf {in}}}_{}(s_i)\) and some \(H_j \in \mathcal {H}\) such that \(u \in V(H_j)\). As \({{\textsf {indeg}}}_{}(s_i) > 1\) and \(H_i\) is maximal, we have that \(D_i = D[V(H_j) \cup V(H_i)]\) is not a DAG. Let \(C_i\) be the cycle in \(D_i\). If there is some other \(H_\ell \in \mathcal {M}\) that falls into this case, we know from Observation 3.6 that the corresponding cycle \(C_\ell \) and \(C_i\) are arc disjoint. As \(S\) must contain one arc of each \(C_\ell \), if there are more than k local funnels \(H_\ell \) falling into this case, then .

Case 3: There is some \(u \in {{\textsf {in}}}_{}(s_i)\) such that u is not in any local funnel and \(u \not \in {\text {Dom}}\ell \). Then \({{\textsf {indeg}}}_{}(u) > 1\) and \({{\textsf {outdeg}}}_{}(u) > 1\). As Lower Bound (RR 3.1) is not applicable, there can be at most 2k such vertices u in D. Further, \({{\textsf {outdeg}}}_{}(u) \le k\) as Set Label (RR 3.2) is not applicable. Hence, there can be at most \(2k^2\) local funnels \(H_j \in \mathcal {M}\) that fall into this case.

By adding all cases together we obtain , as desired. \(\square \)

From lemmas 3.7 to 3.9, we easily obtain a bound for the number of vertices in unlabeled local funnels. Together with the fact that Lower Bound (RR 3.1) is not applicable, we obtain a bound for the number of unlabeled vertices in D.

Lemma 3.10

Let D be a reduced digraph. Then there are \(\mathcal {O}(k^5)\) vertices \(v \in V(D)\) with \(v \not \in {\text {Dom}}(\ell )\) and \({{\textsf {indeg}}}_{}(v) = 1 \vee {{\textsf {outdeg}}}_{}(v) = 1\).

Proof

Let \(\mathcal {H}\) be a maximal set of maximal vertex-disjoint local funnels in D. Clearly, every vertex \(v \in V(D)\) with \(v \not \in {\text {Dom}}(\ell )\) and \({{\textsf {indeg}}}_{}(v) = 1 \vee {{\textsf {outdeg}}}_{}(v) = 1\) is in some local funnel. From lemmas 3.7 to 3.9 we know that . Due to lemma 3.5, each local funnel has at most \(k^3 + 3k^2 + 2k \in \mathcal {O}(k^3)\) vertices. Hence, there are at most \((5k^2 + 5k)(k^3 + 3k^2 + 2k) \in \mathcal {O}(k^5)\) vertices v lying in some unlabeled local funnel. \(\square \)

3.2 Bounding the Number of Labeled Vertices

In Sect. 3.1 we exploited the property that unlabeled vertices have bounded degree, and that we can label them if their neighborhood has some special structure captured by the reduction rules. For the labeled vertices, however, we can apply neither of those strategies. Instead, we first exploit the fact that we know the label of a vertex and use this to decide if an arc is never in an optimal solution or if it is always in an optimal solution.

Arcs from M to F vertices clearly need to be removed. We show that we can also ignore arcs from F to M vertices, that is, we can remove them without changing k.

Reduction Rule 3.7

(Remove Arcs) Let \((v,u) \in A(D)\). If \(\ell _{}(v) = \textsc {F}\) and \(\ell _{}(u) = \textsc {M}\), remove (vu). If \(\ell (v) = \textsc {M}\) and \(\ell (u) = \textsc {F}\), remove (vu) and decrease k by 1.

Proof of safety of Remove Arcs (RR 3.7)

Clearly, a solution for \((D,\ell , k)\) is also a solution for the reduced instance \((D', \ell _r, k')\). So let \((\hat{\ell }_r, S_r)\) be a solution for the reduced instance.

If \(\ell (v) = \textsc {M}\) and \(\ell (u) = \textsc {F}\), then (vu) is in any solution. Hence, \((\hat{\ell }_r, S_r\cup \{(v,u)\})\) is a solution for the input instance and .

If \(\ell (v) = \textsc {F}\) and \(\ell (u) = \textsc {M}\), then we claim \(\hat{\ell }_r\) is a funnel labeling for \(D - S_r\). If \(D - S_r\) is a DAG, then the claim trivially holds.

Now assume towards a contradiction that \(D - S_r\) is not a DAG. Then there is a cycle C using the arc (vu). This implies that there is a path P from u to v in \(D - S_r\). In particular, this path also exists in \(D' - S_r\) since it does not use the arc (vu). However, as \(\ell (u) = \textsc {M}\) and \(\ell (v) = \textsc {F}\), we know there is some arc \((v', u')\) in P with \(\hat{\ell }_r(v') = \textsc {M}\) and \(\hat{\ell }_r(u') = \textsc {F}\). But then \(\hat{\ell }_r\) is not a funnel labeling for \(D' - S_r\), a contradiction. Hence, a solution for the reduced instance implies a solution for the input instance, proving the rule is safe. \(\square \)

We now identify certain vertices that can be removed safely. Clearly, sources and sinks cannot be in any cycle in D. By carefully considering the neighborhood of a source or sink v, we can also prove that v is not “relevant” for any forbidden subgraph for funnels in D.

Reduction Rule 3.8

(Sources and Sinks) Let \(v \in V(D)\) be a labeled vertex where \({{\textsf {out}}}_{}(v) \cup {{\textsf {in}}}_{}(v) \subseteq {\text {Dom}}(\ell )\). Remove v if one of the following holds.

  1. 1.

    \({{\textsf {indeg}}}_{}(v) = 0\) and no \(u \in {{\textsf {out}}}_{}(v)\) exists with \(\ell (u) = \textsc {F}\) and \({{\textsf {indeg}}}_{}(u) > 1\), or

  2. 2.

    \({{\textsf {outdeg}}}_{}(v) = 0\) and no \(u \in {{\textsf {in}}}_{}(v)\) exists with \(\ell (u) = \textsc {M}\) and \({{\textsf {outdeg}}}_{}(u) > 1\).

Proof of safety of Sources and Sinks (RR 3.8)

Let \((D', \ell _r, k)\) be the reduced instance. Clearly, if \((S, \hat{\ell })\) is a solution for \((D, \ell , k)\), then, after restricting \((S, \hat{\ell })\) to the vertices in \(D'\), we also have a solution for \((D', \ell _r, k)\).

Now let \((S_r, \hat{\ell }_r)\) be a solution for the reduced instance. We consider the case where \({{\textsf {indeg}}}_{D}(v) = 0\) and there is no \(u \in {{\textsf {out}}}_{}(v)\) such that \(\ell (u) = \textsc {F}\) and \({{\textsf {indeg}}}_{}(u) > 1\). The other case follows analogously. We claim that the labeling \(\hat{\ell }\supseteq \hat{\ell }_r\) with \(\hat{\ell }(v) = \ell (v)\) is a funnel labeling for \(D - S_r\). Since \({{\textsf {indeg}}}_{D - S_r}(v) = 0\), there can be no cycle containing v. There can be no vertex \(u \in V(D)\) with \(\hat{\ell }_r(u) = \textsc {M}\) and \({{\textsf {outdeg}}}_{D - S_r}(u) > 1\) as this would imply \({{\textsf {outdeg}}}_{D' - S_r}(u) > 1\) because \({{\textsf {indeg}}}_{D - S_r}(v) = 0\), a contradiction. There can also be no vertex \(u \in V(D)\) with \(\hat{\ell }_r(u) = \textsc {F}\) and \({{\textsf {indeg}}}_{D - S_r}(u) > 1\) as all \(u \in {{\textsf {out}}}_{D - S_r}(v)\) with \(\ell (u) = \textsc {F}\) have \({{\textsf {indeg}}}_{D - S_r}(u) = 1\), and \({{\textsf {out}}}_{D}(v) \subseteq {\text {Dom}}(\ell )\).

Because Remove Arcs (RR 3.7) is not applicable, if \(\ell (v) = \textsc {M}\), there is no \(u \in {{\textsf {out}}}_{D - S_r}(v)\) with \(\ell (u) = \textsc {F}\). Hence, there is no arc \((w,x) \in A(D - S_r)\) with \(\hat{\ell }_r(w) = \textsc {M}\) and \(\hat{\ell }_r(x) = \textsc {F}\). From the labeling characterization from theorem 2.1 we have that \((S_r, \hat{\ell }_r)\) is solution for \((D, \ell , k)\) and the reduction rule is safe. \(\square \)

Having exhaustively applied Reduction Rules 3.7 and 3.8, we can bound the number of labeled vertices in D. Since Lower Bound (RR 3.1) is not applicable, we already have a bound for the number of vertices v with \(\ell (v) = \textsc {F} \wedge {{\textsf {indeg}}}_{}(v) > 1\) or \(\ell (v) = \textsc {M} \wedge {{\textsf {outdeg}}}_{}(v) > 1\). Hence, we only need to consider vertices in the set \(L = \{v \in {\text {Dom}}(\ell ) \mid \ell (v) = \textsc {F} \wedge {{\textsf {indeg}}}_{}(v) \le 1 \text { or } \ell (v) = \textsc {M} \wedge {{\textsf {outdeg}}}_{}(v) \le 1\}\).

To bound , we exploit the bound on the number of unlabeled vertices from lemma 3.10 and also the fact that such vertices have small degree as Set Label (RR 3.2) is not applicable. We first partition L into two subsets \(L_1 = \{v \in L \mid {{\textsf {in}}}_{}(v) \cup {{\textsf {out}}}_{}(v) \not \subseteq {\text {Dom}}(\ell )\}\) and \(L_2 = L {\setminus } L_1\).

Lemma 3.11

.

Proof

Let U be the set of unlabeled vertices. Clearly \(L_1 \subseteq {{\textsf {in}}}_{}(U) \cup {{\textsf {out}}}_{}(U)\). As Set Label (RR 3.2) is not applicable, we have \({{\textsf {indeg}}}_{}(v) \le k+1\) and \({{\textsf {outdeg}}}_{}(v) \le k+1\) for every \(v \in U\). From lemma 3.10 we know . Hence, . \(\square \)

Lemma 3.12

.

Proof

Let \(V_\textsc {F} = \{v \mid \ell (v) = \textsc {F}\}\) and \(L_\textsc {F} = V_\textsc {F} \cap L_2\). The case for the vertices labeled with M follows analogously.

Since Remove Arcs (RR 3.7) is not applicable, we have \(\ell (u) = \textsc {F}\) for all \(u \in {{\textsf {out}}}_{}(L_\textsc {F}) \cup {{\textsf {in}}}_{}(L_\textsc {F})\). Let \(R_1 = \{u \in V_\textsc {F} \mid {{\textsf {indeg}}}_{}(u) > 1\}\), \(R_2 = \{u \in L_\textsc {F} \mid {{\textsf {indeg}}}_{}(u) \le 1, {{\textsf {out}}}_{}(u) \cap R_1 \ne \emptyset \}\) and \(R_3 = \{u \in L_\textsc {F} \mid {{\textsf {indeg}}}_{}(u) \le 1, {{\textsf {out}}}_{}(u) \cap R_1 = \emptyset \}\). Note that \(L_2 = R_2 \cup R_3\) and \(R_1 \cap L_2 = \emptyset \).

A solution set \(S\subseteq A(D)\) must contain at least \({{\textsf {indeg}}}_{}(v) - 1\) incoming arcs of v for every \(v \in R_1\). As each \(u \in R_2\) has some \(v \in R_1\) as outneighbor, we have .

Let \(v \in R_3\). We claim that v can reach some vertex of \(R_2\). Since Sources and Sinks (RR 3.8) is not applicable and \({{\textsf {out}}}_{}(v) \cap R_1 = \emptyset \), we have \({{\textsf {indeg}}}_{}(v) = 1\) and \({{\textsf {outdeg}}}_{}(v) \ge 1\). This means that, if we successively follow the outneighbors of v, we reach a vertex of \(R_2\) or find a cycle C using only vertices of \(R_3\). However, as Break Cycle (RR 3.5) is not applicable, such a cycle C cannot exist: every vertex \(v \in R_3\) has \({{\textsf {indeg}}}_{}(v) = 1\) and \(\ell (v) = \textsc {F}\), implying we could apply Break Cycle (RR 3.5) to C. Hence, every vertex of \(R_3\) can reach some \(u \in R_2\).

We greedily construct vertex-disjoint paths \(P_1, P_2, \dots , P_{a}\) ending in \(R_2\) whose inner vertices lie in \(R_3\). For a vertex \(v \in R_3\) take an arbitrary \(u \in R_2\) such that v can reach u. Consider a path P from v to u. If none of its vertices lie in any already constructed \(P_i\), we just take the path P into our set of paths. Otherwise, assume that P intersects some \(P_i\) at w and let w be the first such vertex in P. Since the indegree of any vertex in \(R_3 \cup R_2\) is at most one, we know that w is the starting point of \(P_i\). Hence, we can obtain a path \(P_j\) by taking the path from v to w in P and then concatenating \(P_i\). As w is the first vertex of P intersecting any other path, we get that \(P_j\) only intersects \(P_i\). By replacing \(P_i\) with \(P_j\), we obtain a path that also contains v. We repeat this process until we covered all \(v \in R_3\).

Since , we have \(a \le 2k\). We now prove that for any \(P_i\) in our set of vertex-disjoint paths. Note that \({{\textsf {indeg}}}_{}(u) \le 1\) for any vertex \(u \in V(P_i)\).

Since Dissolve Vertex (RR 3.3) is not applicable, any inner vertex u of \(P_i\) has \({{\textsf {outdeg}}}_{}(u) > 1\). Let w be the successor of u in \(P_i\). As Shift Neighbors (RR 3.4) is not applicable, we have that \({{\textsf {indeg}}}_{}(w) > 1\) or \(v \in {{\textsf {out}}}_{}(u)\) where v is the unique inneighbor of u. If \({{\textsf {indeg}}}_{}(w) > 1\), then \(u \in R_2\) and is the endpoint of \(P_i\), a contradiction to the assumption that u is an inner vertex of \(P_i\). Otherwise, we know that \(u \not \in {{\textsf {out}}}_{}(w)\) as \({{\textsf {indeg}}}_{}(u) = 1\). If u is the only inner vertex of \(P_i\), then . Otherwise, its successor w in \(P_i\) is an inner vertex of \(P_i\) (since v is the starting point of \(P_i\), and so \(v \not \in {{\textsf {out}}}_{}(u)\)). Hence, we can apply the same argumentation to w and conclude that it has some outneighbor x with \({{\textsf {indeg}}}_{}(x) > 1\), implying \(x \in R_2\) and .

Since and \(a \le 2k\), we have that . Because \(L_2 = R_2 \cup R_3\), we have that , as desired. \(\square \)

Lemma 3.13

Let \((D, \ell , k)\) be an FADL instance where Reduction Rules 3.1 to 3.8 are not applicable. Then and .

Proof

As Lower Bound (RR 3.1) is not applicable, there are at most 2k vertices v with \({{\textsf {indeg}}}_{}(v) > 1\) and \({{\textsf {outdeg}}}_{}(v) > 1\), and also at most 2k vertices v with \(\ell (v) = \textsc {F} \wedge {{\textsf {indeg}}}_{}(v) > 1\) or \(\ell (v) = \textsc {M} \wedge {{\textsf {outdeg}}}_{}(v) > 1\). From lemma 3.10 we know there are \(\mathcal {O}(k^5)\) unlabeled vertices \(v \in V(D)\) with \({{\textsf {indeg}}}_{}(v) \le 1\) or \({{\textsf {outdeg}}}_{}(v) \le 1\). Finally, due to lemmas 3.11 and 3.12 there are \(\mathcal {O}(k^6)\) vertices v with \(\ell (v) = \textsc {F} \wedge {{\textsf {indeg}}}_{}(v) \le 1\) or \(\ell (v) = \textsc {M} \wedge {{\textsf {outdeg}}}_{}(v) \le 1\). As any vertex in D falls into one of these groups, we have .

As Remove Arcs (RR 3.7) is not applicable, there is no arc (vu) where \(v,u \in {\text {Dom}}(\ell )\) and \(\ell (v) \ne \ell (u)\). Since there are \(\mathcal {O}(k^5)\) unlabeled vertices and every unlabeled vertex has in- and outdegree at most \(k+1\), there are \(\mathcal {O}(k^6)\) arcs (vu) where \(v \not \in {\text {Dom}}(\ell )\) or \(u \not \in {\text {Dom}}(\ell )\).

Now let (vu) be some arc where \(v,u \in {\text {Dom}}(\ell )\). Note that \(\ell (v) = \ell (u)\).

Case 1: \(v,u \in L\). Then \({{\textsf {outdeg}}}_{}(v) = 1\) (if \(\ell (v) = \textsc {M}\)) or \({{\textsf {indeg}}}_{}(u) = 1\) (if \(\ell (u) = \textsc {F}\)). Thus, there can be at most arcs (vu) where \(v,u \in L\).

Case 2: \(v,u \not \in L\). As Lower Bound (RR 3.1) is not applicable, there can be at most 2k such vertices. Thus, there are at most \(4k^2\) arcs between labeled vertices not in L.

Case 3: Exactly one of vu is in L.

Case 3.1: \(v \not \in L \wedge \ell (v) = \textsc {F}\) or \(u \not \in L \wedge \ell (u) = \textsc {M}\). Then \({{\textsf {indeg}}}_{}(u) = 1\) or \({{\textsf {outdeg}}}_{}(v) = 1\). Hence, there can be at most such arcs.

Case 3.2: \(v \not \in L \wedge \ell (v) = \textsc {M}\) or \(u \not \in L \wedge \ell (u) = \textsc {F}\). If \(v \not \in L\), then at least half of its outgoing arcs need to be in a solution set. Similarly, if \(u \not \in L\), at least half of its incoming arcs need to be in a solution set. Hence, there can be at most 2k arcs falling into this case. By adding all cases together, we obtain that , concluding the proof. \(\square \)

4 Computing the Kernel

In Sects.  3.1 and 3.2 we defined the reduction rules for the kernelization process and showed that, if none of the reduction rules are applicable to a digraph D, then the size of D is polynomially bounded on k. To conclude the proof that FADS admits a polynomial problem kernel, we show that it is possible to apply all reduction rules in \(\mathcal {O}(nm)\) time and also reduce the FADL instance back into an FADS instance.

Lemma 4.1

We can exhaustively apply Reduction Rules 3.1 to 3.8 in \(\mathcal {O}(nm)\) time to an FADL instance \((D, \ell , k)\), where and .

Proof

We apply the reduction rules exhaustively in the order they are defined. In order to do so efficiently, we use a constant number of counters for each vertex v in order to check if a reduction rule is applicable to v.

To apply Lower Bound (RR 3.1), Set Label (RR 3.2) and Dissolve Vertex (RR 3.3) we only need to check the labels and degrees of a vertex and its neighbors. Whenever the label of a vertex changes, we need to recheck if we can apply the reduction rules to its neighbors. It is therefore sufficient to store the degree of v and the number of its neighbors which have the a certain type (for example, the number of \(u \in {{\textsf {out}}}_{}(v)\) with \(\ell (u) = \textsc {F}\) and \({{\textsf {indeg}}}_{}(u) = 1\)). Whenever the label of a vertex changes, we only need to increment the counters its neighbors. As we set the label of a vertex at most once, we need to visit each arc constantly many times.

For Shift Neighbors (RR 3.4), we consider the first case of the rule where the indegrees are one (the other case is applied analogously). We search for a vertex w with \({{\textsf {indeg}}}_{}(w) = 1\). We then take the unique inneighbor \(v \in {{\textsf {in}}}_{}(w)\), tracking in a counter the number of \(w \in {{\textsf {out}}}_{}(v)\) with \({{\textsf {indeg}}}_{}(w) = 1\). If \({{\textsf {indeg}}}_{}(v) = 1\), we construct a path P ending in v by following its unique inneighbor until we obtain a vertex y with \({{\textsf {indeg}}}_{}(y) > 1\) or \(\ell (y) = \textsc {M}\), which we do not include in P. We denote the starting point of P by u.

If \(u = w\), we can apply Break Cycle (RR 3.5) by deleting the arc (vw) and labeling every vertex in P with \(\textsc {F}\) (if they are not already labeled). Now assume P is indeed a path. For each \(x \in {{\textsf {out}}}_{}(P)\) we count the number and then shift all arcs (vx) with \(v \in V(P)\) by arcs coming from the first c vertices in P. The cost of applying this operation is linear on the number of arcs leaving P. If a vertex v is in another such path Q, then after applying Shift Neighbors (RR 3.4) once to v we shift Q in such a way that only the startpoint u is in more than one path to which the rule is applicable.

We only need to recheck if Shift Neighbors (RR 3.4) is applicable to v when an arc is removed from it by Remove Arcs (RR 3.7) or by Break Cycle (RR 3.5) (arcs removed from Sources and Sinks (RR 3.8) never trigger Shift Neighbors (RR 3.4) due to the degrees of the affected vertices). In this case, we apply depth-first search on v, following its outgoing arcs, in order to find all paths to which Shift Neighbors (RR 3.4) is applicable. As observed above, the computational cost of shifting the arcs of a path P is linear in the number of arcs leaving P. Since no reduction rule adds arcs to D, we only need to recheck if Shift Neighbors (RR 3.4) is applicable to v once. Hence, each arc gets shifted \(\mathcal {O}(n)\) times, and this rule can be exhaustively applied in \(\mathcal {O}(nm)\) time.

Remove Arcs (RR 3.7) is applied whenever we set the label of a vertex v. In order to apply it, it suffices to iterate through \({{\textsf {in}}}_{}(v)\) or \({{\textsf {out}}}_{}(v)\) and check the labels of those vertices. Since we set the label of a vertex at most once, we need \(\mathcal {O}(n + m)\) time in total for this rule. Finally, we apply Sources and Sinks (RR 3.8) by applying breadth-first search on the sources and sinks of D. Note that, although Sources and Sinks (RR 3.8) remove vertices (and arcs) from D, it cannot cause Break Cycle (RR 3.5), Shift Neighbors (RR 3.4) or other reduction rules to become applicable if they were not applicable before. Hence, by applying Sources and Sinks (RR 3.8) only after no other rule is applicable, we can exhaustively apply this rule in \(\mathcal {O}(n + m)\) time, giving us a total running time of \(\mathcal {O}(nm)\) for the kernelization process, concluding the proof. \(\square \)

Theorem 4.2

FADS admits a kernel with \(\mathcal {O}(k^6)\) vertices and \(\mathcal {O}(k^7)\) arcs which can be computed in \(\mathcal {O}(nm)\) time, where , and D is the input digraph.

Proof

We start by reducing the FADS instance into an FADL instance \((D, \ell , k)\) by adding an empty labeling \(\ell \). Using lemma 4.1, we can exhaustively apply all reduction rules to \((D, \ell , k)\) in \(\mathcal {O}(nm)\) time.

From lemma 3.13 we know and . We now reduce the FADL instance back into an FADS instance \((D', k)\) in order to obtain a kernel for the original problem. We first set \(D' {:}{=}D\) and add \(k+2\) vertices \(f_1, f_2, \dots , f_{k+2}\) and \(k+2\) vertices \(m_1, m_2, \dots , m_{k+2}\) to \(D'\). Let \(v \in {\text {Dom}}(\ell )\). If \(\ell (v) = \textsc {F}\), we add the arc \((v, f_i)\) for each \(1 \le i \le k+2\). If \(\ell (v) = \textsc {M}\), we add the arc \((m_i, v)\) for each \(1 \le i \le k+2\).

Trivially, a solution for the FADL instance is also a solution for the FADS instance. It is also easy to see that, if there is some arc set \(S_r\subseteq A(D')\) and some funnel labeling \(\hat{\ell }_r\) for \(D' - S_r\) such that \(\ell (v) \ne \hat{\ell }_r(v)\) for some \(v \in {\text {Dom}}(\ell )\), then . Hence, a solution for \((D', k)\) implies a solution for \((D, \ell , k)\).

We added \(2k+4\) vertices and \(\mathcal {O}(k^7)\) arcs to \(D'\), and so and , thus concluding the proof. \(\square \)

5 Conclusion

The kernelization algorithm provided in this paper heavily relies on the characterizations of theorem 2.1 for funnels. Both the characterization by forbidden subgraphs as well as the labeling characterization allowed us to derive reduction rules based only on “local” substructures as the degree or neighborhood of a vertex. In a sense, this “locality” property saved us from computing any set of vertex-disjoint local funnels, despite the fact that the results and reduction rules from Sect. 3.1 heavily rely on local funnels.

The polynomial kernels for Out-Forest-VDS and Pumpkin-VDS due to [7] also rely on “localized” forbidden substructures. We consider that generalizing these results to larger digraph classes of unbounded treewidth, but which are characterized by forbidden substructures, to be a very interesting direction for future research.

Further, it would also be interesting to decide if Funnel-VDS admits a polynomial kernel or not (it is in FPT with respect to the solution size [9]), especially since a kernel for this problem would require considerably different ideas from the ones presented in this paper, as it is no longer clear how to exploit the vertex labeling in the vertex-deletion setting.