A 2-partition of a digraph is a partition of into disjoint sets. Let be two (di)graph properties. Then a -partition of a digraph is a 2-partition so that has property for , where is the subdigraph induced by . A --partition of a digraph is as above, but now we also require that for . For example if is the property of being acyclic, then the set of digraphs that allow a -partition are exactly those digraphs that have dichromatic number at most 2. Recognizing such digraphs is NP-complete .
Problems concerning the existence of certain 2-partitions of a given input digraph has received a lot of attention in the literature, see e.g. [1, 3, 4, 5, 7, 8, 9, 10, 12, 13, 14]. In the papers [1, 3] the authors gave, for fixed (not part of the input), a complete complexity classification, in terms of being NP-complete or in XP, for the 120 -partition problems corresponding to properties both being one of the following 15 properties: being strongly connected, being connected, minimum out-degree at least 1, minimum in-degree at least 1, minimum in- and out-degree at least 1, minimum degree at least 1, having an out-branching, having an in-branching, being acyclic, being complete, being oriented, being independent, being semicomplete, being a tournament and finally being symmetric. They left open to characterize which of those problems that are polynomial actually admit an FPT algorithm. In  this was settled for the 23 polynomially solvable problems coming from both and being one of the following 8 properties: strongly connected, connected, having an out-branching, having an in-branching, having minimum degree at least 1, having minimum in- and out-degree at least 1, being acyclic, being complete. One problem that was left open in  was to determine the parameterized complexity of deciding the existence of a 2-partition with for where the digraph induced by has an out-branching and the digraph has no vertex of in-degree zero. We prove in this paper that this problem is FPT.
2 Notation and preliminaries
The notation we use is consistent with that of . For a digraph we say that two vertices and are adjacent if at least one of the arcs is in . For a set of vertices , the subdigraph induced by , denoted , is the digraph obtained from by deleting all vertices and all arcs adjacent to those vertices. For digraph we denote by the number of vertices in the graph. We use the same notation for paths and cycles, so is the number of vertices in the path . Paths and cycles will always be directed. The girth of a digraph is the length of a shortest directed cycle in . A -path is a directed path from to and the digraph is strongly connected if it contains a
-path for all ordered pairs of vertices. A strong component of a digraph is a maximal induced subdigraph which is strong. A strong component is initial if it has no entering arc in .
The underlying graph, , of a digraph is the graph obtained from by replacing every 2-cycle by one edge and then suppressing all the directions of the other arcs. A digraph is connected if is connected. For a vertex , we denote by its neighbours, that is, the set of vertices that are adjacent to . The out-degree is the number of arcs going out of in . Similarly, the in-degree is the number of arcs going into . We denote by the minimum in-degree of a vertex in . For a subset , denotes the set of out-neighbours of in .
An out-tree rooted in is a connected digraph such that and for all . An out-branching, , of a digraph is an out-tree such that .
A digraph is acyclic if it contains no induced directed cycles, and it is complete if for every pair of vertices induce a 2-cycle .
A parameterized problem with parameter is in the complexity class XP if instances of size can be solved in time for some pair of computable functions . So if is fixed the problem can be solved in polynomial time. A problem is Fixed Parameter Tractable (FPT) if it can be solved in time for some constant and computable function .
3 The --partition problem
The following is the problem whose complexity status we settle in this paper.
Input: A digraph and natural numbers
Question: Is there a 2-partition of such that has an out-branching and , where for ?
In  the problem was shown to be polynomially solvable for every fixed pair of natural numbers , but the algorithm has a running time and hence is not an FPT algorithm.
We begin with a few simple observations. The root of the out-branching is the only vertex that can possibly have in-degree 0 in a yes-instance. Therefore, if there are two or more vertices with in-degree 0 in , it must be a no-instance. So in the following we assume the input is a digraph with at most one vertex with in-degree 0. For future reference, if there is such a vertex with in-degree 0 in the input , we will refer to it as , and in that case must be the root of the out-branching.
Throughout the solution to the --partition problem, we will say that we grow some subset of the vertices inside the graph. What we mean by grow is iteratively adding a vertex to the set that is an out-neighbour of a vertex in the set. Sometimes we want to limit this process to only growing the set to a certain size. We formalize the process in Algorithm 1.
Note that if we don’t want to limit the growth we can set .
Algorithm 1 runs in polynomial time.
Calculating the set of out-neighbours of a set can be done in polynomial time. A vertex is added to in each iteration of the while loop, so if none of the exit conditions are met before the st iteration, then after that iteration every vertex in the graph has been added to and thus its neighbourhood must be empty. So the algorithm runs in polynomial time. ∎
If , then we can solve the --partition problem in polynomial time. If we can try all possible roots of the out-branching (there is only one possible root if exists), and grow it as large as possible by using Algorithm 1, with containing the single vertex that we are trying as root and . As we start with a single vertex and each vertex that is added has at least one arc into it from the previous set, it follows by induction that the subdigraph induced by the set returned by Algorithm 1 will contain an out-branching . If one of the possible roots grows to a set with , then because none of the vertices in has arcs to vertices in , it follows from our assumption that every vertex of (except possibly ) has in-degree at least 1, that we have . Thus, is a solution.
For the case , we will use the following algorithm which will prove useful later as well.
Algorithm 2 simply iteratively removes vertices with in-degree 0 in the current digraph and return the resulting digraph. Note that the resulting digraph will have .
Algorithm 2 finds the largest possible subdigraph with in polynomial time.
It is clear that the algorithm runs in polynomial time and the other part of the claim follows from the fact that a vertex is only removed if it cannot be part of any subdigraph of minimum in-degree at least 1. ∎
To handle the case we simply apply Algorithm 2 to the input .
Note that the removed vertices (if any) induce a subdigraph with an out-branching rooted at , because a vertex only has in-degree 0 if it is or if its in-neighbours were removed, implying that an arc into it existed in . Hence if the output of has then is a solution.
From now on we assume that . Let us call a 2-partition of good if has an out-branching and . As we have assumed that we have at most one vertex with in-degree 0, the following lemma, which is the basis of the polynomial algorithm of Theorem 3.9 in , shows that in order to verify that is a ’yes’-instance we only need to find an induced subdigraph of such that is a ’yes’-instance.
Let be an instance of the --partition problem with at most 1 vertex with in-degree 0. Then any 2-partition (with if exists) of a subset of , where
has an out-branching
can be extended to a good partition of in polynomial time.
Call a 2-partition that satisfies the conditions of the lemma a subsolution.
Fix any subsolution. Use Algorithm 1 on the graph , starting with and , and denote the result by . In other words we grow the out-branching as large as possible, while not using any vertex in . We claim that is a solution. Clearly . Since has an out-branching and Algorithm 1 only adds a vertex if it has an in-neighbour in the current set , must contain an out-branching. Secondly, because if it exists, we know that all vertices in had in-degree at least 1 in . It was also the case that . Now because was grown as large as possible in , the vertices in (if any) were not reachable from and thus must still have in-degree at least 1 in . Moreover, meaning , and thus is a solution.
As this is a simple application of Algorithm 1 a subsolution can be extended to a solution in polynomial time. ∎
So from here on, finding a subsolution is sufficient to solve the problem.
The following result, due to Shen, will be used in the proof of our main result.
 Suppose is a digraph of order and girth with . Let . Then
