The Steiner cycle and path cover problem on interval graphs

The Steiner path problem is a common generalization of the Steiner tree and the Hamiltonian path problem, in which we have to decide if for a given graph there exists a path visiting a fixed set of terminals. In the Steiner cycle problem we look for a cycle visiting all terminals instead of a path. The Steiner path cover problem is an optimization variant of the Steiner path problem generalizing the path cover problem, in which one has to cover all terminals with a minimum number of paths. We study those problems for the special class of interval graphs. We present linear time algorithms for both the Steiner path cover problem and the Steiner cycle problem on interval graphs given as endpoint sorted lists. The main contribution is a lemma showing that backward steps to non-Steiner intervals are never necessary. Furthermore, we show how to integrate this modification to the deferred-query technique of Chang et al. to obtain the linear running times.


Introduction
In this paper we investigate the Steiner cycle and Steiner path problem on interval graphs. To our knowledge, these problems have not been studied for this specific graph class. However, the Hamiltonian cycle and Hamiltonian path problem, which are special cases of the Steiner variants, are extensively studied for interval graphs and can be solved in linear time, if the intervals are given as an endpoint sorted list (Hung and Chang 2011;Keil 1985;Arikati and Rangan 1990;Manacher et al. 1990).
Steiner path problems have already been studied for other special graph classes, like trees (Moharana et al. 2013) and directed co-graphs (Gurski et al. 2020a, b). For the feasibility variant of the Steiner cycle problem, the so-called k-cycle problem an exact FPT algorithm has been obtained (Wahlström 2013). Also, the Steiner cycle polytope has been studied (Salazar-Gonzalez 2003) and approximation algorithms were studied (Steinová 2010). Steiner cycles have applications in the optimal design of reliable telecommunication and transportation networks (Steiglitz et al. 1969).
In this work we generalize the algorithms of Manacher et al. (1990) to the Steiner setting and obtain first linear time algorithms for the Steiner path cover and Steiner cycle problem on interval graphs. To obtain our results we extend the tools introduced in Hung and Chang (2011), and prove an elegant skipping lemma for the Steiner setting.

Definitions and preliminary results
As usual, we denote by G = (V , E) a graph, where V is the set of vertices and E is a set of pairs of vertices (two element sets of vertices), the edges. Given an interval i = [x, y] we denote the left endpoint x by l(i) = x and the right endpoint y by r(i) = y. Let I = (i 1 , i 2 , . . . , i n ) be a list or set of n intervals. We denote by G(I ) the interval graph of I . The vertices of G(I ) correspond to the intervals of I . Two intervals i, i ∈ I are connected by an edge in G(I ) if i = i and i ∩ i = ∅.
For an arbitrary graph G = (V , E) a list of vertices P = (v 1 , v 2 , . . . , v l ) is a (simple) path if those vertices are pairwise distinct and for each j = 1, 2, . . . , l − 1 it holds that {v j , v j+1 } ∈ E. The start of P is denoted by start(P) = v 1 and the end of P is denoted by end(P) = v l . We define rev(P) as the reverse path (v l , v l−1 , . . . , v 1 ) of P. If in addition {v l , v 1 } ∈ E holds, then we call P a (simple) cycle. For ease of writing we sometimes abuse notation and consider P as a set instead of a list, to allow for the use of set operations. Given two paths P and Q and a vertex v we also write (P, Q) for the concatenation of P and Q, and (P, v) for the concatenation of P and v.
Given a set S ⊆ V , a Steiner cycle is a cycle C in G such that S ⊆ C. A Steiner path cover of G is a set {P 1 , P 2 , . . . , P k } of pairwise disjoint paths in G such that S ⊆ k j=1 P j . The Steiner path cover number π S (G) is the the minimum cardinality of a Steiner path cover of G. If π S (G) = 1 we say that G has a Steiner path.
The following two results for general simple graphs are generalizations of two observations by Hung and Chang (2011).

