Computing directed Steiner path covers

In this article we consider the Directed Steiner Path Cover problem on directed co-graphs. Given a directed graph G=(V,E)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$G=(V,E)$$\end{document} and a set T⊆V\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$T \subseteq V$$\end{document} of so-called terminal vertices, the problem is to find a minimum number of vertex-disjoint simple directed paths, which contain all terminal vertices and a minimum number of non-terminal vertices (Steiner vertices). The primary minimization criteria is the number of paths. We show how to compute in linear time a minimum Steiner path cover for directed co-graphs. This leads to a linear time computation of an optimal directed Steiner path on directed co-graphs, if it exists. Since the Steiner path problem generalizes the Hamiltonian path problem, our results imply the first linear time algorithm for the directed Hamiltonian path problem on directed co-graphs. We also give binary integer programs for the (directed) Hamiltonian path problem, for the (directed) Steiner path problem, and for the (directed) Steiner path cover problem. These integer programs can be used to minimize change-over times in pick-and-place machines used by companies in electronic industry.


Introduction
For the well known Steiner tree problem there are efficient algorithms on special graph classes like series-parallel graphs [WC83], outerplanar graphs [WC82] and graphs of bounded tree-width [BCKN15,CMZ12].The class Steiner tree problem (CSP) is a generalization of the Steiner tree problem in which the vertices are partitioned into classes of terminals [RW90].The unit-weight version of CSP can be solved in linear time on co-graphs [WY95].
The Steiner path problem is a restriction of the Steiner tree problem such that the required terminal vertices lie on a path of minimum cost.It is also a generalization of the Hamiltonian path problem: If we choose each vertex as a terminal vertex, the Steiner path problem becomes the Hamiltonian path problem.The Euclidean bottleneck Steiner path problem was considered in [AACKS14] and a linear time solution for the Steiner path problem on trees was given in [MJV13].
While a Steiner tree always exists within connected graphs, it is not always possible to find a Steiner path, which motivates us to consider Steiner path cover problems.The Steiner path cover problem on interval graphs was considered in [CL18].
In this article we consider the directed Steiner path cover problem defined as follows.Let G be a directed graph on vertex set V (G) and edge set E(G) and let T ⊆ V (G) be a set of terminal vertices.Let c : E(G) → R ≥0 be a function that assigns a weight to each edge.A directed Steiner path cover for G is a set P of vertex-disjoint simple directed paths in G that contain all terminal vertices of T and possibly also some of the non-terminal (Steiner) vertices of V (G) − T .The size of a directed Steiner path cover is the number of its paths, i.e. the size is |P |, the cost is defined as the sum of weights of those edges used in the paths in a directed Steiner path cover of minimum size.

Name Directed Steiner Path Cover
Instance A directed graph G, a set of terminal vertices T ⊆ V (G), and edge weights c : E(G) → R ≥0 .Task Find a directed Steiner path cover P of minimum size for G that minimizes p∈P e∈p c(e).
To minimize only the sum of the edge weights makes no sense, because this sum becomes minimal, if each terminal vertex is chosen as path of length 0. So we primary have to demand that the number of paths should be minimal.
The directed Steiner path cover problem is NP-hard since it generalizes the directed Hamiltonian path problem.This motivates us to restrict the problem to special inputs.We consider a very natural class of inputs, which is defined as follows.Directed co-graphs (short for complement reducible graphs) can be generated from the single vertex graph by applying disjoint union, order composition and series composition [BdGR97].They also can be characterized by excluding eight forbidden induced sub-digraphs, see [CP06, Figure 2].
Directed co-graphs are exactly the digraphs of directed NLC-width 1 and a proper subset of the digraphs of directed clique-width at most 2 [BJG18,GWY16].Directed co-graphs are also interesting from an algorithmic point of view since several hard graph problems can be solved in polynomial time by dynamic programming along the tree structure of the input graph, see [BJM14, Gur17, GR18, GKR19a, GKR19b, GKR20, GKR21a, GKR21b].Moreover, directed co-graphs are very useful for the reconstruction of the evolutionary history of genes or species using genomic sequence data [HSW17, NEMM + 18].
For graphs where all edges have the same weight, the above definition of the directed Steiner path cover problem results in a minimum number of Steiner vertices.Graphs without edge weights can be considered as a special case of graphs with unit-edge weights.Since edge weights do not occur in co-graphs, we use the following problem definition.

