$k$-Distinct In- and Out-Branchings in Digraphs

An out-branching and an in-branching of a digraph $D$ are called $k$-distinct if each of them has $k$ arcs absent in the other. Bang-Jensen, Saurabh and Simonsen (2016) proved that the problem of deciding whether a strongly connected digraph $D$ has $k$-distinct out-branching and in-branching is fixed-parameter tractable (FPT) when parameterized by $k$. They asked whether the problem remain FPT when extended to arbitrary digraphs. Bang-Jensen and Yeo (2008) asked whether the same problem is FPT when the out-branching and in-branching have the same root. By linking the two problems with the problem of whether a digraph has an out-branching with at least $k$ leaves (a leaf is a vertex of out-degree zero), we first solve the problem of Bang-Jensen and Yeo (2008). We then develop a new digraph decomposition called the rooted cut decomposition and using it we prove that the problem of Bang-Jensen et al. (2016) is FPT for all digraphs. We believe that the \emph{rooted cut decomposition} will be useful for obtaining other results on digraphs.


Introduction
While both undirected and directed graphs are important in many applications, there are significantly more algorithmic and structural results for undirected graphs than for directed ones.The main reason is likely to be the fact that most problems on digraphs are harder than those on undirected graphs.The situation has begun to change: recently there appeared a number of important structural results on digraphs, see e.g.[17,18,19].However, the progress was less pronounced with algorithmic results on digraphs, in particular, in the area of parameterized algorithms.
In this paper, we introduce a new decomposition for digraphs and show its usefulness by solving an open parameterized problem on digraphs by Bang-Jensen, Saurabh and Simonsen [6].We believe that our decomposition will prove to be helpful for obtaining further algorithmic and structural results on digraphs.
A digraph T is an out-tree (an in-tree) if T is an oriented tree with just one vertex s of in-degree zero (out-degree zero).The vertex s is the root of T. A vertex v of an out-tree (in-tree) is called a leaf if it has out-degree (in-degree) zero.If an out-tree (in-tree) T is a spanning subgraph of a digraph D, then T is an out-branching (an in-branching) of D. It is well-known that a digraph D contains an out-branching (in-branching) if and only if D has only one strongly connected component with no incoming (no outgoing) arc [3].
A well-known result in digraph algorithms, due to Edmonds, states that given a digraph D and a positive integer , we can decide whether D has arc-disjoint out-branchings in polynomial time [16].The same result holds for arc-disjoint in-branchings.Inspired by this fact, it is natural to ask for a "mixture" of out-and in-branchings: given a digraph D and a pair u, v of (not necessarily distinct) vertices, decide whether D has an arc-disjoint outbranching T + u rooted at u and an in-branching T − v rooted at v. We will call this problem Arc-Disjoint Branchings.
Thomassen proved (see [2]) that the problem is NP-complete and remains NP-complete if we add the condition that u = v.The same result still holds for digraphs in which the out-degree and in-degree of every vertex equals two [7].The problem is polynomial-time solvable for tournaments [2] and for acyclic digraphs [8,10].The single-root special case (i.e., when u = v) of the problem is polynomial time solvable for quasi-transitive digraphs1 [4] and for locally semicomplete digraphs2 [5].
An out-branching T + and an in-branching T − are called k-distinct if |A(T + )\ A(T − )| k.Bang-Jensen, Saurabh and Simonsen [6] considered the following parameterization of Arc-Disjoint Branchings.

Input:
A digraph D, an integer k.

Question:
Are there k-distinct out-branching T + and in-branching T − ?k-Distinct Branchings parameterized by k They proved that k-Distinct Branchings is fixed-parameter tractable (FPT) 3when D is strongly connected and conjectured that the same holds when D is an arbitrary digraph.Earlier, Bang-Jensen and Yeo [9] considered the version of k-Distinct Branchings where T + and T − must have the same root 4 and asked whether this version of k-Distinct Branchings, which we call Single-Root k-Distinct Branchings, is FPT.
The problem abstracts a quite natural situation in wireless networks: such networks are best modeled as directed because of the inherent asymmetry in sending data (a task consuming a lot of energy) and receiving data (a task that consumes very little energy).Rooted in-branchings in this network correspond to routing strategies for aggregation and rooted out-branchings for dissemination of data [21].In this scenario, the problem of finding an in-and out-branchings with few common arcs solves a natural congestion-type problem.
The first key idea of this paper is to relate k-Distinct Branchings to the problem of deciding whether a digraph has an out-branching with at least k leaves via a simple lemma (see Lemma 1).The lemma and the following two known results on out-branchings with at least k leaves allow us to solve the problem of Bang-Jensen and Yeo [9] and to provide a shorter proof for the abovementioned result of Bang-Jensen, Saurabh and Simonsen [6] (see Theorem 3).Theorem 1. [1] Let D be a strongly connected digraph.If D has no outbranching with at least k leaves, then the (undirected) pathwidth of D is bounded by O(k log k).
Theorem 2. [13,20] We can decide whether a digraph D has an out-branching with at least k leaves in time O * (4 k ).
The general case of k-Distinct Branchings seems to be much more complicated.We first introduce a version of k-Distinct Branchings called k-Rooted Distinct Branchings, where the roots s and t of T + and T − are fixed, and add arc ts to D (provided the arc is not in D) to make D strongly connected.This introduces a complication: we may end up in a situation where D has an out-branching with many leaves, and thereby potentially unbounded pathwidth, but the root of the out-branching is not s.To deal with this situation, our goal will be to reconfigure the out-branching into an out-branching rooted at s.In order to reason about this process, we develop a new digraph decomposition we call the rooted cut decomposition.The cut decomposition of a digraph D rooted at a given vertex r consists of a tree T rooted at r whose nodes are some vertices of D and subsets of vertices of D called diblocks associated with the nodes of T .
Out strategy is now as follows.If T is shallow (i.e., it has bounded height), then any out-branching with sufficiently many leaves can be turned into an out-branching rooted at s without losing too many of the leaves.On the other hand, if T contains a path from the root of T with sufficiently many nondegenerate diblocks (diblocks with at least three vertices), then we are able to show immediately that the instance is positive.
The remaining and most difficult issue is to deal with digraphs with decomposition trees that contain long paths of diblocks with only two vertices, called degenerate diblocks.In this case, we employ two reduction rules which lead to decomposition trees of bounded height.
The paper is organized as follows.In the next section, we provide some terminology and notation on digraphs used in this paper.In Section 3, we prove Theorem 3. Section 4 is devoted to proving that Rooted k-Distinct Branchings is FPT for all digraphs using cut decomposition and Theorems 1 and 2. We conclude the paper in Section 5, where some open parameterized problems on digraphs are mentioned.