Proposition 2.1 Let C be a cutset of G and g S the number of connected components
Proof Let (P 1 , P 2 , . . . , P k ) be a Steiner path cover of G. For every P j let g j be the number of components K of G − C with K ∩ S = ∅ and K ∩ P j = ∅. The P j must use at least g j − 1 distinct vertices from C to reconnect itself from those different components of G − C, i.e., |P j ∩ C| ≥ g j − 1. Now, since paths of a path cover are vertex disjoint, we have that |C| ≥ k j=1 (g j − 1). Finally, from the fact that k j=1 g j ≥ g S , we get k ≥ g S − |C|, which proves our claim.
Proposition 2.2 Let C be a cutset of G and g S the number of connected components K in G − C such that K ∩ S = ∅. If g S > |C|, then G has no Steiner cycle.
Proof A Steiner cycle needs to connect all components K of G − C with K ∩ S = ∅. For each such connection a distinct vertex from C has to be used. Since it is a cycle, it has to be closed, hence g S such connections are necessary. This implies that if g S > |C| no Steiner cycle can exist.
We use these results to solve the Steiner path cover problem (see Sect. 3) and the Steiner cycle problem (see Sect. 4) on interval graphs efficiently. Throughout the paper we assume that |S| is known to the algorithms and queries i ∈ S can be performed in O(1) time.

The Steiner path cover problem
We show that the basic greedy principle, that is at the core of efficient algorithms for the path cover problem on interval graphs, can be generalized by the introduction of neglectable intervals. But first we explain the basic greedy principle to find paths in interval graphs that was introduced independently by Manacher et al. (1990) and Arikati and Rangan (1990).
Given an endpoint sorted list of intervals we number those intervals as i 1 , i 2 , . . . , i n in increasing order with respect to their right endpoint, hence r (i j ) < r (i j+1 ) for all j = 1, 2, . . . , n − 1. (Such a numbering can be easily obtained in O(n) time using a list which is sorted by endpoints of the intervals and is assumed for the rest of this paper. W.l.o.g. we can assume that r (i j ) = r (i k ) for i = k. ) The algorithm iteratively constructs a path P. It starts with the path P := (i 1 ) containing only the first interval. Then in each iteration it extends P by the unique neighbor of end(P) which is not already contained in P with minimum right endpoint. If no such extension is possible the algorithm terminates with the current path P as an output. We denote this algorithm by GP and the path P obtained by this algorithm by GP(I ).
For a path P = GP(I ) = (v 1 , v 2 , . . . , v l ) obtained by executing the algorithm on an interval graph G(I ), we define L(P) as the set of intervals of P that exceed beyond the right endpoint of end(P), i.e. L(P) = {v ∈ P : r(v) > r(end(P))}. Now we can recursively define C(P), the set of covers of the path P, as follows. If L(P) = ∅, we set C(P) = ∅. Otherwise, let j be the maximum index such that v j ∈ L(P). We set

Fig. 1
An interval model I of twelve endpoint-sorted intervals (Hung and Chang 2011) For Manacher et al. (1990) proved that for each j = 0, 1, . . . , k it holds that P j is an island with respect to C(P) and if I \ P = ∅ also I \ P is an island with respect to C(P). Such a representation of P we call a decomposition into covers and islands.
The following property directly follow from the definition of a decomposition into covers and islands and are already essential in the proofs in Manacher et al. (1990).
is a decomposition into covers and islands, then it holds that L(P j ) = ∅ for each j = 0, 1, . . . , k.