Name Unit-Edge-Weight Directed Steiner Path Cover
Instance A directed graph G and a set of terminal vertices T ⊆ V (G).Task Find a directed Steiner path cover of minimum size for G such that the number of Steiner vertices is minimal.
In this paper we show how the value of a directed Steiner path cover of minimum size and cost for the disjoint union, order composition and series composition of two digraphs can be computed in linear time from the corresponding values of the involved digraphs.Therefore, we define a useful normal form for directed Steiner path covers in digraphs which are defined by the order composition or series composition of two digraphs.Further we give an algorithm which constructs a directed Steiner path cover of minimum size and cost for a directed co-graph in linear time.
The (unit-weight) directed Steiner tree problem is MSO 1 -definable by [GHK + 14, Proposition 4.14].But this does not hold for the directed Steiner path (cover) problem, since it is a generalization of the directed Hamiltonian path problem which is not MSO 1 -definable.Thus it is not possible to obtain our solutions for the directed Steiner path (cover) problem using the fact that directed cographs have bounded directed clique-width [GWY16] and the result from [GHK + 14] stating that all MSO 1 -definable digraph problems are fixed parameter tractable for the parameter directed cliquewidth.Since the Hamiltonian cycle problem is W[1]-hard parameterized by clique-width [FGLS10] it even follows that Hamiltonian path problem and thus the (directed) Steiner path (cover) problem are W[1]-hard when parameterized by (directed) clique-width.
We also give binary integer programs for the directed Hamiltonian path problem and for the directed Steiner path (cover) problem.These integer programs can be used to minimize change-over times in pick-and-place machines used in electronic industry.The problem of minimizing change-over times is introduced in section 4.

Name Directed Steiner Path
Instance A directed graph G, a set T ⊂ V (G) of terminal vertices, and a function c : that assigns each edge some weight.Task Find a directed Steiner path p in graph G that minimizes e∈p c(e).

Preliminaries
We consider the directed Steiner path cover problem on directed co-graphs, so we first recall the definition of directed co-graphs and we will consider a normal form of directed Steiner path covers.

Directed Co-Graphs
Directed co-graphs have been introduced by Bechet et al. in [BdGR97].
Definition 2.1 The class of directed co-graphs is recursively defined as follows.
(i) Every digraph on a single vertex ({v}, ∅), denoted by • v , is a directed co-graph.
and edge set E(A) ∪ E(B), (b) the order composition A ⊘ B, defined by their disjoint union plus all possible edges only directed from V (A) to V (B), and (c) the series composition A⊗B, defined by their disjoint union plus all possible edges between V (A) and V (B) in both directions, are directed co-graphs.
Every expression using these operations is called a directed co-expression.The recursive generation of a directed co-graph can be described by a tree structure, called directed co-tree.The leaves of the directed co-tree represent the vertices of the digraph and the inner vertices of the directed co-tree correspond to the operations applied on the subgraphs of G defined by the subtrees.For every directed co-graph one can construct a directed co-tree in linear time, see [CP06].
Directed co-graphs can also be characterized by excluding eight forbidden induced sub-digraphs, see [CP06, Figure 2] or Figure 1.
Next we define a normal form for directed Steiner path covers in digraphs which are defined by the order composition or series composition of two digraphs.

Normal Form for Directed Steiner Path Covers
Let G be a directed co-graph, let T ⊆ V (G) be a set of terminal vertices, and let C be a directed Steiner path cover for G with respect to T .Then s(C) denotes the number of Steiner vertices in the paths of C.

Lemma 2.2 Let C be a directed Steiner path cover for some directed co-graph
Then there is a directed Steiner path cover C ′ with respect to T which does not contain paths p and p ′ satisfying one of the structures (1)-( 4), such that |C| ≥ |C ′ | and s(C) ≥ s(C ′ ) applies.Let q 1 , . . ., q 4 denote sub-paths which may be empty.
1. p = (x, q 1 ) or p = (q 1 , x) where x ∈ T .Comment: No path starts or ends with a Steiner vertex.
2. p = (q 1 , u, x, v, q 2 ) where u ∈ V (A), v ∈ V (B), and x ∈ T .Comment: On a path, the neighbors u, v of a Steiner vertex x are both contained in the same digraph.
3. p = (q 1 , x), p ′ = (u, q 2 ), where x ∈ V (A), u ∈ V (B), p = p ′ .Comment: No path p ends in A, if there is a path p ′ = p that starts in B.
If G = A ⊗ B then cover C ′ also does not contain paths satisfying structures (5)-(8).
7. p = (x, q 1 ), p ′ = (q 2 , u, y, v, q 3 ), where x, y ∈ V (A), u, v ∈ V (B), and y ∈ T .Comment: If a path starts in A then there is no Steiner vertex in A with two neighbors on the path in B.
8. p = (x, q 1 ), p ′ = (q 2 , u, v, q 3 ), where x ∈ V (A) and u, v ∈ V (B).Comment: If a path starts in A, then no edge of B is contained in the cover.
Proof 1.If x is removed from p we get a cover with one Steiner vertex less than C.