Terminology and Notation
Let us recall some basic terminology of digraph theory, see [3].A digraph D is strongly connected (connected) if there is a directed (oriented) path from x to y for every ordered pair x, y of vertices of D. Equivalently, D is connected if the underlying graph of D is connected.A vertex v is a source (sink) is its in-degree (out-degree) is equal to zero.It is well-known that every acyclic digraph has a source and a sink [3].
In this paper, we exclusively work with digraphs, therefore we assume all our graphs, paths, and trees to be directed unless otherwise noted.For a path P = x 1 x 2 . . .x k of length k − 1 we will employ the following notation for subpaths of P : P [x i , x j ] := x i . . .x j for 1 i j k is the infix of P from x i to x j .For paths P 1 := x 1 . . .x k v and P 2 := vy 1 . . .y we denote by P 1 P 2 := x 1 . . .x k vy 1 . . .y their concatenation.For rooted trees T and some vertex x ∈ T , T x stands for the subtree of T rooted at x (see Figure 1).
We will frequently partition the nodes of a tree around a path in the following sense (cf. Figure 1): Definition 1.Let T be a tree rooted at r and P = x 1 . . .x a path from r = x 1 to some node x ∈ T .The fins of P are the sets {F xi } xi∈P defined as Definition 2 (Bi-reachable Set).A set B in a digraph D is bi-reachable from a vertex r if for all v ∈ B there exist two internally vertex-disjoint paths from r to v.
Given a digraph D and a vertex r, we can compute the set of vertices that are bi-reachable from r in polynomial time using network flows.

Strongly Connected Digraphs
Let us prove a simple fact on a link between out/in-branchings with many leaves and k-Distinct Branchings, which together with a structural result of Alon et al. [1] and an algorithmic result for the maximum leaf out-branching problem [13,20] gives a short proof that both versions of k-Distinct Branchings are FPT for strongly connected digraphs.
Lemma 1.Let D be a digraph containing an out-branching and an in-branching.If D contains an out-branching (in-branching) T with at least k + 1 leaves, then every in-branching (out-branching) T of D is k-distinct from T .
Proof.We will consider only the case when T is an out-branching since the other case can be treated similarly.Let T be an in-branching of D and let L be the set of all leaves of T apart from the one which is the root of T .Observe that all vertices of L have outgoing arcs in T and since in T the incoming arcs of L are the only arcs incident to L in T , the sets of the outgoing arcs in T and incoming arcs in T do not intersect.
We will use the following dynamic programming result from [6].
Note that if a digraph D is a positive instance of Single-Root k-Distinct Branchings then D must be strongly connected as an out-branching and an in-branching rooted at the same vertex form a strongly connected subgraph of D.
Theorem 3. k-Distinct Branchings and Single-Root k-Distinct Branchings on strongly connected digraphs can be solved in time Proof.The proof is essentially the same for both problems and we will give it for Single-Root k-Distinct Branchings.Let D be an input strongly connected digraph By Theorem 2 using an O * (4 k )-time algorithm we can find an out-branching T + with at least k + 1 leaves, or decide that D has no such outbranching.If T + is found, the instance of Single-Root k-Distinct Branchings is positive by Lemma 1 as any in-branching T − of D is k-distinct from T + .In particular, we may assume that T − has the same root as T + (a strongly connected digraph has an in-branching rooted at any vertex).Now suppose that T + does not exist.Then, by Theorem 1 the (undirected) pathwidth of D is bounded by O(k log k).Thus, by Lemma 2 the instance can be solved in time O * (2 O(k log 2 k) ).

The k-Distinct Branchings Problem
In this section, we fix a digraph D with terminals s, t and simply talk about rooted out-branchings (in-branchings) whose root we implicitly assume to be s (t).Similarly, unless otherwise noted, a rooted out-tree (in-tree) is understood to be rooted at s (t).
The problem k-Distinct Branchings in which T + and T − must be rooted at s and t, respectively, will be called the Rooted k-Distinct Branchings problem.Clearly, to show that both version of k-Distinct Branchings are FPT it is sufficient to prove the following: Theorem 4. Rooted k-Distinct Branchings is FPT for arbitrary digraphs.
In the rest of this section, (D, s, t) will stand for an instance of Rooted k-Distinct Branchings (in particular, D is an input digraph of the problem) and H for an arbitrary digraph.Let us start by observing what further restrictions on D can be imposed by polynomial-time preprocessing.

