On the complexity of finding internally vertex-disjoint long directed paths

For two positive integers $k$ and $\ell$, a $(k \times \ell)$-spindle is the union of $k$ pairwise internally vertex-disjoint directed paths with $\ell$ arcs between two vertices $u$ and $v$. We are interested in the (parameterized) complexity of several problems consisting in deciding whether a given digraph contains a subdivision of a spindle, which generalize both the Maximum Flow and Longest Path problems. We obtain the following complexity dichotomy: for a fixed $\ell \geq 1$, finding the largest $k$ such that an input digraph $G$ contains a subdivision of a $(k \times \ell)$-spindle is polynomial-time solvable if $\ell \leq 3$, and NP-hard otherwise. We place special emphasis on finding spindles with exactly two paths and present FPT algorithms that are asymptotically optimal under the ETH. These algorithms are based on the technique of representative families in matroids, and use also color-coding as a subroutine. Finally, we study the case where the input graph is acyclic, and present several algorithmic and hardness results.


Introduction
A subdivision of a digraph F is a digraph obtained from F by replacing each arc (u, v) of F by a directed (u, v)-path. We are interested in the (parameterized) complexity of several problems consisting in deciding whether a given digraph contains as a subdigraph a subdivision of a spindle, defined as follows. For k positive integers 1 , . . . , k , a ( 1 , . . . , k )spindle is the digraph containing k paths P 1 , . . . , P k from a vertex u to a vertex v, such that |E(P i )| = i for 1 ≤ i ≤ k and V (P i ) ∩ V (P j ) = {u, v} for 1 ≤ i = j ≤ k. If i = for 1 ≤ i ≤ k, a ( 1 , . . . , k )-spindle is also called a (k × )-spindle. See Figure 1 for an example. Subdivisions of spindles were considered by Bang-Jensen et al. [3], who introduced the general problem of finding a subdivision of a fixed digraph F and presented NP-hardness results and polynomial-time algorithms for several choices of F . In particular, they proved that when F is a spindle, the problem can be solved in time n O(|V (F )|) by a simple combination of brute force and a flow algorithm. Using terminology from parameterized complexity, this means that the problem is in XP parameterized by the size of F , and they left open whether it is FPT. Note that on undirected graphs the notion of subdivision coincides with that of topological minor, hence by the results of Grohe et al. [16] the problem is FPT parameterized by the size of F , for a general digraph F . We refer to the introduction of [3] for a more detailed discussion about problems related to containment relations on graphs and digraphs.
We first consider the following two optimization problems about finding subdivisions of spindles: (1) for a fixed positive integer k, given an input digraph G, find the largest integer such that G contains a subdivision of a (k × )-spindle, and (2) for a fixed positive integer , given an input digraph G, find the largest integer k such that G contains a subdivision of a (k × )-spindle. We call these problems Max (k × •)-Spindle Subdivision and Max (• × )-Spindle Subdivision, respectively. We prove that the first problem is NP-hard for any integer k ≥ 1, by a simple reduction from Longest Path. The second problem turns out to be much more interesting, and we achieve the following dichotomy. The reduction for the NP-hard cases is inspired by a result of Brewster et al. [7] to prove the NP-hardness of packing vertex-disjoint paths on digraphs. Concerning the polynomial algorithms, to solve the case = 3, which is the only non-trivial one, we use a vertex splitting procedure that builds on ideas of Schrijver [27] on undirected graphs and by Kriesell [21] on directed graphs (see also [2,Section 5.9]).
It it worth mentioning that both the positive and negative results of Theorem 1 hold as well for the case where the endvertices of the desired spindle are fixed. Itai et al. [19] considered the problems of, given a digraph G and two distinct vertices s and t, finding the maximum number of internally vertex-disjoint (s, t)-paths whose lengths are at most or exactly equal to a fixed constant , and achieved dichotomies for both cases. Note that the problem we consider corresponds to a constraint of type 'at least' on the lengths of the desired paths. Hence, Theorem 1 together with the results of Itai et al. [19] provide a full picture of the complexity of finding a maximum number of length-constrained internally vertex-disjoint directed (s, t)-paths.
A and two computable functions f, g such that given an instance I = (x, k), A (called an XP algorithm) correctly decides whether I ∈ L in time bounded by f (k) · |I| g (k) .
Within parameterized problems, the class W[1] may be seen as the parameterized equivalent to the class NP of classical optimization problems. Without entering into details (see [10,12,13,25] for the formal definitions), a parameterized problem being W[1]-hard can be seen as a strong evidence that this problem is not FPT. The canonical example of W[1]-hard problem is Independent Set parameterized by the size of the solution. To transfer W[1]-hardness from one problem to another, one uses a parameterized reduction, which given an input I = (x, k) of the source problem, computes in time f (k) · |I| c , for some computable function f and a constant c, an equivalent instance I = (x , k ) of the target problem, such that k is bounded by a function depending only on k. An equivalent definition of W[1]-hard problem is any problem that admits a parameterized reduction from Independent Set parameterized by the size of the solution.

Matroids.
A pair M = (E, I), where E is a ground set and I is a family of subsets of E, is a matroid if it satisfies the following three axioms: The sets in I are called the independent sets of the matroid. An inclusion-wise maximal set of I is called a basis of the matroid. Using the third axiom, it is easy to show that all the bases of a matroid M have the same size, which is called the rank of M. A pair M = (E, I) over an n-element ground set E is called a uniform matroid if I = {A ⊆ E : |A| ≤ k} for some for constant k. For a broader overview on matroids, we refer to [26].
For a positive integer k, we denote by [k] the set of all integers i such that 1 ≤ i ≤ k. Throughout the article, unless stated otherwise, we let n denote the number of vertices of the input digraph of the problem under consideration.