If
x is removed from p, we get a cover with one Steiner vertex less than C.
3. We combine the paths to only one path (q 1 , x, u, q 2 ) and we get a cover with one path less than C.
4. Since G is a directed co-graph, the underlying undirected graph is a co-graph such that the path cannot include a P 4 , i.e. a simple path of 4 vertices, as induced subgraph.Thus, there must be at least one additional arc.If such an additional arc would shorten the Steiner path by skipping u, v or both then we remove u or v or both and take the shortcut for getting a cover C ′ .Additional arcs that do not shorten the path would create a forbidden induced subgraph from Figure 1 which is not possible.For details see Table 2.
5. The new paths are q 1 and (x, u.q 2 ).The cover C ′ is as good as C.
If p = p ′ , then we have to distinguish whether (u, v) ∈ q 1 , (u, v) ∈ q 2 , (x, y) ∈ q 3 , or (x, y) ∈ q 4 .We show how to handle the first case, the other three cases are similar.Let p = (q 3 , u, v, q 5 , b, a, q 6 , x, y, q 2 ), where b ∈ V (B) and a ∈ V (A).Then the new path in cover C ′ is (q 3 , u, a, q 6 , x, v, q 5 , b, y, q 2 ).Such vertices a and b must exist because v ∈ V (B) and x ∈ V (A), possibly it holds a = x or b = v.In any case cover C ′ is as good as C. 7. If p = p ′ , then q 1 and (q 2 , u, x, v, q 3 ) are the new paths in cover C ′ .If p = p ′ , i.e. q 1 = (q ′ 2 , u, y, v, q 3 ), where q ′ 2 is obtained from q 2 by removing x, then (q ′ 2 , u, x, v, q 3 ) is the new path in cover C ′ .The cover C ′ is as good as C. If p = p ′ , then the edge (a, b) is missing in the following figure.8.If p = p ′ , then q 1 and (q 2 , u, x, v, q 3 ) are the new paths in cover C ′ .If p = p ′ , i.e. q 1 = (q ′ 2 , u, v, q 3 ), where q ′ 2 is obtained from q 2 by removing x, then (q ′ 2 , u, x, v, q 3 ) is the new path in cover C ′ .The cover C ′ is as good as C. If p = p ′ , then the edge (a, b) is missing in the following figure.Since the hypothesis of Lemma 2.2 is symmetric in A and B, the statement of Lemma 2.2 is also valid for co-graphs G = A ⊗ B if A and B are switched.Definition 2.3 A directed Steiner path cover C for some directed co-graph G = A⊘B or G = A⊗B is said to be in normal form if none of the operations described in the proof of Lemma 2.2 is applicable.
In the following we assume that a directed Steiner path cover for some directed co-graph G = A ⊘ B or G = A ⊗ B is always in normal form, since the operations of the proof of Lemma 2.2 do not increase the number of paths or Steiner vertices of a cover.Lemma 2.2 implies the following theorem.

Theorem 2.4 For each directed co-graph G = A ⊗ B and set of terminal vertices T ⊆ V (G) any directed Steiner path cover C in normal form with respect to T does not contain an edge of digraph A, and no path in C starts or ends in digraph
Proof [by contradiction] Assume, the Steiner path cover C contains an edge of digraph A. Then by Lemma 2.2(5), all paths starts in digraph A. By Lemma 2.2(4), it holds that no Steiner vertex v of V (A) is contained in C, where the neighbors of v are both of digraph B. By Lemma 2.2 (1), (2), and (5), it holds that all vertices of V (B) from C are connected with a terminal vertex of Second, we have to show that no path in C starts or ends in digraph A. Assume on the contrary, that there is one path that starts in A. By Lemma 2.2(6), it holds that all paths start in A. Continuing as in the first case this leads to a contradiction.

Remark 2.5 For each directed co-graph G = A ⊘ B and set of terminal vertices T ⊆ V (G) any directed Steiner path cover C in normal form with respect to T it holds that each path that starts in A either remains in
Table 2: The leftmost column shows a graph with underlying undirected P 4 and at least one additional arc that do not shorten the path.The other columns shows the forbidden subgraphs that are contained in the leftmost graph depending on the edges of the P 4 .
3 Algorithms for the Directed Steiner Path Cover Problem

Computing the optimal number of paths
Let G be a directed co-graph and T ⊆ V (G) be a set of terminal vertices.We define p(G, T ) as the minimum number of paths within a Steiner path cover for G with respect to T .Further let s(G, T ) be the minimum number of Steiner vertices in a directed Steiner path cover of size p(G, T ) with respect to T .We do not specify set T if it is clear from the context which set is meant.
Lemma 3.1 Let A and B be two vertex-disjoint digraphs and let T A ⊆ V (A) and T B ⊆ V (B) be two sets of terminal vertices.Then the following equations hold true: 5. Similar to 4.
6. To see that p(A ⊘ B) ≤ p(A) applies, consider that we can append any path of A by any path of B, see Lemma 2.2(3).Since no edge between B and A is created, no path of B can be extended by a path of A.
We show that p(A ⊘ B) ≥ p(A) applies by an indirect proof.Assume a directed Steiner path cover C for A ⊘ B contains less than p(A) paths.The removal of all vertices of B from all paths in C gives a Steiner path cover of size |C| < p(A).
This shows the statements of the lemma.