Preprocessing
Let (D, s, t) be an instance of Rooted k-Distinct Branchings.Recall that D contains an out-branching (in-branching) if and only if D has only one strongly connected component with no incoming (no outgoing) arc.As a first preprocessing step, we can decide in polynomial time whether D has a rooted out-branching and a rooted in-branching.If not, we reject the instance.Note that this in particular means that in a non-rejected instance, every vertex in D is reachable from s and t is reachable from every vertex.
Next, we test for every arc a ∈ D whether there exists at least one rooted in-or out-branching that uses a as follows: since a maximal-weight out-or inbranching for an arc-weighted digraph can be computed in polynomial time [15], we can force the arc a to be contained in a solution by assigning it a weight of 2 and every other arc weight 1.If we verify that a indeed neither appears in any rooted out-branching or in-branching, we remove a from D and obtain an equivalent instance of Rooted k-Distinct Branchings.
After this polynomial-time preprocessing, our instance has the following properties: there exists a rooted out-branching, there exists a rooted in-branching, and every arc of D appears in some rooted in-or out-branching.We call such a digraph with a pair s, t reduced.
Lastly, by the following lemma we may assume that our instance is strongly connected by incurring a factor of two in the application of Lemma 1. Lemma 3. Let (D, s, t) be reduced and let D be the digraph obtained from D by adding the arc ts to it.Then (D , s, t) is a positive instance of Rooted k-Distinct Branchings if and only if so is (D, s, t).Furthermore, if D contains an out-tree (in-tree) with at least leaves, then D contains an out-tree (in-tree) with at least /2 leaves.
Proof.For the first claim, simply note that any rooted out-branching of D cannot use the arc ts and the same holds for rooted in-branchings.
For the second claim, assume T is an out-tree in D with leaves.Assume ts ∈ T (otherwise the claim follows trivially).Let T 1 and T 2 be the two out-trees obtained by deleting the arc ts from T .Both are out-trees in D and one of them contains at least /2 leaves, as claimed.
The first claim of Lemma 3 shows that we may assume that D is strongly connected in Rooted k-Distinct Branchings.This implies the following simple claim required for further references.Then every rooted out-tree with q leaves can be extended into a rooted outbranching with at least q leaves.In summary, we enforce the following properties for (D, s, t) by polynomial-time preprocessing: 1. Every arc of D is contained in at least one rooted in-branching or rooted out-branching, 2. D is strongly connected.