The result also holds if we let be the number of vertices with in-degree 1 (in a digraph with ), instead of out-degree 1 (just reverse all arcs and apply Theorem 4). We are now ready to prove our main result.
The --partition problem is FPT.
We will describe an FPT algorithm which correctly decides whether the input is a yes-instance of the --partition problem.
From the previous observations, we can assume that the input satisfies that and has at most one vertex with in-degree 0.
Let and define the functions by setting and .
We start by determining some arcs that cannot be part of the out-branching in any solution. We say that an arc is non-branchable if does not have a subdigraph of size at least with . Thus if an arc is non-branchable, then at least one of the vertices must belong to in any good partition . Using Algorithm 2 we can identify the set of non-branchable arcs in polynomial time. Let be the potential branching arcs and let be the subdigraph of containing exactly the arcs in . For each vertex we now define as the out-neighbours of in .
Clearly, can be calculated for each in polynomial time. We now distinguish several cases which cover all the possibilities.
In this case we can check all possible out-trees of size exactly in . We do this by trying each possible root, of which there are at most (there is only 1 if exists), and for each root the out-tree will have height at most .
For each vertex, already included in the out-tree, we can use between 0 and of at most different arcs leaving that vertex. There are at most
ways to do so.
So a very rough upper bound on the total number of out-trees that must be checked is
which means if each check can be done in polynomial time, we can solve this case in FPT time.
For the case where , we first split the case into whether or not the vertex exists, and begin with the case where does not exist.
We will show that, if we are in this case then is a yes-instance and, in fact, any vertex with , can be the root of the out-branching in a solution.
Fix any with .
We will say that we contract into , if the arc exists. Contracting into means removing the vertex and adding arcs from to every out-neighbour of (if is not already an arc). As it turns out, we will only contract vertices into our choice for the root of the out-branching , and unless otherwise stated, we do not rely on the vertices that are contracted into for our solution.
Let be the set of strong components of and for each strong component let denote the set of out-neighbours of inside using arcs in , that is,
Note that and can easily be computed in polynomial time.
Fix such that . First, we look for a subsolution , where is contained completely in one of the sets .
Let be the output from Algorithm 2 on input (i.e. is a maximum subdigraph in with ). If , then is a subsolution, as has at least out-neighbours in and . Similarly, we can try Algorithm 1 on with and . If the returned vertex set has size , then, because is a strong component with at least vertices, is a subsolution. Both cases can clearly be handled in polynomial time so we may assume that neither of these cases occur, implying that we must split in some way to obtain a (sub)solution.
Iteratively contract all trivial initial strong components into (iteratively these are the vertices with in-degree 0 in the current digraph, .) and call the resulting digraph for simplicity.
If is not an initial strong component of after this process, then there is a non-trivial strong component with a path into . Using Algorithm 1 on with and , we obtain a set , where because we started with a non-trivial strong component. We also have and thus has size , so is a subsolution which can be found in polynomial time. Hence we can assume that is an initial strong component after the contraction step.
Now, observe that any cycle in , small or large, that avoids at least vertices of , gives rise to a subsolution. Clearly, if such a cycle contains at least vertices, we immediately have a subsolution by taking an out-star consisting of and vertices from for and the vertices of for . If contains less than vertices, then we can grow it until it has vertices, which again leaves at least vertices for an out-branching from (we can just take an out-star from with leaves). Hence it suffices to show that such a cycle indeed exists.
We first check whether is acyclic. If this is not the case, then by the previous observation we have a subsolution and we are done. The same conclusion holds if there is a cycle in which contains only one vertex of (and the existence of such a cycle can easily be checked in polynomial time). Hence we may assume that every cycle in contains at least two vertices of .
To summarize the situation, these are some facts about the situation we are in:
is an initial strong component of .
has at least out-neighbours inside . We will denote this set of out-neighbours by for brevity.
Every cycle in contains at least two vertices of .
By definition of the arc set , for each vertex there exists a subdigraph of with and .
The objective is to show that there exists a cycle in that avoids at least vertices in
Let the digraph be obtained as follows, starting from a copy of : For each ordered pair , such that there is a path in where all for , we add the arc to , if it does not already exist. Note that, does not have parallel arcs. We use () to denote the out-degree (in-degree) of vertex in .
Let and note that since is strong it contains an -path . Let be those vertices on that are in , listed in the order in which they are visited by . By the construction of it contains the path in . Since were arbitrary vertices, it follows that is strong. With a similar argument and the fact that every cycle in contains at least two vertices of , we can conclude that every cycle in corresponds to a cycle in . We also have that a cycle in corresponds to a closed walk in , so a cycle in that avoids at least vertices in is verification that there exists a cycle in which avoids at least vertices in .
Let denote the girth of and let , where , . Now we apply Theorem 4 to (recall that this holds for both and ). If , then because we have . Otherwise, by Theorem 4, we have . If we make the following calculation.
implying that every shortest cycle in avoids at least out-neighbours of in . Clearly we can find a shortest cycle in polynomial time. Hence we may assume that . This implies that at least vertices have . Denote by the set of these vertices and let . Consider , it will consist of some vertex-disjoint induced paths (as , by the definition of ). Let denote the set of these paths. Clearly can be computed in polynomial time. Note that for each path , there is exactly one pair such that and are arcs in . Use to denote a path from to using the path .
Suppose first that there is a path with at least vertices. We claim that there must be a cycle in avoiding . Assume for the sake of contradiction that there is no such cycle. Then, because every vertex on has , every cycle in must contain the entire path . Thus removing any vertex of would destroy all cycles in and hence also in . But because was initial, this means no vertices in could be part of a subdigraph with , and as we are in a case where does not have subdigraph with and size at least , we get a contradiction to the definition of (since the arc is in ).
Suppose now that every path has less than vertices. Recall that we have at most vertices in . We can represent by a directed multigraph with vertex set and with the arcs where and . See Figure 2.
For two distinct vertices of , let
be the number of vertices in which lie on paths from to in . Note that
As there are at most vertices in , there are less than pairs. We also have that
So it follows from (2) that there must be a pair that has
Let denote the set of those paths that contribute to . Since each has , we have so if we choose as one of these that uses the fewest vertices, then we always avoid at least vertices in the union of the other paths in . Because is strong, there is also a path from to in and does not intersect any path in . Hence is a cycle that avoids at least vertices of .
In conclusion we have shown that if we are in Case (2.1), then in polynomial time we can find a cycle which avoids at least vertices of .
As there are out-neighbours of there must be at least strong components containing a neighbour of . From the definition of , we know that has a subdigraph with and at least vertices. We can build such a subdigraph that also leaves at least out-neighbours of for the out-branching as follows: Starting from an empty set , iteratively add the vertices of a non-trivial strong component of to and use Algorithm 1 on with and to grow it. We repeat until (when adding a non-trivial strong component we may exceed ).
As has an out-neighbour in at least strong components and at most strong components are added to during this construction, there are still at least strong components, containing a neighbour of , that can be used to form an out-tree from of size at least . So we can obtain a subsolution in polynomial time.
As we saw in Case 2, if a vertex has and every other vertex has in-degree at least 1, then we have a yes-instance. So the idea in this case is to start with and while contract a neighbour into and recompute and . If we reach before contracting times, then we backtrack and try contracting another neighbour in , until we have tried all possible out-trees with vertices from , similar to case 1. If we instead reach then the problem is reduced to case 2, and we have a yes-instance.
So we have shown how to find the correct answer in all cases. We also argued that it was possible in FPT time in every case. This concludes the proof.
From the proof in Case 2 we obtain the following.
Let be an instance of the --partition-problem, with . Let be defined as in the beginning of the proof of Theorem 5 and let . If there is a vertex with , then we can find a good 2-partition in polynomial time.
The --partition-problem is the analogoue of the --partition-problem where we want an in-branching in one set of the partition while the other induces a digraph of minimum out-degree at least 1. By considering the digraph that we obtain by reversing all arcs we see that the following holds.
The --partition-problem is FPT.
4 Remarks and open problems
If we relax the condition of having an out-branching to that of just being connected, we obtain the following problem.
Input: A digraph and natural numbers
Question: Is there a 2-partition of such that is connected, and for ?
 The --partition-problem (for fixed ) is NP-complete for general digraphs and polynomially solvable for strong digraphs.