Computing the optimal number of Steiner vertices
Remark 3.2 For two vertex-disjoint directed co-graphs A, B and two sets of terminal vertices , since the disjoint union does not create any new edges.
Remark 3.3 Let G = A ⊘ B be a directed co-graph, and let C be a directed Steiner path cover of G such that p = (q 1 , u 1 , x, q 2 , v 1 ) is a path in A, p 1 = (u 2 , q 3 ) and p 2 = (v 2 , q 4 ) are paths in B, all paths are vertex-disjoint paths in C, where x ∈ T , u 1 , u 2 , v 1 , v 2 ∈ T , and q 1 , . . ., q 4 are sub-paths.Then we can split p at vertex x into two paths, combine them with p 1 and p 2 to get (q 1 , u 1 , u 2 , q 3 ) and (q 2 , v 1 , v 2 , q 4 ) as new paths and we get a Steiner path cover without increasing the cost.If A and B are switched we get (u 2 , q 3 , q 1 , u 1 ) and (v 2 , q 4 , q 2 , v 1 ) as new paths and the statement also holds.
What follows is the central lemma of our work, the proof is by induction on the structure of the co-graph.

Lemma 3.4 For every directed co-graph G and every directed Steiner path cover C for G with respect to a set T ⊆ V (G) of terminal vertices it holds that p(G) + s(G) ≤ |C| + s(C).
Proof [by induction] The statement is obviously valid for all directed co-graphs which consist of only one vertex.Let us assume that the statement is valid for directed co-graphs of n vertices.Let A and B are vertex-disjoint directed co-graphs of at most n vertices each.
Disjoint union: Let G = A ⊕ B be a directed co-graph that consists of more than n vertices.By Lemma 3.1, and Remark 3.2, it holds that p(A ⊕ B) + s(A ⊕ B) = p(A) + p(B) + s(A) + s(B).By the induction hypothesis, it holds that p(A) where C |A denotes the cover C restricted to digraph A, i.e. the cover that results from C when all vertices of B are removed.Then the statement of the lemma follows.
Series composition: Let G = A ⊗ B be a directed co-graph that consists of more than n vertices.Without loss of generality, let The non-terminal vertices of A must be used to combine paths of the cover, thus the non-terminal vertices of A become Steiner vertices.c, d, e).The other vertex of A must be used to combine the remaining two paths to (a, f, c, d, e, g, u, v, w, x, y) which results in a cover for A ⊗ B that consists of one path but 3 Steiner vertices.For graph B the statement of Lemma 3.4 is not satisfied:

Order composition: Let
In the proof of Lemma 3.6 we use the statement of Lemma 3.4 to show that optimal solutions for directed co-graphs A and B can be combined to an optimal solution for A ⊘ B and A ⊗ B.

Remark 3.5 Let G be a directed co-graph and let C be a directed Steiner path cover for G with respect to some set of terminal vertices T ⊆ V (G). Then s(C) ≥ s(G) holds only if |C| = p(G). If |C| > p(G) then s(C) might be smaller than s(G).
Lemma 3.6 Let A and B be two vertex-disjoint digraphs, and let T A ⊆ V (A), T B ⊆ V (A) be sets of terminal vertices.Then the following equations applies: Let X(A) be the vertices of V (A) that are contained in the paths of an optimal cover C for A ⊗ B. Let D be the cover for B obtained by removing the vertices of X(A) from C. Then by Theorem 2.4 the following applies: Thus, we get: The implication follows since by Lemma 3.4 it holds s(D) + |D| ≥ s(B) + p(B).
4. Can be shown similar to the previous item.
5. To see that s(A ⊘ B) ≤ s(A) + s(B) applies, consider optimal covers C and D for A and B. We construct a cover E for A ⊘ B in such a way that any path of C is appended by a path of D, see Lemma 2.2(3).Since |E| = p(A ⊘ B) holds, we get s(A ⊘ B) ≤ s(E) = s(C) + s(D) = s(A) + s(B), because an optimal cover has at most as many Steiner vertices as a concrete cover.
To see that s(A⊘B) ≥ s(A)+s(B) applies consider an optimal cover C for A⊘B.Then it holds 6.We have to distinguish two cases.First, let s(A) > p(B) − p(A).
The This shows the statements of the lemma.
By Lemma 3.1 and 3.6, and since a directed co-tree can be computed in linear time from the input directed co-graph [CP06], we have shown the following result.

Theorem 3.7 The value of a directed Steiner path cover of minimum cost for a directed co-graph can be computed in linear time with respect to the size of the directed co-expression.
Lemma 3.4 allows us to minimize the following additional cost function.
Corollary 3.8 The value of a directed Steiner path cover C for a directed co-graph G such that |C| + s(C) is minimal can be computed in linear time with respect to the size of the directed coexpression.

Computing an Optimal Directed Steiner Path Cover
Now we want to give an algorithm to compute an optimal directed Steiner path cover for some given directed co-graph.The function SeriesComp, see Algorithm 1, returns an optimal Steiner path cover for some co-graph G = A ⊗ B, if some optimal covers C A for A and C B for B are given as parameter.Let Similar to function SeriesComp we introduce a function OrderComp, see algorithm 2, which returns an optimal directed Steiner path cover for some directed co-graph G = A ⊘ B, if some optimal covers for A and B are given as parameter.The function Concat(p, p ′ ) used in line 16 extends path p by adding path p ′ at its end.
Let G be a directed co-graph represented by its binary directed co-tree T (G).The function DirectedSteinerPathCover, see algorithm 3, recursively computes a directed Steiner path cover machine, that are used by u but not used by v.Those types, that are not used by u but are used by v have to be inserted in to the machine.Thus, the cost of change over is described by the hamming distance of u and v.