Decomposition and Reconfiguration
We work towards the following win-win scenario: either we find an out-tree with Θ(k) leaves that can be turned into a rooted out-tree with at least k + 1 leaves, or we conclude that every out-tree in D has less than Θ(k) leaves.We refer to the process of turning an out-tree into a rooted out-tree as a reconfiguration.In the process we will develop a new digraph decomposition, the rooted cut-decomposition, which will aid us in reasoning about reconfiguration steps and ultimately lead us to a solution for the problem.
To make the notion of a bi-reachable set easier to use, the decomposition will employ a slightly broader notion as follows.
Definition 3. Let H be a digraph with at least two vertices, and let r ∈ V (H) such that every vertex of H is reachable from r.Let B ⊆ V (H) be the set of all vertices that are bi-reachable from r.The directed block (diblock) B r of r in H is the set B ∪ N + [r], i.e., the bi-reachable vertices together with all out-neighbors of r and r itself.
Note that according to the above definition a diblock must have at least two vertices.
The following statement provides us with an easy case in which a reconfiguration is successful, that is, we can turn an arbitrary out-tree into a rooted out-tree without losing too many leaves.Later, the obstructions to this case will be turned into building blocks of the decomposition.
Lemma 5. Let B s ⊆ V (D) be the diblock of s and let T be an out-tree of D whose root r lies in B s with leaves.Then there exists a rooted out-tree with at least ( − 1)/2 leaves.
Proof.We may assume that r = s.In case T contains s as a leaf, we remove s from T for the remaining argument and hence will argue about the − 1 remaining leaves.
If r is bi-reachable from s, consider two internally vertex-disjoint paths P, Q from s to r.One of the two paths necessarily avoids half of the − 1 leaves of T ; let without loss of generality this path be P .Let further L be the set of those leaves of T that do not lie on P .If r ∈ N + (s), let P = sr.
We construct the required out-tree T as follows: first, add all arcs and vertices of P to T .Now for every leaf v ∈ L, let P v be the unique path from r to v in T and let P v be the segment of P v from the last vertex x of P v contained in T .Add all arcs and vertices of P v to T .Observe that x = v as v cannot be in T already.Since P v and thus P v contains no leaf of L other than v, in the end of the process, all vertices of L are leaves of T .Since |L| ( − 1)/2, the claim follows.
Note that the definition of diblocks can be understood in terms of network flows.Let v = r.Consider the vertex-capacitated version of H where r and v both have capacity 2, and every other vertex has capacity 1, for some v ∈ V (H) \ {r}.Then v is contained in the diblock of r in H if and only if the max-flow from r to v equals 2. Dually, by Menger's theorem, v is not contained in the diblock if and only if there is a vertex u / ∈ {r, v} such that all r-v paths P intersect u.This has the following simple consequence regarding connectivity inside a diblock.Lemma 6. Fix r ∈ V (H) and let B r ⊆ V (H) be the diblock of r in H. Then for every pair of distinct vertices x, y ∈ B r , there exist an r-x-path P x and an r-y-path P y that intersect only in r.
Proof.If r ∈ {x, y}, then clearly the claim holds since every vertex in B r is reachable from r. Otherwise, add a new vertex z with arcs xz and yz, and note that the lemma holds if and only if z is bi-reachable from r.If this is not true, then by Menger's theorem there is a vertex v ∈ B r , v = r, such that all paths from r to z, and hence to x and y, go through v.But as noted above, there is no cut-vertex v / ∈ {x, r} for r-x paths, and no cut-vertex v / ∈ {y, r} for r-y paths.We conclude that z is bi-reachable from r, hence the lemma holds.
Next, we will use Lemma 6 to show that given a vertex r, the set of vertices not in the diblock B r of r in H partitions cleanly around B r .Lemma 7. Let r ∈ V (H) be given, such that every vertex of H is reachable from r.Let B r ⊂ V (H) be the diblock of r in H. Then V (H)\B r partitions according to cut vertices in B r , in the following sense: For every v ∈ V (H) \ B r , there is a unique vertex x ∈ B r \ {r} such that every path from r to v intersects B r for the last time in x.Furthermore, this partition can be computed in polynomial time.
Proof.Assume towards a contradiction that for v ∈ V (H) \ B r there exist two r-v-paths P 1 , P 2 that intersect B r for the last time in distinct vertices x 1 , x 2 , respectively.We first observe that r / ∈ {x 1 , x 2 }, since the second vertices of P 1 and P 2 are contained in B r by definition.By Lemma 6, we may assume that P 1 [r, x 1 ] ∩ P 2 [r, x 2 ] = {r}.But then P 1 and P 2 intersect for the first time outside of B r in some vertex v (potentially in v = v).This vertex is, however, bi-reachable from r, contradicting our construction of B r .Hence there is a vertex x ∈ B r such that every path from r to v intersects B r for the last time in x, with x = r, and clearly this vertex is unique.Finally, the set B r can be computed in polynomial time, and given B r it is easy to compute for each x ∈ B r the set of all vertices v ∈ V (H) (if any) for which x is a cut vertex.
We refer to the vertices x ∈ B r that are cut vertices in the above partition as the bottlenecks of B r .Note that r itself is not considered a bottleneck in B r .Using these notions, we can now define a cut decomposition of a digraph H. Definition 4 (Rooted cut decomposition and its tree).Let H be a digraph and r a vertex such that every vertex in H is reachable from r.The (r-rooted) cut decomposition of H is a pair ( T , B) where T is a rooted tree with V ( T ) ⊆ V (H) and B = {B x } x∈ T , B x ⊆ V (D) for each x ∈ T , is a collection of diblocks associated with the nodes of T , defined and computed recursively as follows.
1. Let B r be the diblock of r in H, and let L ⊆ B r \ {r} be the set of bottlenecks in B r .Let {X x } x∈L be the corresponding partition of V (H)\ B r .
2. For every x ∈ L, let ( Tx , B x ) be the x-rooted cut decomposition of D[X x ∪ {x}].
3. T is the tree with root node r, where L is the set of children of r, and for every x ∈ L the subtree of T rooted at x is Tx .
Furthermore, for every node x ∈ T , we define B * x = y∈ Tx B y as the set of all vertices contained in diblocks associated with nodes of the subtree Tx .Lemma 8. Let a digraph H and a root r ∈ V (H) be given, such that every vertex of H is reachable from r. Then the r-rooted cut decomposition ( T , {B x } x∈ T ) of H is well-defined and can be computed in polynomial time.Furthermore, the diblocks cover V (H), i.e., x∈ T B x = V (H), and for every node x ∈ T , every vertex of B * x is reachable from Proof.By Lemma 7, the root diblock B r as well as the set L ⊆ B r of bottlenecks and the partition {X x } x∈L are well-defined and can be computed in polynomial time.Also note that for each x ∈ L, r / ∈ X x ∪ {x}, and every vertex of x by the definition of the partition.Hence the collection of recursive calls made in the construction is well-defined, Figure 2: An example of a rooted cut decomposition.and every digraph H x used in a recursive call is smaller than H, hence the process terminates.Finally, for any two distinct bottlenecks x, y ∈ L we have In particular, every arc of H is either contained in a subgraph of H induced by a diblock B x , or it is a back arc going from a diblock B y to a diblock B x , where x is an ancestor of y in T .
Proof.For the first claim, the sets B x \ {x} are non-empty by definition; we show the partitioning claim.By Lemma 7, for every v ∈ V (H) \ {r} either v ∈ B r \ {r} or there is exactly one bottleneck x ∈ B r such that v ∈ X x in the construction of the decomposition.Also note that in the latter case, v = x since x ∈ B r .Applying the argument recursively and using that the diblocks cover V (H), by Lemma 8, we complete the proof of the partitioning claim.
For the second claim, the partitioning claim implies that if v ∈ B x ∩ B y for distinct nodes x, y ∈ T , then either v = x or v = y, i.e., v must be a bottleneck.This is only possible in the situation described.
For Claim 3(b), first consider the diblock B r and the partition {X x } given by Lemma 7. We show that for any two distinct sets X x , X y of the partition, there is no arc between X x and X y .Suppose for a contradiction that there is such an arc uv, u ∈ X x , v ∈ X y .By Lemma 6, there are paths P x and P y in B r that intersect only in r, and by Lemma 8, there are paths P u from x to u in X x and P v from y to v in X y .But then the paths P x P u uv and P y P v form two r-v paths that are internally vertex-disjoint, showing that v ∈ B r , contrary to our assumptions.Since the decomposition is computed recursively, this also holds in every internal node of T .
For Claim 3(a), let uv be an arc such that u / ∈ B * y and v ∈ B * y .Moreover, let u ∈ B x and v ∈ B y .By construction of cut decomposition, there is a path P from x to y in T containing nodes x and y.Let x be the second node in P (just after x ).Thus, there is a path P from x to v in H containing the vertices of P apart from x .
Assume that u = x .Then by Lemma 6, there is an x -u-path P and an x -x -path P of H which intersect only at x .Then x P uv and P P are internally vertex-disjoint paths from x to v.This means that v must be in B x , a contradiction unless x = x, u ∈ B x and v = y.If u = x , then P and uv are internally vertex-disjoint paths from u to v.This means that v must be in B x , a contradiction unless x = x and v = y.
As we saw, for every diblock B y , y ∈ T , any path "into" the diblock must go via the bottleneck vertex y.By induction, for any v ∈ B y , every node of T from r to y represents a bottleneck vertex that is unavoidable for paths from r to v.More formally, the following holds in cut decompositions: Lemma 10.Let ( T , {B x } x∈ T ) be the cut decomposition of H rooted at r. Fix a diblock B x for x ∈ T .Consider a path P in H from r to v ∈ B x and let x 1 . . .x be the sequence of bottleneck vertices that P encounters.Then P = x 0 x 1 . . .x with x 0 = r is the path from r to x in T .
Proof.We prove the claim by induction over the depth d of x in T .If r = x then any path from r to v ∈ B r contains r itself and hence the base case for d = 0 holds.
Consider a diblock B x , x ∈ T where x has distance d to r in T and let y be the parent of x in T .We assume the induction hypothesis holds for diblocks at depth d − 1, hence it holds for B y in particular.Because x ∈ B y , this implies that every path from r to x will contain all ancestors of x in T .Since by construction every path from r to a vertex v ∈ B x needs to pass through x, the inductive step holds.This proves the claim.
As an immediate consequence, we can identify arcs in cut decompositions that cannot participate in any rooted out-branching.
Corollary 1.Let ( T , {B x } x∈ T ) be the cut decomposition of rooted at r and let R := {uv ∈ A(H) | u ∈ B x and x ∈ Tv } be all the arcs that originate in a diblock B x and end in an ancestor v of x on T .Then for every out-tree T rooted at r we have A(T ) ∩ R = ∅.
Proof.Fix a bottleneck vertex v ∈ T of the decomposition and let the arc uv be in an out-tree T rooted at r.There must exist a path P su from s to u that is part of T .By Lemma 10, this path will contain the vertex v.But then v is an ancestor of u in T and therefore the arc uv cannot be part of T , which is a contradiction.
The decomposition actually restricts paths even further: a path that starts at the root and visits two bottleneck vertices x, y (in this order) cannot intersect any vertex of B * y before visiting y and cannot return to any set B * z , z ∈ T , after having left it.
Lemma 11.Let ( T , {B x } x∈ T ) be the cut decomposition of H rooted at r. Fix a diblock B x for x ∈ T .Consider a path P from r to v ∈ B x and let P = x 0 . . .x be the path from r = x 0 to x = x in T .Let further F 0 , . . ., F be the fins of P in T .Then the subpath P [x i , x i+1 ] \ {x i+1 } is contained in the union of diblocks of F i for 0 i < .
Proof.By Lemma 10 we know that the nodes of P appear in P in the correct order, hence the subpath P [x i , x i+1 ] is well-defined.Let us first show that the subpath P [x i , x i+1 ] \ {x i+1 } cannot intersect any diblock associated with Txi+1 .By Lemma 9, the only arcs from B xi into diblocks below x i+1 connect to the bottleneck x i+1 itself.Since x i+1 is already the endpoint of P [x i , x i+1 ], this subpath cannot intersect the diblocks of Txi+1 .This already proves the claim for x 0 ; it remains to show that it does not intersect diblocks of V ( T )\V ( Txi ) for i 1.The reason is similar: since the bottleneck x i is already part of P [x i , x i+1 ], this subpath could not revisit B xi if it enters any diblock B y for a proper ancestor y of x i in T .We conclude that therefore it must be, with the exception of the vertex x i+1 , inside the diblocks of the fin F i .
Corollary 2. For every vertex u ∈ V (H) and every set X ⊆ V (H)\(V ( T )∪{u}) of non-bottleneck vertices there exists a path P from r to u such that |P ∩ X| |X|/2.
Proof.Assume that u ∈ B x and let P = x 0 . . .x be a path from x 0 = r to x = x in T .Let further F 0 , . . ., F be the fins of P in T .We partition the set X into X 1 , . . ., X where X i = X ∩ F i for 0 i .Lemma 11 allows us to construct the path P iteratively: any path that leads to u will pass through bottlenecks x i , x i+1 in succession and visit only diblocks associated with F i in the process.Since there are two internally vertex-disjoint paths between x i , x i+1 for 1 i , we can always choose the path that has the smaller intersection with X i .Stringing these paths together, we obtain the claimed path P .
We want to argue that one of the following cases must hold: either the cut decomposition has bounded height and we can 're-root' any out-tree with many leaves into a rooted out-tree with a comparable number of leaves, or we can directly construct a rooted out-tree with many leaves.In both cases we apply Lemmas 1 and 4 to conclude that the instance has a solution.This approach has one obstacle: internal diblocks of the decomposition that contain only two vertices.
Definition 5 (Degenerate diblocks).Let {B x } x∈ T be the cut decomposition rooted at s.We call a diblock B x degenerate if x is an internal node of T and Let us first convince ourselves that a long enough sequence of non-degenerate diblocks provides us with a rooted out-branching with many leaves.Lemma 12. Let ( T , {B x } x∈ T ) be the cut decomposition rooted at s of H and let y be a node in T such that the path Psy from s to y in T contains at least nodes whose diblocks are non-degenerate.Then H contains an out-tree rooted at s with at least leaves.
Proof.We construct an s-rooted out-tree T by repeated application of Lemma 6.Let x 1 , . .., x be a sequence of nodes in Psy whose diblocks are non-degenerate, and for each 1 i < let x + i be the node after x i in Psy .We construct a sequence of s-rooted out-trees T 1 , . .., T such that for 1 i , the vertex x i is a leaf of T i , and T i contains i leaves.First construct T 1 as a path from s to x 1 , then for every 1 i < we construct an out-tree T i+1 from T i as follows.Let v i ∈ B xi \ {x i , x + i }, which exists since B xi is non-degenerate, and let P xix + i , P xivi be a pair of paths in D[B * xi ] from x i to x + i and to v i respectively, which intersect only in x i .Such paths exist by Lemma 6, and since x i is a leaf of T i , Lemma 10 implies that T i is disjoint from B * xi \ {x i }.Hence the paths can be appended to T i to form a new r-rooted out-tree T i+1 in H which contains a leaf in every diblock B xj , 1 i.Finally, note that the final tree T contains two leaves in B x −1 , hence T is an r-rooted out-tree with leaves.
The next lemma is the last assertion that we will use to prove shortly that Rooted k-Distinct Branchings is FPT for digraphs D whose cut decomposition rooted at s contains no degenerate diblocks.Lemma 13.Let ( T , {B x } x∈ T ) be the cut decomposition of D rooted at s such that T is of height d and let T be an out-tree rooted at some vertex r with leaves.Then we can construct an out-tree T s rooted at s with at least ( − d)/2 leaves.
Proof.Assume that r is contained in the diblock B x of the decomposition and let x p . . .x 1 = Psx be a path from s = x p to x = x 1 in T .Let L be the leaves of T and let L := L \ Psx .Clearly, |L | − d.Applying Corollary 2 with X = L and u = r, we obtain a path P sr in D from s to r that avoids half of L .We construct T s in a similar fashion to the proof of Lemma 5.
We begin with T s = P sr , then for every leaf v ∈ L \ P sr , proceed as follows: let P v be the unique path from r to v in T and let P v be the segment of P v from the last vertex x of P v contained in T s .Add all arcs and vertices of P v to T s .Since P v and thus P v contains no leaf of L other than v, in the end of the process, all vertices of L \ P sr are leaves of T s .Since |L \ P sr | |L |/2, we conclude that T s contains at least ( − d)/2 leaves, as claimed.
The next lemma demonstrates that using Lemma 13 and a number of other results we can prove that if the height of d of the cut decomposition of D is upper-bounded by a function in k, then Rooted k-Distinct Branchings on D is FPT.This shows that to prove that Rooted k-Distinct Branchings in general it suffices to consider separately the cases of bounded d and unbounded d.
To provide an appropriate bound on d we will use further results on degenerate diblocks provided in Section 4.3.).(Note that for the dynamic programming algorithm of Lemma 2 we may fix roots of all outbranchings and all in-branchings of D by adding arcs s s and tt to D, where s and t are new vertices.)