The --partition-problem is FPT for digraphs with minimum in-degree at least 1.
First observe that if has minimum indegree at least 1 and are disjoint sets such that , is connected and , then we can easily extend this to a 2-partition of with , where is connected and . Hence it suffices to show that we can find a subsolution, if one exists, in FPT time. The proof of this is an easy modification of the proof of Theorem 5. We leave the details to the interested reader. ∎
The theorem also holds for the analogous --partition-problem, for digraphs with minimum out-degree at least 1.
-  J. Bang-Jensen, N. Cohen, and F. Havet. Finding good 2-partitions of digraphs II. Enumerable properties. Theor. Comput. Sci., 640:1–19, 2016.
-  J. Bang-Jensen and G. Gutin. Digraphs: Theory, Algorithms and Applications. Springer-Verlag, London, 2nd edition, 2009.
-  J. Bang-Jensen and F. Havet. Finding good 2-partitions of digraphs I. Hereditary properties. Theor. Comput. Sci., 636:85–94, 2016.
-  J. Bang-Jensen, K.V. Klinkby Knudsen, S. Saurabh, and M. Zehavi. The parameterized complexity landscape of finding 2-partitions of digraphs. Theor. Comput. Sci., 795:108–114, 2019.
-  J. Bensmail. On the complexity of partitioning a graph into a few connected subgraphs. J. Combin. Optim., 30:174–187, 2015.
-  D. Bokal, G. Fijavz, M. Juvan, P.M. Kayll, and B. Mohar. The circular chromatic number of a digraph. J. Graph Theory, 46(3):227–240, 2004.
-  T. Feder, P. Hell, and C.S. Subi. Complexity of acyclic colorings of graphs and digraphs with degree and girth constraints. CoRR, abs/1907.00061, 2019.
-  D. Kühn and D. Osthus. Partitions of graphs with high minimum degree or connectivity. J. Combin. Theory Ser. B, 88:29–43, 2003.
-  N. Lichiardopol. Vertex-disjoint subtournaments of prescribed minimum outdegree or minimum semidegree: Proof for tournaments of a conjecture of Stiebitz. Intern. J. Combin., Article ID 273416:1–9, 2012.
-  N. Misra, G. Philip, V. Raman, S. Saurabh, and S. Sikdar. FPT algorithms for connected feedback vertex set. J. Combin. Optim., 24:131–146, 2012.
-  J. Shen. On the girth of digraphs. Discrete Math., 211(1-3):167–181, 2000.
-  M. Stiebitz. Decomposition of graphs and digraphs. In KAM Series in Discrete Mathematics-Combinatorics-Operations Research-Optimization 95-309. Charles University Prague, 1995.
-  H. Suzuki, N. Takahashi, and T. Nishizeki. A linear algorithm for bipartion of biconnected graphs. Inform. Process. Lett., 33:227–231, 1990.
-  P. van’t Hof, D. Paulusma, and G.J. Woeginger. Partitioning graphs into connected parts. Theor. Comput. Sci., 410:4834–4843, 2009.