Integer Program
In the following we assume that a directed graph G = (V, E, c) is given, where V denotes the set of vertices, E denotes the set of edges, and c denotes a function that assigns the cost c(e) to edge e.We represent an undirected graph G ′ by a directed graph G in such a way that each edge e of G ′ is represented by two anti-parallel edges in G, and the weight of the new edges are equal to the weight of edge e.
Our integer program is based on the following idea.Choose a vertex as the first vertex on the path.This is typically an artificial vertex that represents the empty machine at the beginning of a day.The order of vertices on the path implies for two vertices u and v following immediately on the path, that the cost of edge (u, v) represents the change-over time.
Our integer program uses binary variables x[i, j], i, j ∈ [n], such that x[i, j] is equal to one, if and only if edge (i, j) is on the Hamiltonian path.We use integer valued variables p[i], i ∈ [n], such that p[i] = ℓ, if and only if vertex i is the ℓ-th vertex on the Hamiltonian path.
The first constraints ensure that the paths are all vertex-disjoint.The path leaves each vertex i at most once, and the path enters each vertex j at most once, which can be stated as follows.
The following constraints prevent loops over anti-parallel edges.If there are anti-parallel edges then choose at most one of them.This is ensured by the constraints: Each Hamiltonian path has length n − 1: With just this constraint on the number of edges, we may accept solutions that are not connected.It is still possible to have cycles and a path instead of one path only.The next constraints are used to avoid cycles.If edge (i, j) belongs to the path then p[j] − p[i] = 1 must hold true: The objective is to minimize the sum of the change-over times, i.e. to make the path length as small as possible, so we have to minimize the objective function as objective function to minimize the largest change-over time.

Experimental results
We ran the mixed integer program on CPLEX 12.8.0 using default settings on some standard PC with Intel i7, 2.80 GHz CPU and 16 GB RAM running Ubuntu 18.10.Running times to solve the Hamiltonian Path problem on randomly generated tournaments with randomly generated edge weights are shown in Table 3.The running times are average values over 10 runs.Bold numbers represent times when the time limit of 1800 seconds, which is equal to 30 minutes, was reached at least once and at most twice.It is well-known that any tournament on a finite number of vertices contains a Hamiltonian path.5 Steiner Path Problem

Integer Program
Here again, we assume that a directed graph G = (V, E, c) is given, where V denotes the set of vertices, E denotes the set of edges, and c denotes a function that assigns the cost c(e) to edge e.
We represent an undirected graph G ′ by a directed graph G in such a way that each edge e of G ′ is represented by two anti-parallel edges in G, and the weight of the new edges are equal to the weight of edge e.We use additional binary variables y[i], i ∈ [n], such that y[i] is equal to one, if and only if vertex i is contained in the path.These variables are only used to simplify the formulation of the following constraints 1 and 2. As in the last chapter, our integer program uses binary variables x[i, j], i, j ∈ [n], such that x[i, j] is equal to one, if and only if edge {i, j} is on the Steiner path.We use integer valued variables p[i], i ∈ [n], such that p[i] = ℓ, if and only if vertex i is the ℓ-th vertex on the Steiner path.Each terminal vertex i has to be contained in the path.
j] = 1 then i and j lie on the path, i.e. if x[i, j] = 1 then p[i] = 0 and p[j] = 0 which can be stated by the following constraints.
If there are anti-parallel edges then choose at most one of them.This is ensured by the constraint: The path has to contain one edge less than vertices. (i,j)∈E If p[i] = 0 then there has to be a x[i, j] = 1 or x[j, i] = 1.
For each vertex i ∈ V − T contained in the path we have one in-going and one outgoing edge. (i,j)∈E x[i, j] = y[i] ∀i ∈ V − T and The path leaves each vertex i ∈ T at most once and it enters each vertex j ∈ T at most once. (i,j)∈E x[i, j] ≤ 1 ∀i ∈ T and If a vertex is in the path then its position must be at least one.
Finally, to avoid cycles, if edge (i, j) belongs to the path then p[j] − p[i] = 1 must hold true: The objective is to minimize the sum of edge-weights (i,j)∈E c[i, j]•x[i, j].For unit-distance graphs this objective function results in a Steiner path with least number of Steiner vertices.