Handling degenerate diblocks
Here is a key notion for our study of degenerate diblocks.Definition 6 (Degenerate paths).Let ( T , {B x } x∈ T ) be a cut decomposition of D. We call a path P in T monotone if it is a subpath of a path from the root of T to some leaf of T .We call a path P in T degenerate if it is monotone and every diblock B x , x ∈ P is degenerate.
Let (D, s, t) be a strongly connected reduced instance of Rooted k-Distinct Branchings.As observed in Section 4.1, we can verify in polynomial time whether an arc participates in some rooted in-or out-branching.Let R s ⊆ A(D) be those arcs that do not participate in any rooted out-branching and R t ⊆ A(D) those that do not participate in any rooted in-branching.Since (D, s, t) is a reduced instance, we necessarily have that R s ∩ R t = ∅, a fact we will use frequently in the following.Corollary 1 provides us with an important subset of R s : every arc that originates in a diblock B x of the cut decomposition and ends in a bottleneck vertex that is an ancestor of x on T is contained in R s .
Let us first prove some basic properties of degenerate paths.
Lemma 15.Let P = x 1 . . .x be a degenerate path of ( T , {B x } x∈ T ) of D rooted at s. Then the following properties hold: 1. Every rooted out-branching contains A( P ), 2. every arc x j x i with j > i is contained in R s , and 3. there is no arc from x i (i < ) to B y in D, where y is a descendant of x i on T , except for the arc x i x i+1 .
Proof.Every rooted out-branching contains in particular the last vertex x of the path.By Lemma 10, it follows that P is contained in the out-branching as a monotone path, hence it contains A( P ).Consequently, no 'back-arc' x j x i with j > i can be part of a rooted out-branching and thus it is contained in R s .
For the third property, note that all arcs from x i except back arcs are contained in B xi .Since B xi is degenerate there can be only one such arc.
For the remainder of this section, let us fix a single degenerate path P = x 1 . . .x .We categorize the arcs incident to P as follows: 1. Let A + contain all 'upward arcs' that originate in P and end in some diblock B y where y is an ancestor of x 1 , 2. let A 0 contain all 'on-path arcs' x j x i , j > i, and 3. let A − contain all 'arcs from below' that originate from some diblock B y where y is a (not necessarily proper) descendant of x .
By Lemma 15, this categorization is complete: no other arcs can be incident to P in a reduced instance.By the same lemma, we immediately obtain that A 0 , A − ⊆ R s .We will now apply certain reduction rules to (D, s, t) and prove in the following that they are safe, with the goal of bounding the size of P by a function of the parameter k.
If there are two arcs x i u, x j u ∈ A + ∩ R t with i < j, remove x j u.
Proof.Since (D, s, t) is reduced, the arcs x i u and x j u cannot be in R s .Pick any rooted out-branching T that contains the arc x j u.By Lemma 15, we have that P ⊆ T , therefore we can construct an out-branching T by exchanging the arc x j u for the arc x i u.Since a) no rooted in-branching contains either of these two arcs, b) no out-branching can contain both, and c) the number of leaves in T and T are the same, we conclude that (D \ {x j u}, s, t) is equivalent to (D, s, t) and thus Rule 1 is safe.Proof.Let H be the heads of the arcs A + ∩ R t .Since Rule 1 was applied exhaustively, no vertex in H is the head of two arcs Note that any arc in A + ∩ R t cannot be contained in R s , therefore H does not contain any bottleneck vertices.Applying Corollary 2, we can find a path P from s to x that avoids half of the vertices in H. Thus we can add half of H as leaves to P using the arcs from A + ∩ R t .Thus if |H| 4k + 2, we obtain a rooted out-tree with at least 2k + 2 leaves (this count includes x ), which by Lemmas 1, 3 and 4 imply that the original instance has a solution.We conclude that otherwise Lemma 17.Let P = x 1 . . .x be a degenerate path.Assume t ∈ P and that (D, s, t) is reduced with respect to Rule 1.Let further X ⊆ V ( P ) be those vertices of P that are tails of the arcs in A + .We either find that (D, s, t) has a solution or that |X| 6k + 2.
Proof.For every vertex x i ∈ X with an arc x i v ∈ A + \ R t , we construct a path Pxit from x i to t that contains x i v as follows: since x i v ∈ R t , there exist a rooted in-branching T that contains x i v.We let Pxit ⊆ T be the path from x i to t in T .
Claim.Each path Pxit does not intersect vertices in diblocks of Txi .
Since Pxit leaves P via the first arc x i v, it cannot use the arc x i x i+1 .Since this is the only arc that leads to vertices in diblocks of Txi , the claim follows.
Let us relabel the just constructed paths to P1 , . . ., P such that they are sorted with respect to their start vertices on P .That is, for i < j the first vertex of Pi appears before the first vertex of Pj on P .We iteratively construct rooted in-trees T1 , . . .T with the invariant that a) Ti has exactly i leaves and b) does not contain any vertex of P below the starting vertex of Pi .Choosing T1 := P1 clearly fulfills this invariant.To construct Ti from Ti−1 for 2 i , we simply follow the path Pi up to the first intersection with Ti−1 .Since t ∈ Pi ∩ Ti−1 , such a vertex must eventually exist.By the above claim, Pi does not contain any vertex below its starting vertex on P , thus both parts of the invariant remain true.
We conclude that T is a rooted in-tree with leaves, where is the number of vertices in X that have at least one upwards arc not contained in R t .For 2k + 2, Lemmas 1, 3 and 4 imply that the original instance has a solution.Otherwise, 2k + 1.By Corollary 3, we may assume that |A + ∩ R t | 4k + 1.Taken both facts together, we conclude that either |X| 6k + 2, or we can construct a solution.
We will need the following simple observation.
Lemma 18.Let P = x 1 . . .x be a degenerate path such that the in-branching root t lies in some diblock of Tx .Then A + ⊆ R t and A 0 = ∅.
Proof.In every in-branching rooted at t, a vertex x i , 1 < i of P will necessarily be the parent of x i−1 .Accordingly, no arc originating at a vertex of P can be part of any in-branching implying that A + , A 0 ⊆ R t .By Lemma 15, A 0 is additionally contained in R s and thus in a reduced instance we necessarily have that A 0 = ∅.Lemma 19.Let P = x 1 . . .x be a degenerate path and assume that t ∈ P .Let further Y ⊆ V ( P ) be those vertices of P that are tails of the arcs in A 0 .We either find that (D, s, t) has a solution or we have |Y | < k.
Proof.We will construct a rooted in-tree that contains |Y | arcs from A 0 .Since no rooted out-branching contains any such arc, this will prove that the instance is positive provided |Y | k.Note in particular that we are not concerned with the number of leaves of the resulting tree.
First associate every vertex v ∈ Y with an arc vx v ∈ A 0 , where we choose x v to be the vertex closest to v. Let X + be the heads of all arcs in A + and let X ⊆ P be the tails of all arcs in A + .
Let u ∈ Y be the vertex that appears first on P among all vertices in Y .Since ux u ∈ R s , ux u cannot be contained in R t .Accordingly there exists a path P u from u to t that uses the arc ux u .Note that P u leaves P through an A + -arc whose tail lies between x u and u on P .
Note that the segment P u [x u , t], by our choice of u, does not contain any vertex of Y .We now construct the seed in-tree T 0 as follows.We begin with P u and add the arc u x u for every vertex u ∈ Y where x u ∈ P u .Next, we add every vertex v ∈ X + to T 0 by finding a path from v to t and attach this path up to its first intersection with T 0 .Since v lies above x u in the decomposition, this path cannot intersect any vertex in Y .
We form an in-forest5 F 0 from the arcs of T 0 and all arcs vx v , v ∈ Y that are not in T 0 .Every in-tree T ∈ F 0 has the following easily verifiable properties: a) its root is the highest vertex in the decomposition among all vertices V (T ) (recall Lemma 9), b) its root is either t or a vertex x v with v ∈ Y , and c) every segment P [x, y] of P contained in T has no vertex of X or Y with the possible exception of y ∈ Y .
We will maintain all three of these properties while constructing a sequence of in-forests F 0 ⊆ F 1 ⊆ . . .where each in-forest in the sequence will have less roots than its predecessor (here ⊆ stands for F i−1 being a subgraph of F i ).We stop the process when the number of roots drop to one.The construction of F i from F i−1 for i 1 works as follows.Let T ∈ F i−1 be the in-tree with the lowest root in the in-forest.By assumption, F i−1 has at least two roots, thus it cannot be t and therefore, by part b) of our invariant, is a vertex x v with v ∈ Y .Now from x v onwards, we walk along the path P until we encounter a vertex z that is either 1) the tail of an arc A + or 2) a vertex of the in-forest F i−1 .In the former case, we use the segment P [x u , z] to connect T to a vertex in X + via the A + -arc emanating from z. Since all vertices in X + are part of the seed in-tree T 0 this preserves all three parts of the invariant and F i−1 ⊆ F i .
Consider the second case: we encounter a vertex z that is part of some tree T ∈ F i−1 .Let us first eliminate a degenerate case: Claim.The trees T and T are distinct.
Assume towards a contradiction that T = T .In that case, there is no single vertex between x v and z that is either the tail of an A + or A 0 -arc.If z is such that x z = x v (for example z = v), we already obtain a contradiction: the arc zx z cannot possibly be part of any in-branching rooted at t, contradicting the fact that it is not in R t .
Otherwise, z = x w for some w ∈ Y .By assumption, wz ∈ T , thus there exists a path P wxv which contains both the arc wz as well as the arc vx v .Therefore, the vertex w must lie below v on P .Furthermore, the path P wxv cannot contain any vertex above x v by property a) of the invariant.It follows that the subpath P [z, v] is entirely contained in T -by property c) of the invariant, none of the vertices (except v) in this subpath can be in X or Y .Since the same was true for the subpath P [x v , z], we conclude that the whole subpath P [x v , v] contains no vertex of X or Y .This contradicts our assumption that x v v ∈ R t and we conclude that T and T must be distinct.
By our choice of T , the vertex z cannot be the root of T .Accordingly, we can merge T and T by adding the path P [x v , z].This concludes our construction of F i .Since the root of T lies above all vertices of T , part 1) of the invariant remains true.We did not change a non-root to a root in this construction, thus part 2) remains true.The one segment of P [x v , z] we added to merge T and T did not, by construction, contain any vertex of Y or X, with the exception of the last vertex z, hence part 3) remains true.Finally, we clearly have that F i−1 ⊆ F i and the latter contains one less root than the former.
The process clearly terminates with some in-forest F p which contains a single in-tree T .The root of this in-tree is necessarily t.Note further that F 0 contained all |Y | arcs ux u , u ∈ Y ; therefore T contains those arcs, too.Since all of these arcs are in R s , we arrive at the following: either |Y | < k, as claimed, or we found a rooted in-tree that avoids at least k arcs with every rooted out-branching, in other words, as solution to (D, s, t).
Taking Lemma 17 and Lemma 19 together, we see that only O(k) vertices of a degenerate path are tails of arcs in A + or A 0 .The following lemma now finally lets us deal with degenerate paths: we argue that those parts of the path that contain none of these few 'interesting' vertices can be contracted.
If P [x, y] ⊆ P is such that no vertex in P [x, y] is a tail of arcs in A + ∪ A 0 , contract P [x, y] into a single vertex.
Proof.Simply note that every vertex in P [x, y] has exactly one outgoing arc.We already know that every arc of P must be contained in every rooted outbranching, now we additionally have that all arcs in P [x, y] are necessarily contained in every rooted in-branching.We conclude that Rule 2 is safe.
We summarize the result of applying Rules 1 and 2.
Lemma 21.Let P be a degenerate path in an instance reduced with respect to Rules 1 and 2. Then | P | 14k + 3.
Proof.By Lemmas 17 and 19, the number of vertices on P that are tails of either A + or A 0 is bounded by 7k + 1. Between each pair of such vertices, we can have at most one vertex that is not a tail of such an arc.We conclude that |P | 14k + 3, as claimed.Now we can prove the main result of this paper.
Proof of Theorem 4. By Lemma 3, we may assume that D is strongly connected.Consider the longest monotone path P of T .
By Lemma 12, if P has at least k + 1 non-degenerate diblocks, then D has a rooted out-tree with at least k + 1 leaves.This out-tree can be extended to a rooted out-branching with at least k +1 leaves by Lemma 4. Thus, by Lemma 1, (D, s, t) is a positive instance if and only if D has a rooted in-branching, which can be decided in polynomial time.Now assume that P has at most k non-degenerate diblocks.By Lemma 21 we may assume that before, between and after the non-degenerate diblocks there are O(k) degenerate diblocks.Thus, the height of T is O(k 2 ).Therefore, by Lemma 14, the time complexity for Theorem 4 is O * (2 O(k 2 log 2 k) ).