Proof We prove this fact by induction on the number of covers
. . , c k , P k ) for k ≥ 1 its decomposition into covers and islands. By the definition of C(P) it holds that c k = v j for j the maximum index such that v j ∈ L(P). Hence, there exists no j > j such that r (v j ) > end(P) = end(P k ). This implies that L(P k ) = ∅. For all i < k it follows by induction that L(P i ) = ∅.
To illustrate the notions introduced above, consider the intervals in Fig. 1 given as a right endpoint-sorted list I = (i 1 , i 2 , . . . , i 12 ). Algorithm GP starts by setting P = (i 1 ). Neighbors of i 1 are {i 2 , i 4 , i 6 }, and since r(i 2 ) < min{r(i 4 ), r(i 6 )} we extend P by i 2 , i.e. P = (i 1 , i 2 ). Among neighbors of i 2 that are not already in P, i 3 has the smallest right endpoint, so P is extended to P = (i 1 , i 2 , i 3 ). Next candidates for the extension are {i 4 , i 6 } among which we chose i 4 , i.e. P = (i 1 , i 2 , i 3 , i 4 ). Next, the only possible extension is by i 6 , hence P = (i 1 , i 2 , i 3 , i 4 , i 6 ). Among the next candidates for extension {i 5 , i 10 }, interval i 5 is chosen. At this point the algorithm terminates and outputs P = (i 1 , i 2 , i 3 , i 4 , i 6 , i 5 ), since there is no neighbor of i 5 that is not already in P.
Now we find a decomposition into covers and islands of P. Since r(i 6 ) > r(end(P) = i 5 ), we have that L(P) = {i 6 }, and C(P) = {i 6 }∪C(P = (i 1 , i 2 , i 3 , i 4 )). L(P ) is the empty set, so the decomposition process is over and we have that the decomposition into covers and islands of P is given by C(P) = {i 6 } and P = (P 0 , i 6 , P 1 ), where P 0 = (i 1 , i 2 , i 3 , i 4 ) and P 1 = (i 5 ). Note that P 0 , P 1 and I \ P are islands with respect to C(P) = {i 6 }. Furthermore, note that our decomposition satisfies the properties in Proposition 3.1.
Given the fact that in the Steiner variant of the problem only the intervals in S have to be visited, we introduce neglectable intervals. Let P be the current path at any point of the greedy algorithm and v be the next extension. We call v neglectable with respect to end(P), if v / ∈ S and r(v ) < r(end(P)), i.e. end(P) ∈ L((P, v )). We modify the algorithm GP, such that it skips neglectable intervals with respect to the end of the current path. Analogously to GP this modification is denoted by GP S . Additional two distinctions of GP S are that it starts with the interval (with the smallest r(v)) that is in S, and it terminates as soon as there are no more uncovered intervals in S. We denote by N v the set of intervals that are not contained in GP S (I ) because they are neglectable with respect to v for some path P during the execution of GP S , where v = end(P). Let N be the set of all such neglectable intervals obtained during the entire run of GP S . Now we present a lemma which is our main tool for elegantly proving our main results.
Lemma 3.2 Let P = GP S (I ) be the path obtained by GP S for a given list of intervals I , let P = (P 0 , c 1 , P 1 , c 2 , . . . , P k−1 , c k , P k ) be its decomposition into covers and islands in G(I \ N ), and let C(P) = {c 1 , c 2 , . . . , c k }. Then it holds for all j = 0, 1, . . . , k that P j ∩ S = ∅, i.e. P j is an S-island with respect to C(P) in G(I \ N ). It even holds that P j ∪ N c j contains at least one S-island with respect to C(P) in G(I ).
Proof It is easy to see that this decomposition into covers and islands exists, since if P = GP S (I ) it follows by construction that P = GP(I \ N ).
The fact that P j is an S-island with respect to C(P) in G(I \ N ) is a trivial consequence of the decomposition into covers and islands and the definition of GP S . Since c j is used before every interval in N c j we have that the left endpoint of every interval in N c j is larger than the left endpoint of c j . The right endpoints of each of the intervals in N c j is smaller than the right endpoint of c j by definition of neglected intervals. But this directly implies that C(P) separates also N c j from the rest of G(I ), except for possibly P j . Now we can obtain an easy procedure to solve the Steiner path cover problem on interval graphs. We start with P = ∅ and apply the algorithm GP S . After termination let P = GP S (I ). We add P to our partial solution P and find the smallest index j such that i j ∈ S and i j is not in any path currently contained in P. Then we apply GP S again to the list of intervals i j , i j+1 , . . . , i n . We iterate like this until all intervals in S are covered by one of the paths in P. The algorithm terminates with the Steiner path cover P as its output.

Theorem 3.3 The Steiner path cover obtained by iterated application of GP S is optimal.
Proof Let P 1 , P 2 , . . . , P l be the paths obtained by the algorithm and C = l j=1 C(P j ) be the union of all the covers in the decomposition into covers and islands of each path. Then, by repeated application of Lemma 3.2 we obtain that there are l + |C | S-islands with respect to C in G(I ). By Proposition 2.1 we then know that π S (G(I )) ≥ l, so our solution is an optimal Steiner path cover.
To illustrate our algorithm for the Steiner path cover problem we again consider the example in Fig. 1. In the case when S = I , i.e., all intervals need to be covered, our algorithm runs GP S (I ) which outputs P = (i 1 , i 2 , i 3 , i 6 , i 5 ), and then it runs GP S (I \ P ) which outputs P = (i 7 , i 8 , i 9 , i 10 , i 12 , i 11 ), and the algorithm terminates. Therefore, for S = I we have that π S (I ) = 2. Now lets say that S = {i 2 , i 4 , i 6 , i 8 , i 10 , i 12 }. GP S (I ) starts with the element of S with the smallest right endpoint which is i 2 . Then it extends the path with i 3 , i 4 and then i 6 . After that, the algorithm neglects i 5 since r(i 5 ) < r(i 6 ) and i 5 / ∈ S. Next, the path is extended by i 10 , then i 7 is neglected, but i 8 is added to the path (since i 8 ∈ S). Then the path is extended by i 9 and finally by i 12 . Interval i 11 is neglected. The output of the algorithm is the path P = (i 2 , i 3 , i 4 , i 6 , i 10 , i 8 , i 9 , i 12 ), so π S (I ) = 1. Note that the key factor that allowed us to cover the set S with only one path is the fact that we could neglect i 5 .
By using the deferred-query approach by Chang et al. (1999) this algorithm can be implemented in O(n) time.