Experimental results
Running times to solve Steiner Path problems on complete bipartite graphs K n,3n for different values of n and t many randomly chosen terminal vertices are shown in Table 5.As long as at most n vertices from the second set are selected as terminal vertices, a Steiner path exists.The absence of such a path can be detected very quickly by the MIP as can be seen in the columns t = 2n.The running times are average values over 10 runs, bold numbers represent times when the time limit of 1800 seconds, which is equal to 30 minutes, was reached at least once and at most twice.Running times of more than 30 minutes are indicated by a bar −.The number of paths in the cover is equal to (s,v)∈E ′ x[s, v], and since there is at least one path in a Steiner Path Cover for G if T = ∅, the following conditions must hold true: Because we have inserted artificial vertices, the path leaves each terminal vertex i exactly once, and the path enters each terminal vertex j exactly once, which can be stated as follows.
(i,j)∈E ′ x[i, j] = 1 ∀i ∈ T and Since non-terminal vertices need not be contained in the path, the path leaves each non-terminal vertex i at most once, and the path enters each non-terminal vertex j at most once, which can be stated as follows. (i,j)∈E x[i, j] ≤ 1 ∀i ∈ V − T and The previous conditions also ensure that paths are vertex-disjoint.If a path contains a non-terminal vertex j then there has to be an edge that enters j and an edge that leaves j, which can be stated as: If there are anti-parallel edges then choose at most one of them.This is ensured by the constraint: Each terminal vertex i has to be contained in the path.
If x[i, j] = 1 then i and j lie on the path, i.e. if x[i, j] = 1 then p[i] = 0 and p[j] = 0 which can be stated by the following constraints. x Finally, to avoid cycles, if edge (i, j) belongs to the path then p[j] − p[i] = 1 must hold true: Minimizing an objective function like v∈T x[s, v] would only minimize the number of paths.If there are two different path covers of minimum size, we have to select that one with the least number of Steiner vertices.By our definition of the costs of the additional edges from s to terminal vertices we can choose the same objective function as above, when we also take care of the additional edges.The objective is to minimize the sum of edge-weights (i,j)∈E ′ c[i, j]•x[i, j].For unit-distance graphs this objective function results in a Steiner path cover P of minimum size, with least number of Steiner vertices p∈P e∈p c(e).

Experimental results
Running times to solve Steiner Path Cover problems on complete bipartite graphs K n,3n for different values of n and t many randomly chosen terminal vertices are shown in Table 6.The running times are average values over 10 runs.Running times of more than 30 minutes are indicated by a bar −, bold numbers represent times when the time limit was reached at least once and at most twice.Table 7 shows running times to solve Steiner Path Cover problems on randomly generated co-graphs with n vertices and t many randomly chosen terminal vertices.
The co-graphs will be generated recursively as shown in Algorithm 4. The probability p is set to be 1 /3 in our experiments.⊲ choose random number between l and r call oplus(l, m) with probability p, otherwise call otimes(l, m) call oplus(m+1, r) with probability p, otherwise call otimes(m+1, r) create edges (i, j) for all vertices l ≤ i ≤ m, and m + 1 ≤ j ≤ r function oplus(int l, int r) if r -l = 1 then return m := rand(l, r) call oplus(l, m) with probability p, otherwise call otimes(l, m) call oplus(m+1, r) with probability p, otherwise call otimes(m+1, r)

Conclusions and outlook
In this paper we considered the directed Steiner path cover problem for directed co-graphs.We could show a linear time solution for computing the minimum number of paths within a directed Steiner path cover and the minimum number of Steiner vertices in such a directed Steiner path cover in directed co-graphs.The results allowed us to give an algorithm which constructs a directed Steiner path cover of minimum cost for a directed co-graph in linear time.This leads to a linear time computation of an optimal directed Steiner path, if it exists, for directed co-graphs.
Undirected co-graphs are precisely those graphs which can be generated from the single vertex graph by disjoint union and join operations, see [CLSB81].Given some undirected co-graph G, we can solve the Steiner path cover problem in linear time by replacing every edge {u, v} of G by two directed edges (u, v) and (v, u) and applying our solution for directed co-graphs.This reproves our result of [GHK + 20b].
The directed Hamiltonian path problem can be solved by an XP-algorithm w.r.t. the parameter directed clique-width [GHO13].Since directed co-graphs have directed clique-width at most two [GWY16] a polynomial time solution for the directed Hamiltonian path problem follows.Such an algorithm is also given in [Gur17].Since a directed Hamiltonian path exists if and only if we have T = V (G) and p(G) = 1, our results imply the first linear time algorithm for the directed Hamiltonian path problem on directed co-graphs.This generalizes the known results for undirected co-graphs of Lin et al. [LOP95].
In our future work we want to find out whether results can be transferred to other graph classes such as chordal graphs, interval graphs, or distance-hereditary graphs.
2, 4 and 7 reduce the number of Steiner vertices by one, the remaining operations 3, 5 and 6 do not change the number of Steiner vertices.Therefore, operations 1, 2, 4 and 7 can only be executed at most |V − (T A ∪ T B )| times.Operation 6 reduces the number of paths by one, the remaining operations do not increase the number of paths.Therefore operation 6 can be executed at most max{|T A |, |T B |} times.Let us now consider those edges on a path that connect vertices of A and vertices of B. The maximum number of those edges is |V (A)| + |V (B)| − 1. Operation 7 can remove two such edges, operations 3 and 5 can add two such edges.Since the other operations 1, 2, 4 and 6 do not reduce the number of edges, operations 3 and 5 can be used at most (|V (A)|+|V (B)|−1)/2+|V −(T A ∪T B )| times.
A or it crosses over to B and remains in B. Each path that reaches a vertex of B has to stay in B since no edge from a vertex in B to a vertex in A exists.graph with underlying P 4 and additional