Conclusion
We showed that the Rooted k-Distinct Branchings problem is FPT for general digraphs parameterized by k, thereby settling open question of Bang-Jensen et al. [6].The solution in particular uses a new digraph decomposition, the rooted cut decomposition, that we believe might be useful for settling other problems as well.
We did not try to optimize the running time of the algorithm of Theorem 4. Perhaps, a more careful handling of degenerate diblocks may lead to an algorithm of running time O * (2 O(k log 2 k) ).Regarding the motivation by application wireless sensor networks, it would further be interesting whether the problem can be computed or approximated in a distributed fashion.
Let us complete the paper by mentioning some digraph problems, which are still open.Bang-Jensen et al. [6] asked what is the parameterized complexity of the following problem: given a strongly connected digraph D and a number (parameter) k, can we delete k arcs from D such that D remains strongly connected.Earlier, Bang-Jensen and Yeo [9] asked whether the following problem is FPT: given a strongly connected digraph D and a number (parameter) k, can we path-contract k arcs from D such that D remains strongly connected.Path-contraction of an arc xy of D results in a digraph obtained from D by replacing x and y with a new vertex v, deleting all arcs incident to either x or y and adding arc uv if arc ux is in D and arc vw if arc yw is in D. Note that path-contraction "preserves" directed paths.
Consider the following problem introduced by Bezáková, Curticapean, Dell and Fomin [11].For given vertices s and t of a digraph K, and an integer (parameter) k, decide whether D has an (s, t)-path in D that is at least k longer than a shortest (s, t)-path.If "at least" is replaced by "exactly", then the problem is FPT [11].However, it is unknown whether the original problem is even in XP.