Theorem 3.4 The iterated application of GP S can be implemented in O(n) time, using the deferred-query approach.
Proof Firstly, we give a high-level explanation of how to implement GP S using the deferred-query technique. Afterwards we argue how the modifications can still be implemented in linear time.
In the deferred-query approach the algorithm handles the intervals in the given right endpoint sorted order one after another. For each j where i j−1 ∩ i j = ∅ the algorithm can be executed as stated above, since in this case we have that end(P) = i j−1 and we extend P with i j . The main difference is, that when i j−1 ∩ i j = ∅ we still have to process i j instantly. This is handled in the following way: The algorithm keeps at each time a collection of paths P 1 , . . . , P l and a flag that indicates whether P l already contains an interval from S. (For all other paths it is an invariant of the algorithm that they always contain an interval from S). In the beginning we have that l = 1 and P 1 = (i 1 ), where we assume that i 1 ∈ S. When handling i j we have the following case distinction.
(a) end(P l ) ∩ i j = ∅ and end(P k ) ∩ i j = ∅ for all k < l: in this case, if P l contains an interval from S we extend P l by i j , hence P l := (P l , i j ). Otherwise we set P l := (i j ). (b) There is a k < l such that end(P k ) ∩ i j = ∅: let k be minimum with this property.
Then also start(P k+1 ) ∩ i j = ∅ and hence we can connect P k and P k+1 using i j , hence the new collection of paths is P 1 , . . . , (P k , i j , P k+1 ), . . . , P l . If k + 1 = l and P l does not contain an interval from S we instead set the new collection of paths to P 1 , . . . , (P l−1 , i j ). (c) end(P l ) ∩ i j = ∅: In this case if P l contains an interval from S we add a new path P l+1 := (i j ), hence the new collection of paths is P 1 , P 2 , . . . , P l , P l+1 . Otherwise we replace P l := (i j ).
It is now easy to see that after termination this algorithm obtains exactly the set (P 1 , . . . , P l ) that is the output of iterating algorithm GP S . The main observation is that the intervals that are removed by the procedure above are either neglectable or are intervals not in S that are strictly between r(end(P k )) and l(start(P k+1 )) for some k = 1, . . . , l − 1. It remains to show that interval i j can be handled in O(1) time. This follows directly by the implementation based on static tree set union shown in by Chang et al. (1999), since the only difference is that in each step we have to do a case distinction for whether the current P l contains an interval from S. The operations performed then correspond to operations already performed by the original algorithm, and removing the current last path P l . This remove operation can obviously also be handled in constant time.