4.
We show that p(A ⊗ B) ≥ max{1, p(B) − |V (A)|} applies by an indirect proof.Assume a directed Steiner path cover C for A ⊗ B has less than max{1, p(B) − |V (A)|} paths.The removal of all vertices of A from all paths in C gives a directed Steiner path cover of size |C| + |V (A)| < p(B) for B. To see that p(A ⊗ B) ≤ max{1, p(B) − |V (A)|} applies, consider that we can use any vertex of A to combine two paths of the cover of B to one path, since the series composition of A and B creates all directed edges between A and B. If there are more terminal vertices in T A than there are paths in the cover of B, i.e. p(B) < |T A |, then we have to split paths of B and reconnect them by terminal vertices of T A .This can always be done since |T A | ≤ |T B |.
1. Let X(A) denote the vertices of A used in cover C, and let D denote the cover for B that we obtain by removing the vertices of X(A) from cover C. By the induction hypothesis, it holds that p(B) + s(B) ≤ |D| + s(D).

2.
Let nt(X(A)) denote the number of non-terminal vertices of X(A).By Theorem 2.4 it holds that s(C) = s(D) + nt(X(A)) and |C| = |D| − |T A | − nt(X(A)).Thus, we get |C| + s(C) = |D| + s(D) − |T A |.We put these two results together and obtain:p(B) + s(B) − |T A | ≤ |D| + s(D) − |T A | = |C| + s(C)To show the statement of the lemma, we first consider the case p(B) − 1 ≤ |V (A)|.Then it holds that p(A ⊗ B) = 1.If |T A | ≥ p(B) − 1, then d := |T A | − (p(B) − 1) many Steiner vertices from B, if available, can be replaced by terminal vertices from A. Otherwise if |T A | < p(B) − 1, then −d = (p(B) − 1) − |T A | many Steiner vertices from A are used to combine the paths.Thus, it holds that s(A⊗ B) ≤ max{0, s(B)− d} since the number of Steiner vertices in an optimal cover is at most the number of Steiner vertices in a certain cover.Thus, since p(A ⊗ B) = 1 we get for s(B) ≥ d: then all Steiner vertices of B can be replaced by terminal vertices of A and since |T A | ≤ |T B | holds, some of the paths of B can be reconnected by the remaining terminal vertices of A. Thus, p(A ⊗ B) + s(A ⊗ B) = 1 ≤ |C| + s(C) applies.Consider now the case where p(B) − 1 > |V (A)| holds, i.e. not all paths in an optimal cover for B can be combined by vertices of A. By Lemma 3.1, it holds that p(A ⊗ B) = max{1, p(B) − |V (A)|}.Thus, for p(A ⊗ B) > 1 we get:

Figure 1 :
Figure 1: Small example that shows the contrapositive of the statement of Lemma 3.4 in a graph B that is not directed co-graph.combine the path: {(u, f, a, b, c, w, x, y, g, e)} is an optimal cover for A ⊗ B with only one path and 2 Steiner vertices.The left Steiner path cover can not be extended to an optimal cover for A ⊗ B. For example, we can split path (a, b, c, d, e) at vertex b into two paths (a) and (c, d, e) and reconnect them by a vertex of A and get (a, f, c, d, e).The other vertex of A must be used to combine the remaining two paths to(a, f, c, d, e, g, u, v, w, x, y) which results in a cover for A ⊗ B that consists of one path but 3 Steiner vertices.For graph B the statement of Lemma 3.4 is not satisfied:p(B) + s(B) = 2 + 4 = 6 > |C r | + s(C r ) = 3 + 2 = 5In the proof of Lemma 3.6 we use the statement of Lemma 3.4 to show that optimal solutions for directed co-graphs A and B can be combined to an optimal solution for A ⊘ B and A ⊗ B.
7. s(A ⊘ B) = s(A) + s(B) − min{s(B), p(A) − p(B)} if p(A) > p(B) , we show s(A ⊗ B) ≤ max{0, s(B) + p(B) − p(A ⊗ B) − |T A |}.By Lemma 3.4, we know that s(A ⊗ B) + p(A ⊗ B) ≤ s(C) + |C| holds true for any cover C for co-graph A ⊗ B and any set of terminal vertices T .Consider cover C for A ⊗ B obtained by an optimal cover D for B in the following way: Use the terminal vertices of A to either combine paths of D or to remove a Steiner vertex of D by replacing v ∈ T by some terminal vertex of A in a path like (. . ., u, v, w, . ..) ∈ D, where u, w ∈ T .If |T A | ≥ s(B) + p(B) then all paths of D can be combined and all Steiner vertices can be removed by terminal vertices of A and since |T A | ≤ |T B | applies, some of the paths can be split and reconnected by the remaining terminal vertices of A. Thus, s(C) + |C| = 1 and s(A ⊗ B) = 0. Otherwise, if |T A | < s(B) + p(B), then we get s(C) + |C| = s(B) + p(B) − |T A |, and by Lemma 3.4, we get the statement.
To see that s(A ⊘ B) ≤ s(A) + s(B) − (p(B) − p(A)) applies, consider optimal covers C and D for A and B. We construct a cover E for A ⊘ B in such a way that we first split p(B) − p(A) many paths of C at Steiner vertices as described in Remark 3.3.Afterwards we put together each of the resulting paths by a path of D. Thus it holds |E| = p(A ⊘ B) = p(B) and therefore s(A ⊘ B) ≤ s(C) + s(D) − (p(B) − p(A)) = s(A) + s(B) − (p(B) − p(A)).Please note, a Steiner path cover C for A ⊘ B with s(C |A ) > 0 is not optimal if |C |A | < |C| = p(A ⊘ B) holds.By Remark 3.3 a path of C |A could be splitted at a Steiner vertex and the number of Steiner vertices could be reduced.To see that s(A ⊘ B) ≥ s(A) + s(B) − (p(B) − p(A)) applies, consider an optimal cover C for A ⊘ B. Then it holds s(A ⊘ B) = s(C) = s(C |A ) + s(C |B ), and by the previous note it holds |C| = p(A ⊘ B) = p(B) = |C |A |.By Lemma 3.4 we get s(C |A ) + |C |A | ≥ s(A) + p(A).If we sum up these equations we get s(A ⊘ B) + p(A ⊘ B) = s(C |A ) + |C |A | + s(C |B ).Finally we get: last step holds since p(B) = |C |B | and by Remark 3.5.Consider now the case that s(A) ≤ p(B) − p(A).To see that s(A ⊘ B) ≤ s(B) applies, consider optimal covers C and D for A and B. We construct a cover E for A ⊘ B in such a way that we first split as many paths of C at Steiner vertices as possible in a way described in Remark 3.3.Afterwards all Steiner vertices of C have been removed and we put together each of the resulting paths by a path of D. Thus it holds |E| = p(A ⊘ B) = p(B) and therefore s(A ⊘ B) ≤ s(E) = s(B).To see that s(A ⊘ B) ≥ s(B) applies, consider an optimal cover C for A ⊘ B. By the above note it holds s(C |A ) = 0, since C would not be optimal otherwise.Thus, we get s(A ⊘ B) = s(C |B ) ≥ s(B), since |C |B | = p(B) holds and by Remark 3.5.7. Can be shown similar to the previous item.
T A ⊆ V (A) and T B ⊆ V (B) be the sets of terminal vertices, and let |T A | ≤ |T B |.The function append(p, u) used in Algorithm 1 in lines 4, 5, and 7 appends path p by vertex u.The function Combine(p, p ′ , u) used in lines 14 and 20, combines path p and p ′ by vertex u.The function Replace(p, v, u) used in line 26 removes the vertex v from path p and replaces it by vertex u.The function Insert(p, v, u) used in line 29 inserts vertex u between vertex v and its successor in path p.

Figure 2 :
Figure 2: Graph modeling 4 boards.The dashed lines show a Hamiltonian path that defines an order in which the change-over times sum up to 9.

Figure 3 :
Figure 3: Graph extended by a source and a sink to compute an optimal Steiner Path Cover.
and c ′ (e) = c(e) for each e ∈ E and c ′ (e) = M if e = (s, v) or c = (v, t) for some v ∈ T .If graph G has no edge weights then c ′ (e) = 1 for each e Running times to solve Steiner Path Cover problems on complete bipartite graphs K n,3n for different values of n and t.

Table 3 :
Running times of MIP to calculate Hamiltonian Path on randomly generated tournaments.Running times to solve the Hamiltonian Path problem on complete bipartite graphs K n,m for different values of n and m are shown in Table4.The complete bipartite graph K n,m contains a Hamiltonian path if and only if |n−m| ≤ 1.The absence of such a path can be detected very quickly by the MIP as can be seen in the columns m = n + 2. All complete bipartite graphs are co-graphs so these results show that our algorithm with running time linear in the input size would be very much faster than the integer program.Running times of more than 30 minutes are indicated by a bar −.

Table 4 :
Running times of MIP to calculate Hamiltonian Path on complete bipartite graphs K n,m for different values of n and m.
is equal to one, if and only if vertex i is contained in the path.Binary variables x[i, j], i, j ∈ [n], are used such that x[i, j] is equal to one, if and only if edge {i, j} is on the Steiner path.We use integer valued variables p[i], i ∈ [n], such that p[i] = ℓ, if and only if vertex i is the ℓ-th vertex on the Steiner path.
∈ E, if G is an undirected graph we replace each edge {u, v} ∈ E by two anti-parallel edges (u, v) and (v, u).As in the last chapter, our integer program uses binary variables y[i], i ∈ [n], such that y[i]

Table 7 :
Running times to solve Steiner Path Cover problems on randomly generated co-graphs with n vertices and t many randomly chosen terminal vertices.