Complexity dichotomy in terms of the length of the paths
In this section we focus on the two natural optimization versions of finding subdivisions of spindles mentioned in the introduction, namely Max (k × •)-Spindle Subdivision and Max (• × )-Spindle Subdivision.
It is easy to prove that the first problem is NP-hard for any integer k ≥ 1, by a simple reduction from Longest Path.

Proof.
We provide a polynomial reduction from the Longest Path problem on general digraphs, which is NP-hard as it generalizes Hamiltonian Path [15]. For k = 1, Max (k × •)-Spindle Subdivision is exactly the Longest Path problem, and the result follows. For k > 1, let G be an instance of Longest Path with n vertices, and we build an instance G of Max (k × •)-Spindle Subdivision as follows. We start with G and we add to it 2k − 2 new vertices s 1 , . . . , , we add an arc from every vertex of G to s i , and arc from t i to every vertex of G, and a path from s i to t i with n edges through n − 1 new vertices. This completes the construction of G . It is clear that the length of a longest path in G equals the largest integer k such that G contains a subdivision of a (k × )-spindle, concluding the proof.

XX:6
On the complexity of finding internally vertex-disjoint long directed paths We now present the complexity dichotomy for the second problem, in order to prove Theorem 1. We start with the hardness result. Theorem 6. Let ≥ 4 be a fixed integer. The Max (• × )-Spindle Subdivision problem is NP-hard, even when restricted to DAGs.

Proof.
We provide a polynomial reduction from 3-Dimensional Matching, which is NPhard [15]. In the 3-Dimensional Matching problem, we are given three sets A, B, C of the same size and a set of triples T ⊆ A × B × C. The objective is to decide whether there exists a set T ⊆ T of pairwise disjoint triples with |T | = |A|. Given an instance (A, B, C, T ) of 3-Dimensional Matching, with |A| = n and T = m, we construct an instance G of Max (• × )-Spindle Subdivision as follows. We first present the reduction for = 4, and then we explain how to modify it for a general > 4.
For every i ∈ [n], we add to G three vertices a i , b i , c i , corresponding to the elements in the sets A, B, C, respectively. Let H the digraph with vertices x 0 , x 1 , y 0 , y 1 , z 0 , z 1 , a, b, c and arcs (x 0 , x 1 ), (x 1 , a), (x 1 , y 0 ), (y 0 , y 1 ), (y 1 , b), (x 0 , z 0 ), (z 0 , z 1 ), (z 1 , c) (see Figure 2(a)). For every triple T ∈ T , with T = (a i , b j , c p ), we add to G a copy of H and we identify vertex a with a i , vertex b with b j , and vertex c with c p . Finally, we add a new vertex s that we connect to all other vertices introduced so far, and another vertex t to which we connect all other vertices introduced so far except s. The constructed digraph G is easily seen to be a DAG. Indeed, we can define a topological ordering of V (G) so that all arcs go from left to right as follows. We select s (resp. t) as the leftmost (resp. rightmost) vertex. We divide the remaining vertices of G into two blocks. On the right, we place all the vertices {a i , b i , c i : i ∈ [n]}, and we order them arbitrarily. On the left, we place the remaining vertices of G, which we also order arbitrarily, except that for every triple T ∈ T , we order the vertices in its copy of H, distinct from a, b, c, such that x 0 < x 1 < y 0 < y 1 < z 0 < z 1 holds. One can check that, with respect to this ordering, all the arcs of G go from left to right.
Note that |V (G)| = 3n + 6m + 2, and therefore the largest integer k for which G contains a subdivision of a (k × 4)-spindle is k * := n + 2m, as each path involved in such a spindle contains at least three vertices distinct from its endpoints. We claim that (A, B, C, T ) is a Yes-instance of 3-Dimensional Matching if and only if G contains a subdivision of a (k * × 4)-spindle.
Suppose first that (A, B, C, T ) is a Yes-instance, and let T ⊆ T be a solution. We proceed to define a set P of n + 2m vertex-disjoint 2-paths in G \ {s, t}, which together with s and t yield the desired spindle. For every T ∈ T , with T = (a i , b j , c p ), we add to P the three paths (x 0 , x 1 , a i ), (y 0 , y 1 , b j ), and (z 0 , z 1 , c p ) (see the thick arcs in Figure 2(b)). On the other hand, for every T ∈ T \ T , with T = (a i , b j , c p ), we add to P the two paths (x 1 , y 0 , y 1 ) and (x 0 , z 0 , z 1 ) (see the thick arcs in Figure 2(c)). Since T is a solution of 3-Dimensional Matching, it holds that |T | = n, and thus P = 3n + 2(m − n) = n + 2m, as required.
Conversely, suppose that G contains a subdivision of a (k * × 4)-spindle S. Since s and t are the only vertices in G with in-degree and out-degree at least k * , respectively, necessarily they are the endpoints of S. Since |V (G) \ {s, t}| = 3k * , it follows that S \ {s, t} consists of a collection P of k * vertex-disjoint 2-paths that covers all the vertices in V (G) \ {s, t}. Let H be the subdigraph in G associated with an arbitrary triple T ∈ T , and consider P ∩ H. By construction of H, it follows that if P ∩ H is not equal to one of the configurations corresponding to the thick arcs of Figure 2(b) or Figure 2(c), necessarily at least one vertex in V (H) would not be covered by P, a contradiction. Let T be the set of triples in T such that the corresponding gadget H intersects P as in Figure 2(b). It follows that 3|T | + 2(m − |T |) = |P| = k * = n + 2m, and therefore |T | = n. Since all the 2-paths in P associated with the triples in T are vertex-disjoint, we have that T is a collection of n pairwise disjoint triples, hence a solution of 3-Dimensional Matching.
For a general > 4, we define the digraph G in the same way, except that we subdivide the arcs outgoing from s exactly − 4 times. The rest of the proof is essentially the same, and the result follows.
We now turn to the cases that can be solved in polynomial time. We first need some ingredients to deal with the case = 3, which is the most interesting one. Let G be a digraph and let X and Y be two subsets of V (G). We say that a path P is directed from X to Y if P is a directed path with first vertex x and last vertex y such that x ∈ X and y ∈ Y . The path P is nontrivial if its endpoints are distinct.
The following proposition will be the key ingredient in the proof of Theorem 8. Its proof is inspired by similar constructions given by Schrijver [27] on undirected graphs and by Kriesell [21] on directed graphs, usually called vertex splitting procedure (see [2, Section 5.9]).