The Steiner cycle problem
Next we generalize the algorithm of Manacher et al. (1990) to solve the Steiner cycle problem on interval graphs. We first run our algorithm for the Steiner path cover problem (see Sect. 3). If π S > 1 we know that there cannot exist a Steiner cycle. Otherwise, let P = (v 1 , v 2 , . . . , v l ) be the obtained Steiner path in G(I ).
Based on P we construct two paths Q and R. We start by setting R := (v 1 ) and Q = (v 2 ). Then, we iteratively process the intervals v 3 to v l . If in the step of processing interval v j we have that end(Q) = v j−1 , we consider the following two cases. If v j ∩ end(R) = ∅, we extend R by v j , i.e. R = (R, v j ). Otherwise, we extend Q by v j , i.e. Q = (Q, v j ). If on the other hand in this step we have that end(R) = v j−1 we analogously check if v j ∩ end(Q) = ∅. If this is the case we extend Q by v j and if not we extend R by v j .
In the end of this process we try to connect R and rev(Q) to a Steiner cycle. To achieve this we check if end(Q) and end(R) are directly connected, i.e. end(Q) ∩ end(R) = ∅, or if there is an interval v among the intervals I ⊆ I \ P, whose right endpoints r(v ) > r(v l ) such that both end(Q) ∩ v = ∅ and end(R) ∩ v = ∅. In any of those two cases we can connect Q and rev(R) to a Steiner cycle. Otherwise, the algorithm returns that no Steiner cycle exists. Proof If the algorithm finds a Steiner cycle this is obviously true. Also, by correctness of the algorithm for the Steiner path cover (Theorem 3.3), if no Steiner path is found we correctly determine that no Steiner cycle can exist.
Otherwise, let us assume that the algorithm did not find a Steiner cycle. Without loss of generality, let end(R) = v h with h < l − 1 and consider the path P = (v 1 , v 2 , . . . , v h ) and its decomposition into covers and islands. Since R was not extended by any of the intervals v h+2 , v h+3 . . . , v l , we have that C(P ) ∪ {v h+1 } separates the islands of P from {v h+2 , v h+3 , . . . , v l }. In addition, since end(R) and end(Q) could not be connected with any interval in I , for all intervals v ∈ I it holds that l(v ) > r(v h ). Combining this with Proposition 3.1 we observe that {v h+2 , v h+3 , . . . , v l }∪ I is non-empty and an S-island with respect to C(P )∪{v h+1 }.
By Lemma 3.2 there are at least |C(P )|+1 S-islands with respect to C(P )∪{v h+1 }. So in total we have at least |C(P )| + 2 S-islands with respect to C(P ) ∪ {v h+1 }, hence by Proposition 2.2 there does not exist a Steiner cycle in G(I ).
Given a Steiner path P, the paths Q and R can be easily constructed in O(n) time. This gives a linear time algorithm for the Steiner cycle problem in interval graphs. Now we illustrate our algorithm for the Steiner cycle problem on interval graphs with the example given in Fig. 2. The given instance has 10 intervals I = First we run GP S (I ). It starts the path with i 2 and then extends it with i 3 and i 5 before neglecting i 4 . Then it proceeds by extending the path with i 6 , i 7 , finishing with i 8 . Hence it obtains the Steiner path P = (i 2 , i 3 , i 5 , i 6 , i 7 , i 8 ). In an attempt to create a Steiner cycle, we partition P into two paths R and Q. We initialize them with the first two intervals in P, that is, R = (i 2 ) and Q = (i 3 ). Now we consider Q to be the current path, and R to be the previous path. In each step we consider the next interval of P, and in the case that it intersect the end of the previous path, we extend the previous path and make it the current path. Otherwise we add the interval to the current path. So, interval i 5 is the next interval in P, and it does not intersect end(R) = i 2 , hence we add it to Q, making it Q = (i 3 , i 5 ). The next interval is i 6 , and it intersects end(R) = i 2 , hence we extend R and make it the current path, so R = (i 2 , i 6 ). Next interval i 7 does not intersect end(Q) = i 5 so we extend R again, making it R = (i 2 , i 6 , i 7 ). Finally, interval i 8 does not intersect end(Q) = i 5 so we extend R, making it R = (i 2 , i 6 , i 7 , i 8 ). This ends our partition of P with the resulting subpaths R = (i 2 , i 6 , i 7 , i 8 ) and Q = (i 3 , i 5 ). Since end(R) = i 8 and end(Q) = i 5 do not intersect, we cannot connect them into a cycle. The only remaining chance to do so is using an interval from I = {i ∈ I \ P : r(i) > r(end(P))} = {i 9 , i 10 }. Luckily, i 9 intersect both end(R) = i 8 and end(Q) = i 5 , and can be used to connect R and Q into a cycle. The Steiner cycle is then given by (R, i 9 , rev(Q)) = (i 2 , i 6 , i 7 , i 8 , i 9 , i 5 , i 3 ). Now let us consider a modified instance of Fig. 2, where i 4 is also an element of S. Then GP S (I ) would output the path P = (i 2 , i 3 , i 5 , i 4 , i 6 , i 7 , i 8 ), and the subsequent partition of P would give R = (i 2 , i 6 , i 7 , i 8 ) and Q = (i 3 , i 5 , i 4 ). But now there is no interval in I that connects end(R) = i 8 and end(Q) = i 4 , so our algorithm outputs that there is no Steiner cycle. In order to verify that there is no Steiner cycle we can follow the arguments in the proof of Theorem 4.1, which gives us a cutset C = {i 5 , i 6 } that separates I into three S-islands, and hence, by Proposition 2.2, guarantees that there is no Steiner cycle.

Conclusion
We obtained linear time algorithms for both the Steiner path cover problem and the Steiner cycle problem on interval graphs, assuming the intervals are given as a endpoint sorted list.
It would be of interest to study these problems also for other types of intersection graphs, like for instance circular-arc graphs, for which efficient algorithms for the path cover problem and the hamiltonian cycle problem are known.