Figure 1 :
Figure 1: Subtree notation T x for x ∈ T (left) and the fins F x1 , . . ., F x for a path x 1 . . .x in T (right).

Lemma 4 .
Let D be an input digraph of Rooted k-Distinct Branchings.

Figure 4 .
Figure 4.2 provides an illustration to Definition 4.

Lemma 9 . 3 .
Thereby, distinct nodes of T are associated with distinct vertices of H, | T | |V (H)|, and the map x → B x is well-defined.It is also clear that the whole process takes polynomial time.We collect some basic facts about cut decompositions.Let a digraph H and a vertex r ∈ V (H) be given, and let ( T , {B x } x∈ T ) be the r-rooted cut decomposition of H. Then the following hold.1.The sets {B x \ {x}} x∈ T are all non-empty and partition V (H) \ {r}. 2. For distinct nodes x, y ∈ T , if x is the parent of y in T then B x ∩B y = {y}; in every other situation, B x ∩ B y = ∅.For every node x ∈ T , the following hold: (a) If y is a child of x in T , then any arc leading into the set B * y from V (H) \ B * y will have the form uy where u ∈ B x .(b) If y, y are distinct children of x in T , then there is no arc between B * y and B * y .

Lemma 14 .
Let ( T , {B x } x∈ T ) the cut decomposition rooted at s of height d.If d d(k) for some function d(k) = Ω(k) of k only, then we can solve Rooted k-Distinct Branchings on D in time O * (2 O(d(k) log 2 d(k)) ).Proof.By Theorem 2, in time O * (2 O(d(k)) ) we can decide whether D has an outbranching with at least 2k + 2 + d(k) leaves.If D has such an out-branching, then by Lemma 13 D has a rooted out-tree with at least k + 1 leaves.This out-tree can be extended to a rooted out-branching with at least k + 1 leaves by Lemma 4. So by Lemma 1, (D, s, t) is a positive instance if and only if D has a rooted in-branching, which can be decided in polynomial time.If D has no out-branching with at least 2k+2+d(k) leaves, by Theorem 1 the pathwidth of D is O(d(k) log d(k)) and thus by Lemma 2 we can solve Rooted k-Distinct Branchings on D in time O * (2 O(d(k) log 2 d(k))

Corollary 3 .
Let (D, s, t) be reduced with respect to Rule 1. Then we either find a solution for (D, s, t) or |A + ∩ R t | 4k + 1.