Proposition 7.
Let G be a digraph and let X and Y be two subsets of V (G). The maximum number of vertex-disjoint directed nontrivial paths from X to Y can be computed in polynomial time.
Proof. Let P be any collection of vertex-disjoint directed nontrivial paths from X to Y in G. We can rebuild each path in P so that it has no internal vertices in X ∪ Y . Therefore, we can assume G has no arcs to a vertex in X \ Y or from a vertex in Y \ X.
Let G be the undirected graph built from G as follows. The vertex set of G is obtained from V (G) by adding a copy v of each vertex v not in X ∪ Y . We build the edge set of G starting from the empty set as follows. Figure 3(a)-(b) for an example.
The thick edges define a matching of size five in G , corresponding to the two vertex-disjoint directed nontrivial paths (u1, v1, u3) and (u2, v3, u4) from X to Y in G.

XX:8
On the complexity of finding internally vertex-disjoint long directed paths Proof of the claim. Let P be a family of k vertex-disjoint directed nontrivial paths from X to Y in G. We may assume every path in P has no internal vertices in X ∪ Y . Let U be the subset of vertices of V (G) \ (X ∪ Y ) that are not in a path in P.
We build a matching M of G starting with M = {{u, u } : u ∈ U } as follows. For every Figure 3(c)). Note that M is indeed a matching, as vertices in X ∪ Y appear in at most one arc on a path in P. For a vertex v not in X ∪ Y , v appears at most once as an internal vertex in a path P of P. Therefore, it appears in exactly two arcs of P and exactly once in an arc to v and once in an arc from v.
We now claim that the number of Otherwise, v is an internal vertex of a path in P and is contained in two edges that saturate both v and v . To conclude, note that every path in P contains exactly two vertices in X ∪ Y , namely its endpoints, and, therefore, saturates exactly two Since |M | = k + |N |, H contains at least k components with more edges in M than in N . We claim that from these components we can obtain k vertex-disjoint nontrivial paths in G.
To prove this claim, let C be a component of H with more edges in M than in N . Since C has more edges in M , then it is a path alternating between edges of M and N that starts and ends with an edge of M , its endpoints are N -unsaturated and its internal vertices are N -saturated. Thus, the endpoints of C are its only vertices in X ∪ Y . Also note that if a vertex w of V (C) ∩ V (G) is not in X ∪ Y , then both w and w are in C and neither w nor w appear in any other component of H.
Let u and v be the endpoints of C and the set W of internal vertices of C that are also in V (G) be {w 1 , . . . , w }. Note that u = v as C contains at least one edge in M . If W = ∅, then uv is an edge of G and assume the edge {u, v} is directed in G from u to v. If W = ∅, then assume the transversal of C from u to v visits the vertices in the order u, w 1 , w 1 , w 2 , w 2 , . . . , w , w , v. In both cases, note that u, w 1 , . . . , w , v is the transversal of a directed path from u to v in G. Since G has no edge leaving a vertex of Y \ X and no edge going into a vertex of X \ Y , then u ∈ X and v ∈ Y .
Claim 1 tells us that we can obtain a maximum number of vertex-disjoint nontrivial paths from X to Y in G by finding a maximum matching in the graph G , which can be done in polynomial time [11]. The proposition follows.
We are now ready to prove the main algorithmic result of this section. Proof. If = 1, then the problem can be solved just by computing a maximum flow between every pair of vertices of the input digraph, which can be done in polynomial time [2]. If = 2, we use the same algorithm, except that for every pair of vertices we first delete all the arcs between them before computing a maximum flow, as the paths of length one are the only forbidden ones in a subdivision of a (k × 2)-spindle.
Let us now focus on the case = 3. We first guess a pair of vertices s and t of V (G) as candidates for being the tail and head of the desired spindle, respectively, and we delete the arcs between s and t, if any. The crucial observation is that the largest integer k such that G contains a (k × 3)-spindle having s and t as tail and head, respectively, equals the maximum number of vertex-disjoint directed nontrivial paths from N + (s) to N − (t) in the digraph G \ {s, t}. Now the result follows directly by applying the polynomial-time algorithm given by Proposition 7 with input graph G \ {s, t}, X = N + (s), and Y = N − (t).
We now prove a generalization of the result given in Theorem 8, but using a much more powerful tool. Namely, instead of reducing the problem to finding a matching of appropriate size in an auxiliary graph, as in the proof of Proposition 7, we use as a black box an algorithm of Lovász [22] to solve the matroid matching problem in polynomial time for linearly-represented matroids (see [26] for any missing definition about matroids). Let p be the number of arcs with tail s and head t. Note that if S exists, it can use at most min{p, k 1 } arcs between s and t. In fact, we can assume S uses exactly min{p, k 1 } arcs between s and t as, otherwise, there is a 1-path which was subdivided and can be changed to an unused arc from s to t. All other 1-paths of the spindle must have been subdivided and have length at least two in S. Therefore, S exists if and only if there is a ( 2 1 , . . . , 2

Theorem 9. Given a digraph G and three non-negative integers
For a non-negative integer r, let m r be the maximum number of nontrivial vertex-disjoint paths from X to Y such that at least r vertices of X ∩ Y are not used by these paths. We claim that S exists if and only if r + m r ≥ k 2 + k 3 for some integer r with 0 ≤ r ≤ min{k 2 , |X ∩ Y |}. If r + m r ≥ k 2 + k 3 , then we can find S by joining s and t to nontrivial paths from X to Y to find k 2 + k 3 − r paths of length at least three. The remaining paths are built as 2-paths through r vertices in X ∩ Y not used by the nontrivial paths. On the other hand, if S exists, let r be the number of its 2-paths which are not subdivided in G, and note that 0 ≤ r ≤ min{k 2 , |X ∩ Y |}. These r paths each contain s, t, and a vertex of X ∩ Y . The k 2 − r 2-paths which are subdivided in G have length at least 3 in G. Thus, by deleting s and t from S, we have We iterate on values of r with 0 ≤ r ≤ min{k 2 , |X ∩ Y |} to decide if S exists. We finish this proof by showing how to find the value of m r in polynomial time for a fixed integer r. Namely, we use the matroid matching algorithm of Lovász [22]. For a graph H and a linear matroid M over V (H), this algorithm finds in polynomial time a maximum matching in G whose saturated vertices form an independent set of M .
For the graph H above, we use the graph G built in Proposition 7. Recall that Claim 1 shows that a matching in H of size k + |V (G) \ (X ∪ Y )| exists if and only if there are k vertex-disjoint directed nontrivial paths from X to Y . Furthermore, it can be also proved that the saturated vertices in X ∪ Y by the matching correspond precisely to the endpoints C V I T 2 0 1 7 of the nontrivial paths from X to Y . The linear matroid M is such that a set of vertices of H is independent in M if it is disjoint from at least r vertices of X ∩ Y . To see that M is a linear matroid, note that M is the dual of the r-uniform matroid over X ∩ Y by extending its ground set to V (H) without changing the independent sets. Now, a matching in H of size k + |V (G) \ (X ∪ Y )| that is independent in M corresponds precisely to k vertex-disjoint directed nontrivial paths from X to Y that are disjoint from a set of r vertices of X ∩ Y , and the matroid matching algorithm [22] can find the value of m r .

Finding subdivisions of 2-spindles
In this section we focus on finding subdivisions of 2-spindles, and we prove Theorem 2 and Theorem 3. We prove the negative and the positive results of both theorems separately. Namely, we provide the hardness results in Section 4.1 and we focus on the FPT algorithms in Section 4.2.

Hardness results
We start by proving the NP-hardness results.

Proof.
For both problems, we present a reduction from the Directed Hamiltonian (s, t)-Path problem, which consists in, given a digraph G and two vertices s, t ⊆ V (G), deciding whether G has an (s, t)-path that is Hamiltonian. This problem is easily seen to be NPhard by a simple reduction from Directed Hamiltonian Cycle, which is known to be NP-hard [15]: given an instance G of Directed Hamiltonian Cycle, construct from G an instance G of Directed Hamiltonian (s, t)-Path by choosing an arbitrary vertex v ∈ V (G) and splitting it into two vertices s and t such that s (resp. t) is incident to exactly those arcs in G that were outgoing from (resp. incoming at) v.
We first prove the hardness of Max (•, •)-Spindle Subdivision. Given an instance G of Directed Hamiltonian (s, t)-Path, with |V (G)| = n, build an instance G of Max (•, •)-Spindle Subdivision as follows. Start from G, and delete all the arcs incoming at s or outgoing from t, if any. Finally, add a new vertex v and arcs (s, v) and (v, t). We claim that G has a Hamiltonian (s, t)-path if and only if G contains a subdivision of a ( 1 , 2 )spindle with min{ 1 , 2 } ≥ 1 and 1 + 2 = n + 1. Assume first that G has a Hamiltonian (s, t)-path P . Then G contains a (2, n − 1)-spindle defined by the 2-path (s, v, t) together with the Hamiltonian (s, t)-path P . Conversely, assume that G contains a subdivision S of a ( 1 , 2 )-spindle with min{ 1 , 2 } ≥ 1 and 1 + 2 = n + 1. Suppose that the newly added vertex v ∈ V (G ) does not belong to S, which implies that |V (S)| ≤ |V (G)| = n. Since a ( 1 , 2 )-spindle contains exactly 1 + 2 vertices, if follows that |V (S)| ≥ 1 + 2 = n + 1, a contradiction to the previous sentence. Therefore, v ∈ V (S) and so (s, v, t) is one of the two paths of S. Thus, the remaining path of S is an (s, t)-path of length n − 1 in G, that is, a Hamiltonian (s, t)-path in G.
We now prove the hardness of Max Björklund et al. [5] showed that assuming the Exponential Time Hypothesis 1 (ETH) of Impagliazzo et al. [18], the Directed Hamiltonian Cycle problem cannot be solved in time 2 o(n) . This result together with the proof of Proposition 10 directly imply the following two results assuming the ETH, claimed in Theorem 2 and Theorem 3, respectively. The first one is that, given a digraph G and a positive integer , the problem of deciding whether there exist two strictly positive integers 1 , 2 with 1 + 2 = such that G contains a subdivision of a ( 1 , 2 )-spindle cannot be solved in time 2 o( ) · n O(1) . The second one is that, given a digraph G and two integers 1 , 2 with 2 ≥ 1 ≥ 1, the problem of deciding whether G contains a subdivision of a ( 1 , 2 )-spindle cannot be solved in time 2 o( 2 ) · n O( 1 ) .
Concerning the existence of polynomial kernels, it is easy to prove that none of the above problems admits polynomial kernels unless NP ⊆ coNP/poly. Indeed, taking the disjoint union of t instances of any of these two problems defines a cross-composition, as defined by Bodlaender et al. [6], from the problem to itself, directly implying the desired results as both problems are NP-hard by Proposition 10. We refer to [6] for the missing definitions.

FPT algorithms
Our FPT algorithms for finding subdivisions of ( 1 , 2 )-spindles are based on the technique of representative families introduced by Monien [24]. We use the improved version of this technique recently presented by Fomin et al. [14] and, more precisely, our algorithms and notation are inspired by the ones for Long Directed Cycle given in [14]. We start with some definitions introduced from [14] that can also be found in [10].
Two independent sets A, B of a matroid M fit if A ∩ B = ∅ and A ∪ B is independent.
Definition 11. Let M be a matroid and A be a family of sets of size p in M. A subfamily A ⊆ A is said to q-represent A if for every set B of size q such that there is an A ∈ A that fits B, there is an A ∈ A that also fits B. If A q-represents A, we write A ⊆ q rep A.

Finding 2-spindles with large total size
We start with the algorithm to solve the problem of, given a digraph G and a positive integer , deciding whether there exist two strictly positive integers 1 , 2 with 1 + 2 = such that G contains a subdivision of a ( 1 , 2 )-spindle, running in time 2 O( ) · n O(1) . If a subdigraph S of G is a subdivision of a ( 1 , 2 )-spindle, with min{ 1 , 2 } ≥ 1 and 1 + 2 = , we say that S is a good spindle. We may assume that max{ 1 , 2 } ≥ 2, as otherwise the desired spindle is just an arc with multiplicity two, which can be detected in polynomial time by using a maximum flow algorithm.
The following simple observation, whose proof can be easily verified, will be crucially used by the algorithm that we propose in the sequel. See Figure 4 for an illustration.

Lemma 12. A digraph G has a good spindle if and only if there exist vertices
In the above lemma, note that if min{ 1 , 2 } = 1 then one of the paths P u 1 and P u 2 , say P u 1 , may be degenerate to vertex u, and in that case we have that u 1 = u.
u v The key idea is to compute efficiently a small family of subsets of V (G) that represents the above sets, which are too large for our purposes. More precisely, for every triple of vertices u, u 1 , u 2 ∈ V (G) and positive integers 1 , 2 , q with 1 , 2 ≤ and q ≤ 2 − ( 1 + 2 ), we will compute in time 2 O( ) · n O(1) a q-representative family As in [14], the matroid with respect to which we will define the above q-representative family S 1, 2,q u,u1,u2 is the uniform matroid with ground set V (G) and rank + q. We postpone the computation of the above q-representative families in time 2 O( ) · n O (1) to Section 4. 2.3, and assume now that we already have these families at hand. The following lemma states that they are enough to find the desired good spindle.

Lemma 13.
If G contains a good spindle, then there exist vertices u, u 1 , u 2 , v, integers 1 , 2 with min{ 1 , 2 } ≥ 1 and 1 + 2 = , a set S u ∈ S 1, 2 ,q u,u1,u2 with q ≤ − 1, a (u 1 , v)-path P v 1 , and a (u Proof. Let S be a good spindle in G with minimum number of vertices, which exists by hypothesis, and let u and v be the tail and the head of S, respectively. Let P u 1 = (u, . . . , u 1 ) and P u 2 = (u, . . . , u 2 ) be two subdipaths in S outgoing from u, on 1 and 2 vertices, respectively, with 1 + 2 = . Let also P v 1 = (u 1 , . . . , v) and P v 2 = (u 2 , . . . , v) be the two subdipaths in S from u 1 and u 2 to v, respectively (see Figure 4).
, and note that S u ∈ S 1 , 2 u,u1,u2 . In order to apply the properties of q-representative families, we define a vertex set B ⊆ V (S) as follows. If |V (S) \ S u | ≤ − 2, let B = V (S) \ S u . Otherwise, let B be the union of two subdipaths P B 1 = (v 1 , . . . , v) and Note that there may be several choices for the lengths of P B 1 and P B 2 , as far as their joint number of vertices is equal to − 1. Note also that P B 1 (resp. P B 2 ) is a subdipath of P v 1 (resp. P v 2 ). Let q = |B| ≤ − 1. Since S u ∈ S 1, 2 u,u1,u2 and S u ∩ B = ∅, by definition of q-representative family there exists S u ∈ S 1 , 2,q u,u1,u2 such that S u ∩B = ∅. We claim that S u ∩(V (P v 1 )∪V (P v 2 )) = {u 1 , u 2 }, which concludes the proof of the lemma. If |B| ≤ − 2, the claim follows easily as S u ∩ B = ∅ and B contains all the vertices in V (S) \ S u . Suppose henceforth that |B| ≥ − 1, and let P u 1 and P u 2 be the two paths in )) \ {u 1 , u 2 } = ∅, and we distinguish two cases. Suppose first that each of the paths P u 1 and P u 2 intersects exactly one of the paths P v 1 and P v 2 . By hypothesis, there exists a vertex w ∈ ( S u ∩ (V (P v 1 ) ∪ V (P v 2 ))) \ {u 1 , u 2 }, and suppose without loss of generality that w ∈ V ( P u 1 ) ∩ V (P v 1 ); see Figure 5(a) for an illustration. We define a good spindle S in G as follows. The tail and head of S are vertices u and v, respectively. The first path of S starts at u, follows P u 1 until its first intersection with P v 1 (vertex w in Figure 5(a)), which is distinct from u 1 by hypothesis, and then follows P v 1 until v. The second path of S starts at u, follows P u 2 until its first intersection with P v 2 , which may be vertex u 2 , and then follows P v 2 until v. Since |B| ≥ − 1 and each of P u 1 and P u 2 intersects exactly one of P v 1 and P v 2 , it follows that S is indeed a good spindle. On the other hand, since |V ( P u 1 ) ∪ V ( P u 2 )| = |V ((P u 1 ) ∪ V (P u 2 )| and vertex w comes strictly after u 1 in P v 1 , it follows that the first path of S is strictly shorter than the corresponding path of S, while the second one is not longer. Therefore, |V ( S)| < |V (S)|, a contradiction to the choice of S. Suppose now that one of the paths P u 1 and P u 2 , say P u 1 , intersects both P v 1 and P v 2 . Without loss of generality, suppose that, starting from u, P u 1 meets P v 1 before than P v 2 . Let w 1 and w 2 be vertices of P u 1 such that w 1 ∈ V (P v 1 ), w 2 ∈ V (P v 2 ), and there is no vertex of P u 1 between w 1 and w 2 that belongs to V (P v 1 ) ∪ V (P v 2 ); see Figure 5(b) for an illustration. We define a good spindle S in G as follows. The tail and head of S are vertices w 1 and v, respectively. The first path of S starts at w 1 and follows P v 1 until v. The second path of S starts at w 1 , follows P u 1 until w 2 , and then follows P v 2 until v. By the choice of w 1 and w 2 and since |B| ≥ − 1, it follows that S is indeed a good spindle. On the other hand, by construction |V ( S)| ≤ |V (S)| − |V ( P u 2 )| < |V (S)|, contradicting again the choice of S.
Wrapping up the algorithm. We finally have all the ingredients to describe our algorithm, which proceeds as follows. First, for every triple of vertices u, u 1 , u 2 ∈ V (G) and positive integers 1 , 2 , q with 1 , 2 ≤ and q ≤ 2 − ( 1 + 2 ), we compute, as explained in Section 4.2.3, a q-representative family S 1, 2 ,q u,u1,u2 ⊆ q rep S 1, 2 u,u1,u2 of size 2 O( ) in time 2 O( ) · n O(1) . Then the algorithm checks, for each u, u 1 , u 2 , v ∈ V (G), integers 1 , 2 , q with min{ 1 , 2 } ≥ 1, 1 + 2 = , and q ≤ − 1, and set S ∈ S 1, 2 ,q u,u1,u2 , whether G contains a (u 1 , v)-path P v 1 and a Note that the latter check can be easily performed in polynomial time by a flow algorithm [2]. The correctness of the algorithm follows directly from Lemma 12 and Lemma 13, and its running C V I T 2 0 1 7 XX:14 On the complexity of finding internally vertex-disjoint long directed paths (1) , as claimed. In order to keep the exposition as simple as possible, we did not focus on optimizing either the constants involved in the algorithm or the degree of the polynomial factor. Nevertheless, explicit small constants can be derived by carefully following the details in Fomin et al. [14].

Finding 2-spindles with two specified lengths
We now turn to the problem of finding 2-spindles with two specified lengths. Namely, given a digraph G and two integers 1 , 2 with 2 ≥ 1 ≥ 1, our objective is to decide whether G contains a subdivision of a ( 1 , 2 )-spindle in time 2 O( 2 ) · n O( 1) . Note that this problem differs from the one considered in Section 4.2.1, as now we specify both lengths of the desired spindle, instead of just its total size. Our approach is similar to the one presented in Section 4.2.1, although some more technical ingredients are needed, and we need to look at the problem from a slightly different point of view.
In this section, we say that a subdigraph S of G is a good spindle if it is a subdivision of a ( 1 , 2 )-spindle. We may again assume that max{ 1 , 2 } ≥ 2. The following lemma plays a similar role as Lemma 12, but now we will exploit the fact that our algorithm can afford to guess the first 1 vertices in the "short" path. Its proof is also easy to verify. See Figure 6 for an illustration. Figure 6 Illustration of the vertices and paths described in Lemma 14.

Lemma 14. A digraph G has a good spindle if and only if there exist vertices
The main difference with respect to Section 4.2.1 is that now we will only represent the candidates for the first 2 vertices of the "long" path, denoted by V (P u 2 ) in Lemma 14. To this end, we define, similarly to [14], the following set for every pair of vertices u, u ∈ V (G) and positive integer 2 : The above sets are exactly the same as those defined by Fomin et al. [14] to solve the Long Directed Cycle problem. Therefore, we can just apply [14,Lemma 5.2] and compute, for every pair of vertices u, u ∈ V (G) and positive integers 2 , q with q ≤ 1 + 2 ≤ 2 2 , a q-representative family . Now we would like to state the equivalent of Lemma 13 adapted to the new representative families. However, it turns out that the families P 2,q u,u are not yet enough in order to find the desired spindle. To circumvent this cul-de-sac, we use the following trick: we first try to find "short" spindles using the color-coding technique of Alon et al. [1], and if we do not succeed, we can guarantee that all good spindles have at least one "long" path. In this situation, we can prove that the families P 2,q u,u are indeed enough to find a good spindle. More precisely, a good spindle S is said to be short if both its paths have at most 2 2 vertices, and it is said to be long otherwise. Note that the following lemma only applies to digraphs without good short spindles.

Lemma 15.
Let G be a digraph containing no good short spindles. If G contains a good long spindle, then there exist vertices u, u , v, a (u, v)-path P 1 of length at least 1 , a (u, u )-path P u 2 on 2 vertices such that V ( P u 2 ) ∈ P 2,q u,u with q = 1 Proof. Let S be a good spindle in G with minimum number of vertices, which exists by hypothesis, and let u and v be the tail and the head of S, respectively. Let P 1 be the shortest of the two (u, v)-paths of S, and let u be the vertex on the other path of S at distance exactly 2 − 1 from u. Let P u 2 and P v 2 be the (u, u )-path and the (u , v)-path in S, respectively. Note that P u 2 ∈ P 2 u,u . Since by hypothesis S is along spindle, it follows that |V (P v 2 )| > 2 . Again, in order to apply the properties of q-representative families, we define a vertex set B ⊆ V (S) as follows, crucially using the hypothesis that S is a good long spindle. Namely, B contains the last 1 vertices of the path P 1 together with the last 2 vertices of the path P v 2 , including v. Note that |B| = 1 + 2 − 1 and that, since , which concludes the proof of the lemma. Assume for contradiction that (V ( P u 2 ) ∩ V (S)) \ V (P u 2 ) = ∅, and we again distinguish two cases. Suppose first that P u 2 is disjoint from P 1 , except for vertex u. Let w be the first vertex of P u 2 in V (P v 2 ) \ {u }; see Figure 7(a) for an illustration. We define a good spindle S in G as follows. The tail and head of S are vertices u and v, respectively. The first path of S is equal to P 1 . The second path of S starts at u, follows P u 2 until its first intersection with P v 1 (vertex w in Figure 7(a)), which is distinct from u 1 by hypothesis, and then follows P v 1 until v. By definition of B, it follows that S is a good spindle, and by construction |V ( S)| < |V (S)|, a contradiction to the choice of S.

Figure 7
Illustration of the two cases in the proof of Lemma 15. Suppose now that P u 2 intersects P 1 . Since P u 2 ends at vertex u / ∈ V (P 1 ), there exist vertices w 1 , w 2 such that w 1 ∈ V (P 1 ), , and there is no vertex of P u 1 between w 1 and w 2 that belongs to V (P 1 )∪V ( P u 2 )∪V (P v 2 ); see Figure 7(b) for an illustration. We define a good spindle S in G as follows. The tail and head of S are vertices w 1 and v, respectively. The first path of S starts at w 1 and follows P 1 until v. The second path of S C V I T 2 0 1 7 XX:16 On the complexity of finding internally vertex-disjoint long directed paths starts at w 1 , follows P u 2 until w 2 , and then follows P u 2 ∪ P v 2 until v. By the choices of B, w 1 , and w 2 , it follows that S is a good spindle with |V ( S)| < |V (S)|, contradicting again the choice of S.
Wrapping up the algorithm. We start by trying to find good small spindles. Namely, for every pair of integers 1 , 2 with 1 ≤ 1 ≤ 2 2 and 2 ≤ 2 ≤ 2 2 , we test whether G contains a ( 1 , 2 )-spindle as a subgraph, by using the color-coding technique of Alon et al. [1]. Since the treewidth of an undirected spindle is two, this procedure takes time 2 O( 2) · n O(1) .
If we succeed, the algorithm stops. Otherwise, we can guarantee that G does not contain any good short spindle, and therefore we are in position to apply Lemma 15. Before this, we first compute, for every pair of vertices u, u ∈ V (G) and positive integers 2 , q with Now, for each path P u 2 such that V ( P u 2 ) ∈ P 2,q u,u , with q = 1 + 2 − 1, we proceed as follows. By Lemma 14 and Lemma 15, it is enough to guess a vertex v ∈ V (G) and check whether G contains a (u, v)-path P 1 of length at least 1 , and a (u , v)-path P v 2 such that In order to do so, we apply brute force and we guess the first 1 vertices of P 1 in time n O( 1) . Let these vertices be u, u 2 , . . . , u 1 . All that remains is to test whether the graph G\{u 2 , . . . , u 1−1 }\(V ( P u 2 )\{u }) contains two internally vertex-disjoint paths from u 1 and u to u, which can be done in polynomial time by using a flow algorithm [2]. The correctness of the algorithm follows by the above discussion, and its running time is 2 O( 2 ) · n O( 1 ) , as claimed. Again, we did not focus on optimizing the constants involved in the algorithm.

Computing the representative families efficiently
We now explain how the representative families used in Sections 4.2.1 and 4.2.2 can be efficiently computed, by using the results of Fomin et al. [14]. As discussed in Section 4.2.2, the families P 2,q u,u are exactly the same as those used by Fomin et al. [14], so we can directly use [14,Lemma 5.2] and compute them in time 2 O( 2) · n O(1) . Let us now explain how the results of Fomin et al. [14] can be used to compute efficiently the families S 1, 2,q u,u1,u2 used in Section 4.2.1. We need the following lemma. (Fomin et al. [14]). Let M = (E, I) be a matroid a S be a family of subsets of

Lemma 16
The key observation is that the families S 1, 2 u,u1,u2 can be obtained by combining pairs of elements in the families P 2 u,u . More precisely, for every triple of vertices u, u 1 , u 2 and positive integers 1 , 2 , it holds that Note that in the above equation we do not have equality, as some pairs of paths in P 1 u,u1 and P 2 u,u2 , respectively, may intersect at other vertices distinct from u. By Lemma 16, if P 1 ,q u,u1 ⊆ q rep P 1 u,u1 and P 2 ,q u,u2 ⊆ q rep P 2 u,u2 , then To conclude, it just remains to observe that, by the definition of q-representative family, it holds that if M = (E, I) is a matroid, S is a family of subsets of E, S ⊆ S and S ⊆ q rep S, then S ⊆ q rep S as well.
Therefore, for every triple of vertices u, u 1 , u 2 and positive integers 1 , 2 with 1 , 2 ≤ , in order to compute a q-representative family for S 1 , 2 u,u1,u2 , we can just take the union of q-representative families for P 1 u,u1 and P 2 u,u2 , and these latter families can be computed in

5
Finding spindles on directed acyclic graphs In this section we focus on the case where the input digraph is acyclic. We start by proving Theorem 4. The proof uses classical dynamic programming along a topological ordering of the vertices of the input acyclic digraph.
Proof of Theorem 4. Given an acyclic digraph G and positive integers k, , recall that we want to prove that one can decide in time O( k · n 2k+1 ) whether G has a subdivision of a (k × )-spindle. For this, let H be obtained from the empty digraph by adding, for each vertex u ∈ V (G), vertices u + , u − and an arc (u + , u − ) between them, and adding arc (u − , v + ) for each arc (u, v) ∈ A(G). Note that H is also acyclic, and fix an arbitrary topological ordering of V (H). Proof of the claim. On the one hand, each path of a (k × )-spindle gives rise to a path in H of length at least 2 − 1, since each internal vertex of a path is split into two (these paths are actually vertex-disjoint). On the other hand, let P 1 , . . . , P k be arc-disjoint paths between x, y ∈ V (H), each of length at least 2 − 1. Since either |N + (z)| = 1 or |N − (z)| = 1 for every z ∈ V (H), and since P 1 , . . . , P k are arc-disjoint, we get that P 1 , . . . , P k are actually internally vertex-disjoint. Now, to obtain the desired (k × )-spindle, it suffices to observe that if u + ∈ V (P i ) \ {y}, for some u ∈ V (G) and some i ∈ {1, . . . , k}, then u − ∈ V (P i ).
We want to decide whether H has the desired paths. For each x ∈ V (H), we define the table P x with entries (e 1 , t 1 , . . . , e k , t k ), for each choice of at most k distinct arcs e 1 , . . . , e k (some of these may not exist, in which case we represent it by 'null'), and for each choice of k values t 1 , . . . , t k from the set {0, 1, . . . , 2 − 1}. Observe that P x has size (|A(H)| + 1) k · (2 ) k , which, since we need to analyze the table of each vertex, gives us the claimed complexity of the algorithm. The meaning of an entry is given below: P x (e 1 , t 1 , . . . , e k , t k ) = true if and only if there exist k arc-disjoint paths P 1 , . . . , P k starting at x and ending at e 1 , . . . , e k of length at least t 1 , . . . , t k , respectively.
Proof of the claim. Suppose first that P x (e 1 , t 1 , . . . , e k , t k ) = true, and let P 1 , . . . , P k be arc-disjoint paths starting at x and ending at e 1 , . . . , e k of length at least t 1 , . . . , t k , respectively. Let e be the arc preceding e i in path P i (e can denote the empty set when e i

Conclusions
We studied the complexity of several problems consisting in finding subdivisions of spindles on digraphs. For a general spindle F , we do not know if finding a subdivision of F is FPT on general digraphs parameterized by |V (F )|, although we believe that it is indeed the case. As a partial result, one could try to prove that, for a fixed value of ≥ 4, finding a subdivision of a (k × )-spindle is FPT parameterized by k (the problem is NP-hard by Theorem 1). The above question is open even if the input digraph is acyclic (note that Theorem 4 does not answer this question), or even if F is a 2-spindle. Concerning 2-spindles, one may try use the technique we used to prove Theorems 2 and 3, based on representative families in matroids. However, the technique does not seem to be easily applicable when the parameter is the total size of a prescribed 2-spindle. Namely, using the terminology from Section 4.2.2, the bottleneck is to find spindles that have one "short" and one "long" path. On the other hand, generalizing this technique to spindles with more than two paths seems pretty complicated.
Cai and Ye [8] recently studied the problem of finding two edge-disjoint paths on undirected graphs with length constraints between specified vertices. These length constraints can be an upper bound, a lower bound, or an equality on the lengths of each of the two desired paths, or no restriction at all, resulting in nine different problems. Interestingly, out of these nine problems, Cai and Ye [8] gave FPT algorithms for seven of them, and left open only the following two cases: when there is only one constraint of type 'at least', and when both constraints are of type 'at least'. Interestingly, this latter problem is closely related to finding a subdivision of a 2-spindle.
In general, very little is known about the complexity of finding subdivisions on digraphs. Bang-Jensen et al. [3] conjectured that, considering |V (F )| as a constant, the problem of finding a subdivision of F is either polynomial-time solvable or NP-complete. This conjecture is wide open. Recently, Havet et al. [17] studied the cases where |V (F )| = 4, and managed to classify all of them up to five exceptions. Even less is known about the parameterized complexity of the cases that are polynomial-time solvable for fixed F , that is, the cases in XP. In this article we focused on spindles, but there are other potential candidates such as, using the terminology of [3], windmills, palms, or antipaths.