Computing Directed Steiner Path Covers
Frank Gurski, Dominique Komander, Carolin Rehs, Jochen Rethmann, Egon Wanke
aa r X i v : . [ c s . D M ] D ec Computing Directed Steiner Path Covers ∗ Frank Gurski , Dominique Komander , Carolin Rehs , Jochen Rethmann , andEgon Wanke University of D¨usseldorf, Institute of Computer Science, 40225 D¨usseldorf, Germany Niederrhein University of Applied Sciences, Faculty of Electrical Engineering and Computer Science,47805 Krefeld, Germany
December 23, 2020
Abstract
In this article we consider the
Directed Steiner Path Cover problem on directed co-graphs. Given a directed graph G = ( V, E ) and a set T ⊆ V of so-called terminal vertices, theproblem is to find a minimum number of vertex-disjoint simple directed paths, which containall terminal vertices and a minimum number of non-terminal vertices (Steiner vertices). Theprimary minimization criteria is the number of paths. We show how to compute in linear timea minimum Steiner path cover for directed co-graphs. This leads to a linear time computationof an optimal directed Steiner path on directed co-graphs, if it exists. Since the Steiner pathproblem generalizes the Hamiltonian path problem, our results imply the first linear time algo-rithm for the directed Hamiltonian path problem on directed co-graphs. We also give binaryinteger programs for the (directed) Hamiltonian path problem, for the (directed) Steiner pathproblem, and for the (directed) Steiner path cover problem. These integer programs can beused to minimize change-over times in pick-and-place machines used by companies in electronicindustry. Keywords: binary integer program; combinatorial optimization; directed co-graphs; directedSteiner path cover problem; directed Steiner path problem; directed Hamiltonian path problem;pick-and-place machines
For the well known Steiner tree problem there are efficient algorithms on special graph classeslike 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 treeproblem in which the vertices are partitioned into classes of terminals [RW90]. The unit-weightversion 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 requiredterminal vertices lie on a path of minimum cost. It is also a generalization of the Hamiltonianpath problem: If we choose each vertex as a terminal vertex, the Steiner path problem becomesthe 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 aSteiner path, which motivates us to consider Steiner path cover problems. The Steiner path coverproblem 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 terminalvertices. Let c : E ( G ) → R ≥ be a function that assigns a weight to each edge. A directed Steinerpath cover for G is a set P of vertex-disjoint simple directed paths in G that contain all terminal ∗ A short version of this paper appeared in the Proceedings of the (SOFSEM 2020), see [GHK + T and possibly also some of the non-terminal (Steiner) vertices of V ( G ) − T . The size ofa directed Steiner path cover is the number of its paths, i.e. the size is | P | , the cost is defined as thesum 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 ≥ . Task
Find a directed Steiner path cover P of minimum size for G that minimizes P p ∈ 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 numberof paths should be minimal.The directed Steiner path cover problem is NP-hard since it generalizes the directed Hamiltonianpath problem. This motivates us to restrict the problem to special inputs. We consider a verynatural class of inputs, which is defined as follows. Directed co-graphs (short for complementreducible graphs) can be generated from the single vertex graph by applying disjoint union, ordercomposition and series composition [BdGR97]. They also can be characterized by excluding eightforbidden induced sub-digraphs, see [CP06, Figure 2].Directed co-graphs are exactly the digraphs of directed NLC-width 1 and a proper subset ofthe digraphs of directed clique-width at most 2 [BJG18, GWY16]. Directed co-graphs are alsointeresting from an algorithmic point of view since several hard graph problems can be solved inpolynomial 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 arevery useful for the reconstruction of the evolutionary history of genes or species using genomicsequence data [HSW17, NEMM + 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 Steinervertices is minimal.In this paper we show how the value of a directed Steiner path cover of minimum size and costfor the disjoint union, order composition and series composition of two digraphs can be computedin linear time from the corresponding values of the involved digraphs. Therefore, we define a usefulnormal form for directed Steiner path covers in digraphs which are defined by the order compositionor series composition of two digraphs. Further we give an algorithm which constructs a directedSteiner path cover of minimum size and cost for a directed co-graph in linear time.The (unit-weight) directed Steiner tree problem is MSO -definable by [GHK +
14, Proposition4.14]. But this does not hold for the directed Steiner path (cover) problem, since it is a generalizationof the directed Hamiltonian path problem which is not MSO -definable. Thus it is not possible toobtain our solutions for the directed Steiner path (cover) problem using the fact that directed co-graphs have bounded directed clique-width [GWY16] and the result from [GHK +
14] stating that allMSO -definable digraph problems are fixed parameter tractable for the parameter directed clique-width. 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) problemare W[1]-hard when parameterized by (directed) clique-width.We also give binary integer programs for the directed Hamiltonian path problem and for thedirected Steiner path (cover) problem. These integer programs can be used to minimize change-overtimes in pick-and-place machines used in electronic industry. The problem of minimizing change-overtimes 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 : E ( G ) → R ≥ that assigns each edge some weight. Task
Find a directed Steiner path p in graph G that minimizes P e ∈ p c ( e ).2 Preliminaries
We consider the directed Steiner path cover problem on directed co-graphs, so we first recall thedefinition of directed co-graphs and we will consider a normal form of directed Steiner path covers.
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 .(ii) If A , B are vertex-disjoint directed co-graphs, then(a) the disjoint union A ⊕ B , which is defined as the digraph with vertex set V ( A ) ∪ V ( B ) and edge set E ( A ) ∪ E ( B ) ,(b) the order composition A ⊘ B , defined by their disjoint union plus all possible edges onlydirected 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 genera-tion of a directed co-graph can be described by a tree structure, called directed co-tree . The leavesof the directed co-tree represent the vertices of the digraph and the inner vertices of the directedco-tree correspond to the operations applied on the subgraphs of G defined by the subtrees. Forevery 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. D D D D D D D D Table 1: The eight forbidden induced sub-digraphs for directed co-graphs (see [CP06]).Next we define a normal form for directed Steiner path covers in digraphs which are defined bythe order composition or series composition of two digraphs.
Let G be a directed co-graph, let T ⊆ V ( G ) be a set of terminal vertices, and let C be a directedSteiner path cover for G with respect to T . Then s ( C ) denotes the number of Steiner vertices inthe paths of C . Lemma 2.2
Let C be a directed Steiner path cover for some directed co-graph G = A ⊘ B or G = A ⊗ B with respect to a set T ⊆ V ( G ) of terminal vertices. Then there is a directed Steinerpath 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 , . . . , q denote sub-paths which maybe empty. . p = ( x, q ) or p = ( q , x ) where x T . Comment: No path starts or ends with a Steinervertex.2. p = ( q , u, x, v, q ) where u ∈ V ( A ) , v ∈ V ( B ) , and x T . Comment: On a path, theneighbors u, v of a Steiner vertex x are both contained in the same digraph.3. p = ( q , x ) , p ′ = ( u, q ) , 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 .4. p = ( . . . , x, u, v, y, . . . ) where u, v T . Comment: The paths contain no edge between twoSteiner vertices.If G = A ⊗ B then cover C ′ also does not contain paths satisfying structures (5)-(8).5. p = ( x, q ) , p ′ = ( u, q ) , where x ∈ V ( A ) , u ∈ V ( B ) , p = p ′ . Comment: All paths start in thesame digraph.6. p = ( q , x, y, q ) , p ′ = ( q , u, v, q ) where x, y ∈ V ( A ) , u, v ∈ V ( B ) . Comment: The cover C ′ contains edges of only one of the digraphs.7. p = ( x, q ) , p ′ = ( q , u, y, v, q ) , where x, y ∈ V ( A ) , u, v ∈ V ( B ) , and y T . Comment: If apath starts in A then there is no Steiner vertex in A with two neighbors on the path in B .8. p = ( x, q ) , p ′ = ( q , u, v, q ) , 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 .2. 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 , x, u, q ) and we get a cover with one path lessthan C .4. Since G is a directed co-graph, the underlying undirected graph is a co-graph such that thepath cannot include a P , i.e. a simple path of 4 vertices, as induced subgraph. Thus, theremust be at least one additional arc. If such an additional arc would shorten the Steiner pathby skipping u , v or both then we remove u or v or both and take the shortcut for gettinga cover C ′ . Additional arcs that do not shorten the path would create a forbidden inducedsubgraph from Figure 1 which is not possible. For details see Table 2.5. The new paths are q and ( x, u.q ). The cover C ′ is as good as C .6. If p = p ′ , then ( q , x, v, q ) and ( q , u, y, q ) are the paths in cover C ′ . u vx y u vx y If p = p ′ , then we have to distinguish whether ( u, v ) ∈ q , ( u, v ) ∈ q , ( x, y ) ∈ q , or( x, y ) ∈ q . We show how to handle the first case, the other three cases are similar. Let p = ( q , u, v, q , b, a, q , x, y, q ), where b ∈ V ( B ) and a ∈ V ( A ). Then the new path in cover C ′ is ( q , u, a, q , x, v, q , b, y, q ). 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 . x yb ba avu yx u v
4. If p = p ′ , then q and ( q , u, x, v, q ) are the new paths in cover C ′ . If p = p ′ , i.e. q =( q ′ , u, y, v, q ), where q ′ is obtained from q by removing x , then ( q ′ , u, x, v, q ) is the newpath in cover C ′ . The cover C ′ is as good as C . If p = p ′ , then the edge ( a, b ) is missing inthe following figure. u vabx u vab x
8. If p = p ′ , then q and ( q , u, x, v, q ) are the new paths in cover C ′ . If p = p ′ , i.e. q =( q ′ , u, v, q ), where q ′ is obtained from q by removing x , then ( q ′ , u, x, v, q ) is the new pathin cover C ′ . The cover C ′ is as good as C . If p = p ′ , then the edge ( a, b ) is missing in thefollowing figure. u vabx u vab x Operations 1, 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 onlybe executed at most | V − ( T A ∪ T B ) | times.Operation 6 reduces the number of paths by one, the remaining operations do not increase thenumber 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 . Themaximum 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 reducethe number of edges, operations 3 and 5 can be used at most ( | V ( A ) | + | V ( B ) |− / | V − ( T A ∪ T B ) | times. Since the hypothesis of Lemma 2.2 is symmetric in A and B , the statement of Lemma 2.2 is alsovalid 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 donot increase the number of paths or Steiner vertices of a cover. Lemma 2.2 implies the followingtheorem. Theorem 2.4
For each directed co-graph G = A ⊗ B and set of terminal vertices T ⊆ V ( G ) anydirected 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 A if | T A | < | T B | . Proof [by contradiction] Assume, the Steiner path cover C contains an edge of digraph A . Thenby 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 V ( A ),thus | T A | > | T B | . (cid:18) 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 ) anydirected Steiner path cover C in normal form with respect to T it holds that each path that starts in A either remains in 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. P and additional none a b c edges that do not shorten the path a , b a , c b , c a , b , c a b c1 2 3 4 D D D D { , , } { , , } { , , } { , , } D D D D { , , } { , , } { , , } { , , } a b c1 2 3 4 D D D D { , , } { , , } { , , } { , , } D D D D { , , } { , , } { , , } { , , } a b c1 2 3 4 D D D D { , , } { , , } { , , } { , , } D D D D { , , } { , , } { , , } { , , } a b c1 2 3 4 D D D D { , , } { , , } { , , } { , , } D D D D { , , } { , , } { , , } { , , , } a b c1 2 3 4 D D D D { , , } { , , } { , , } { , , } D D D D { , , } { , , } { , , } { , , } a b c1 2 3 4 D D D D { , , } { , , } { , , } { , , } D D D D { , , } { , , } { , , } { , , } a b c1 2 3 4 D D D D { , , } { , , } { , , } { , , } D D D D { , , } { , , } { , , } { , , } Table 2: The leftmost column shows a graph with underlying undirected P and at least one addi-tional arc that do not shorten the path. The other columns shows the forbidden subgraphs that arecontained in the leftmost graph depending on the edges of the P .6 Algorithms for the Directed Steiner Path Cover Problem
Let G be a directed co-graph and T ⊆ V ( G ) be a set of terminal vertices. We define p ( G, T ) as theminimum 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 ) withrespect 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 ) betwo sets of terminal vertices. Then the following equations hold true:1. p ( • v , ∅ ) = 0 and p ( • v , { v } ) = 1 p ( A ⊕ B, T A ∪ T B ) = p ( A, T A ) + p ( B, T B ) p ( A ⊗ B, ∅ ) = 0 p ( A ⊗ B, T A ∪ T B ) = max { , p ( B, T B ) − | V ( A ) |} if ≤ | T B | and | T A | ≤ | T B | p ( A ⊗ B, T A ∪ T B ) = max { , p ( A, T A ) − | V ( B ) |} if ≤ | T A | and | T A | > | T B | p ( A ⊘ B, T A ∪ T B ) = p ( A, T A ) if p ( A ) ≥ p ( B ) p ( A ⊘ B, T A ∪ T B ) = p ( B, T B ) if p ( A ) < p ( B ) Proof
1. - 3. Obvious.4. We show that p ( A ⊗ B ) ≥ max { , p ( B ) − | V ( A ) |} applies by an indirect proof. Assume adirected Steiner path cover C for A ⊗ B has less than max { , p ( B ) − | V ( A ) |} paths. Theremoval 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 . (cid:18) To see that p ( A ⊗ B ) ≤ max { , p ( B ) − | V ( A ) |} applies, consider that we can use any vertexof 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 andreconnect them by terminal vertices of T A . This can always be done since | T A | ≤ | T B | .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 pathof B , see Lemma 2.2(3). Since no edge between B and A is created, no path of B can beextended by a path of A .We show that p ( A ⊘ B ) ≥ p ( A ) applies by an indirect proof. Assume a directed Steiner pathcover C for A ⊘ B contains less than p ( A ) paths. The removal of all vertices of B from allpaths in C gives a Steiner path cover of size | C | < p ( A ). (cid:18)
7. Similar to 6.This shows the statements of the lemma. Remark 3.2
For two vertex-disjoint directed co-graphs A , B and two sets of terminal vertices T A ⊆ V ( A ) , T B ⊆ V ( B ) it holds that s ( A ⊕ B, T A ∪ T B ) = s ( A, T A ) + s ( B, T B ) , since the disjointunion 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 , u , x, q , v ) is a path in A , p = ( u , q ) and p = ( v , q ) are paths in B , allpaths are vertex-disjoint paths in C , where x T , u , u , v , v ∈ T , and q , . . . , q are sub-paths.Then we can split p at vertex x into two paths, combine them with p and p to get ( q , u , u , q ) and ( q , v , v , q ) as new paths and we get a Steiner path cover without increasing the cost. If A and B are switched we get ( u , q , q , u ) and ( v , q , q , v ) as new paths and the statement also holds. Lemma 3.4
For every directed co-graph G and every directed Steiner path cover C for G withrespect 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 ofonly 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. ByLemma 3.1, and Remark 3.2, it holds that p ( A ⊕ B ) + s ( A ⊕ B ) = p ( A ) + p ( B ) + s ( A ) + s ( B ). By theinduction hypothesis, it holds that p ( A ) + s ( A ) ≤ | C | A | + s ( C | A ) and p ( B ) + s ( B ) ≤ | C | B | + s ( C | B ),where C | A denotes the cover C restricted to digraph A , i.e. the cover that results from C when allvertices of B are removed. Then the statement of the lemma follows. p ( A ⊕ B ) + s ( A ⊕ B ) ≤ | C | A | + s ( C | A ) + | C | B | + s ( C | B ) = | C | + s ( C ) Series composition:
Let G = A ⊗ B be a directed co-graph that consists of more than n vertices.Without loss of generality, let | 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 weobtain by removing the vertices of X ( A ) from cover C . By the induction hypothesis, it holdsthat 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 holdsthat 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 ) − ≤ | V ( A ) | . Then it holdsthat 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 ) − − | T A | many Steiner vertices from A are used to combine the paths. Thus, it holdsthat s ( A ⊗ B ) ≤ max { , s ( B ) − d } since the number of Steiner vertices in an optimal cover is at mostthe number of Steiner vertices in a certain cover. Thus, since p ( A ⊗ B ) = 1 we get for s ( B ) ≥ d : p ( A ⊗ B ) + s ( A ⊗ B ) ≤ s ( B ) − d = 1 + s ( B ) − ( | T A | − ( p ( B ) − ✁ s ( B ) − | T A | + p ( B ) − ✁ ≤ | C | + s ( C )If 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 ) − > | 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 { , p ( B ) − | V ( A ) |} .Thus, for p ( A ⊗ B ) > p ( A ⊗ B ) + s ( A ⊗ B ) ≤ p ( B ) − | V ( A ) | + s ( B ) + nt ( A )= p ( B ) + s ( B ) − | T A | ≤ | C | + s ( C )The non-terminal vertices of A must be used to combine paths of the cover, thus the non-terminalvertices of A become Steiner vertices. Order composition:
Let G = A ⊘ B be a directed co-graph that consists of more than n vertices.By the induction hypothesis, it holds that p ( A ) + s ( A ) ≤ | C | A | + s ( C | A ) and p ( B ) + s ( B ) ≤| C | B | + s ( C | B ).Let us first consider the case p ( A ) > p ( B ). By Lemma 3.1 it holds p ( A ⊘ B ) = p ( A ). Wecan append any path of A by any path of B , and by Remark 3.3 it holds that for every path that8here is more in A than in B , a Steiner vertex of B can be removed. And since an optimal coverhas at most as many Steiner vertices as a concrete cover, it holds s ( A ⊘ B ) ≤ s ( C | A ) + s ( C | B ) − min { s ( C | B ) , | C | A | − | C | B |} . If we sum up both equations we get p ( A ⊘ B ) + s ( A ⊘ B ) ≤ p ( A ) + s ( C | A ) + s ( C | B ) − min { s ( C | B ) , | C | A | − | C | B |} If s ( C | B ) ≥ | C | A | − | C | B | applies, and since s ( C ) = s ( C | A ) + s ( C | B ) applies, we get p ( A ⊘ B ) + s ( A ⊘ B ) ≤ p ( A ) + s ( C ) − | C | A | + | C | B | . The statement would be shown if p ( A ) − | C | A | + | C | B | ≤ | C | would apply. It holds p ( A ) ≤ | C | A | ,since an optimal cover has at most as many paths as a concrete cover, and it holds | C | B | ≤ | C | ,since | C | = max {| C | A | , | C | B |} by Remark 2.5. We sum up these equations and we get p ( A ) + | C | B | ≤| C | A | + | C | , which is equivalent to p ( A ) − | C | A | + | C | B | ≤ | C | , thus p ( A ⊘ B ) + s ( A ⊘ B ) ≤ | C | + s ( C )has been shown.If s ( C | B ) < | C | A | − | C | B | , then it holds p ( A ⊘ B ) + s ( A ⊘ B ) ≤ p ( A ) + s ( C | A ), and we have toshow that p ( A ) + s ( C | A ) ≤ | C | + s ( C ) applies. It holds p ( A ) ≤ | C | A | , since an optimal cover has atmost as many paths as a concrete cover, and it holds | C | A | ≤ | C | , since | C | = max {| C | A | , | C | B |} byRemark 2.5. Furthermore, it holds s ( C | A ) ≤ s ( C ), since a part is only as big as the whole.The other case p ( A ) ≤ p ( B ) can be shown in a similar way. To see why Lemma 3.4 is crucial for the rest of this work, consider the directed graph B of Figure 1that is not a directed co-graph. Terminal vertices T A = { f, g } and T B = { a, c, e, u, w, x } are shownas squares. In the left part of the figure a Steiner path cover C ℓ = { ( a, b, c, d, e ) , ( u, v, w, x, y ) } forgraph B is shown with | C ℓ | = 2 and s ( C ℓ ) = 4 which is optimal. In the right part of the figurea Steiner path cover C r = { ( a, b, c, w, x, y ) , ( e ) , ( u ) } for B is shown with | C r | = 3 and s ( C r ) = 2.The right cover can be extended to an optimal cover for A ⊗ B if the vertices of A are used to BA a b c d eu v w x yf g BA f ga b c d eu v w x y
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 pathand 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 tocombine 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 notsatisfied: 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 solutionsfor 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 withrespect 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 setsof terminal vertices. Then the following equations applies:1. s ( • v , ∅ ) = 0 and s ( • v , { v } ) = 0 s ( A ⊕ B, T A ∪ T B ) = s ( A, T A ) + s ( B, T B ) 9 . s ( A ⊗ B ) = max { , s ( B ) + p ( B ) − p ( A ⊗ B ) − | T A |} if | T A | ≤ | T B | s ( A ⊗ B ) = max { , s ( A ) + p ( A ) − p ( A ⊗ B ) − | T B |} if | T A | > | T B | s ( A ⊘ B ) = s ( A ) + s ( B ) if p ( A ) = p ( B ) s ( A ⊘ B ) = s ( A ) + s ( B ) − min { s ( A ) , p ( B ) − p ( A ) } if p ( A ) < p ( B ) s ( A ⊘ B ) = s ( A ) + s ( B ) − min { s ( B ) , p ( A ) − p ( B ) } if p ( A ) > p ( B ) Proof
1. Obvious.2. See Remark 3.23. First, we show s ( A ⊗ B ) ≤ max { , 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 obtainedby an optimal cover D for B in the following way: Use the terminal vertices of A to eithercombine paths of D or to remove a Steiner vertex of D by replacing v T by some terminalvertex of A in a path like ( . . . , u, v, w, . . . ) ∈ D , where u, w ∈ T . If | T A | ≥ s ( B ) + p ( B ) thenall paths of D can be combined and all Steiner vertices can be removed by terminal verticesof A and since | T A | ≤ | T B | applies, some of the paths can be split and reconnected by theremaining 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 Lemma3.4, we get the statement. s ( A ⊗ B ) + p ( A ⊗ B ) ≤ s ( B ) + p ( B ) − | T A | = s ( C ) + | C |⇐⇒ s ( A ⊗ B ) ≤ s ( B ) + p ( B ) − p ( A ⊗ B ) − | T A | We prove now that s ( A ⊗ B ) ≥ max { , s ( B ) + p ( B ) − p ( A ⊗ B ) − | T A |} .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 . Thenby Theorem 2.4 the following applies: | X ( A ) | = nt ( X ( A )) + | T A | = | D | − p ( A ⊗ B ) ⇐⇒ nt ( X ( A )) = | D | − p ( A ⊗ B ) − | T A | Thus, we get: s ( A ⊗ B ) − nt ( X ( A )) = s ( D ) = s ( A ⊗ B ) − | D | + p ( A ⊗ B ) + | T A |⇐⇒ s ( A ⊗ B ) = s ( D ) + | D | − p ( A ⊗ B ) − | T A |⇒ s ( A ⊗ B ) ≥ s ( B ) + p ( B ) − p ( A ⊗ B ) − | T A | 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 concretecover.To see that s ( A ⊘ B ) ≥ s ( A )+ s ( B ) applies consider an optimal cover C for A ⊘ B . Then it holds s ( A ⊘ B ) = s ( C | A ) + s ( C | B ) ≥ s ( A ) + s ( B ), since | C | A | = p ( A ) = p ( A ⊘ B ) = p ( B ) = | C | B | .6. We have to distinguish two cases. First, let s ( A ) > p ( B ) − p ( A ).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 together10ach 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 ) > | C | A | < | C | = p ( A ⊘ B ) holds. By Remark 3.3 a path of C | A could be splitted at a Steiner vertex and thenumber 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 wesum up these equations we get s ( A ⊘ B ) + p ( A ⊘ B ) = s ( C | A ) + | C | A | + s ( C | B ). Finally weget: s ( A ⊘ B ) = s ( C | A ) + | C | A | − p ( A ⊘ B ) + s ( C | B ) ≥ s ( A ) + p ( A ) − p ( B ) + s ( C | B ) ≥ s ( A ) + p ( A ) − p ( B ) + s ( B )The 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 away that we first split as many paths of C at Steiner vertices as possible in a way described inRemark 3.3. Afterwards all Steiner vertices of C have been removed and we put together eachof 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 theabove 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.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 theinput 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-graphcan 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 co-expression. Now we want to give an algorithm to compute an optimal directed Steiner path cover for some givendirected co-graph. The function
SeriesComp , see Algorithm 1, returns an optimal Steiner pathcover for some co-graph G = A ⊗ B , if some optimal covers C A for A and C B for B are given asparameter. Let 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 . Thefunction 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 successorin path p .Similar to function SeriesComp we introduce a function
OrderComp , see algorithm 2, whichreturns an optimal directed Steiner path cover for some directed co-graph G = A ⊘ B , if someoptimal covers for A and B are given as parameter. The function Concat ( p, p ′ ) used in line 16extends 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 cover11 lgorithm 1
SeriesComp (set A , Cover C A , set B , Cover C B ) if | T A | = | T B | or | T A | = | T B | − then ⊲ results in only one path2: let T ′ A := T A ; let T ′ B := T B ; let p := ();3: while T ′ A = ∅ do
4: let b ∈ T ′ B ; T ′ B := T ′ B − { b } ; Append ( p , b );5: let a ∈ T ′ A ; T ′ A := T ′ A − { a } ; Append ( p , a );6: if T ′ B = ∅ then
7: let b ∈ T ′ B ; T ′ B := T ′ B − { b } ; Append ( p , b )8: return { p }
9: let T ′ A := T A ; let C ′ B := C B ;10: let p ∈ C ′ B ; C ′ B := C ′ B − { p } ;11: while T ′ A = ∅ and C ′ B = ∅ do ⊲ combine 2 paths by a terminal vertex of A
12: let a ∈ T ′ A ; T ′ A := T ′ A − { a } ;13: let p ′ ∈ C ′ B ; C ′ B := C ′ B − { p ′ } ;14: Combine ( p , p ′ , a );15: if T ′ A = ∅ then
16: let U := V ( A ) − T A ; ⊲ U is the set of non-terminal vertices of A while U = ∅ and C ′ B = ∅ do ⊲ combine 2 paths by a non-terminal vertex of A
18: let u ∈ U ; U := U − { u } ;19: let p ′ ∈ C ′ B ; C ′ B := C ′ B − { p ′ } ;20: Combine ( p , p ′ , u )21: return { p } ∪ C ′ B if C ′ B = ∅ then while T A = ∅ do
24: let a ∈ T ′ A ; T ′ A := T ′ A − { a } ;25: if ∃ Steiner vertex v in path p then Replace ( p , v , a ) ⊲ remove a Steiner vertex from B else
28: let { u, v } be an edge between to terminal vertices of B Insert ( p , v , a ) ⊲ add terminal vertices of A to the path30: return { p } of minimum cost of the subgraph of G induced by the vertices of T ( G ). For the series compositionwe assume that the left subtree T x ℓ of any vertex x of T ( G ) contains no more terminal vertices thanits right subtree T x r . Otherwise we only had to swap the children of the vertex x .By algorithm DirecedSteinerPathCover we obtain the following result.
Theorem 3.9
A directed Steiner path cover of minimum cost for a directed co-graph can be com-puted in linear time with respect to the size of the directed co-expression.
Proof
The correctness follows by Lemma 3.1 and 3.6. The running time can be achieved by storingthe paths using double-linked, linear lists, where the paths that contain Steiner vertices are storedin one set and the paths that contain no Steiner vertices are stored in another set. The lists eachhave a pointer to the first and last element, which are terminal vertices, and they have a pointer tothe first and last Steiner vertices. Additionally, we store the number of terminal and Steiner verticesfor each list. Each of the operations in Algorithm
DirectedSteinerPathCover can be done inconstant time. Our motivation to study the Hamiltonian Path problem comes from the problem of minimizingchange-over times in pick-and-place machines in electronic industry. Before we study this problem,we recall the definition of Hamiltonian Path problem.
Name
Shortest Directed Hamiltonian Path
Instance
A directed graph G and edge weights c : E ( G ) → R ≥ . Task
Find a directed Hamiltonian path P in G that minimizes P e ∈ P c ( e ).Pick-and-place machines have been studied for many years, see [CvdKS02]. Often, the focus ofplanning problems in printed circuit board assembly is on optimizing the throughput of these pick-12 lgorithm 2 OrderComp (set A , Cover C A , set B , Cover C B )
1: let C ′ A := C A ; let C ′ B := C B ;2: if | C A | < | C B | then loop min { s ( C A ) , | C B | − | C A |} -times4: let r ∈ C ′ A that contains a Steiner vertex5: C ′ A := C ′ A − { r } C ′ A := C ′ A ∪ { r , r } where r , r result from r by splitting r at a Steiner vertex7: if | C A | > | C B | then loop min { s ( C B ) , | C A | − | C B |} -times9: let r ∈ C ′ B that contains a Steiner vertex10: C ′ B := C ′ B − { r } C ′ B := C ′ B ∪ { r , r } where r , r result from r by splitting r at a Steiner vertex12: C := ∅ loop min {| C ′ A | , | C ′ B |} -times14: let a ∈ C ′ A ; C ′ A := C ′ A − { a } ;15: let b ∈ C ′ B ; C ′ B := C ′ B − { b } ;16: Concat ( a, b )17: C := C ∪ { a } while C ′ A = ∅ do
19: let a ∈ C ′ A ; C ′ A := C ′ A − { a } ; C := C ∪ { a } while C ′ B = ∅ do
21: let b ∈ C ′ B ; C ′ B := C ′ B − { b } ; C := C ∪ { b } return C Algorithm 3
DirectedSteinerPathCover (Co-Tree T , Vertex x ) if x is the only vertex of T thenif x is a terminal vertex of G thenreturn { ( x ) } return ∅ else C A := DirectedSteinerPathCover ( T x ℓ , x ℓ ) ⊲ x ℓ is the left successor of xC B := DirectedSteinerPathCover ( T x r , x r ) ⊲ x r is the right successor of x if x corresponds to a disjoint union of T thenreturn C A ∪ C B if x corresponds to a series composition of T thenreturn SeriesComp ( V ( T x ℓ ), C A , V ( T x r ), C B ) if x corresponds to an order composition of T thenreturn OrderComp ( V ( T x ℓ ), C A , V ( T x r ), C B ) and-place machines to produce many printed circuit boards (short PCB) a day. We are interestedin minimizing change-over times for refilling the machines.Mid-sized companies in the electronic industry often have to produce different PCBs on one day.Each of these PCBs has to be produced in small quantities. The SMD components like capacitors,resistors, or integrated circuits are usually positioned on the boards by pick-and-place machinesand are soldered in a re-flow oven. Different types of components are fed in to the machine byfeeders or trays. After one type of boards has been assembled, the pick-and-place machine has to bereassembled with other types of SMD components. The time for this refilling of components is oftenlimited by the time the last PCBs of the previous series stay in the re-flow oven. The change-overmust not take too long to avoid an unnecessary downtime of the machine. Therefore, PCBs must beprocessed in an order that only a few component groups have to be replaced. We show how a graphmodel can be used to describe the problem, and we give an integer program to solve the problem.Assume that a company produces different PCBs, and the available pick-and-place machine canbe equipped with at most k different types of SMD components, since no more trays are available.At one day, n different PCBs have to be produced, that together contain m different types of SMDcomponents t , . . . , t m . Each board b i has to be equipped with a set T i ⊂ { t , . . . , t m } of componenttypes. We represent each board by an m -tuple such that the i -th entry is one if and only if type t i is needed to produce the board. The number of ones in such a tuple is at most k . For example, b i = (0 , , , ,
0) means that components of type 2 and 4 must be used, types 1, 3, and 5 are not usedfor producing this board.In our graph model, each board is represented by a vertex, and two vertices are connected byan edge. To change over from a board u to a board v those types have to be removed from the13achine, 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 hammingdistance of u and v . Example 4.1
Given n = 4 jobs b = (1 , , , , b = (0 , , , , b = (1 , , , , and b = (1 , , , .The resulting graph contains the artificial vertex b = (0 , , , to represent the initial state of themachine, where all trays are empty. It is shown in Figure 2 together with the edge costs. To minimizethe overall change-over times is to produce the boards in the order b = (1 , , , , b = (1 , , , , b = (1 , , , , and b = (0 , , , which sum up to 6.
13 12 2 3 24 130,1,0,1 0,0,0,0 1,0,0,0 1,1,1,01,0,1,0
Figure 2: Graph modeling 4 boards. The dashed lines show a Hamiltonian path that defines anorder in which the change-over times sum up to 9.A shortest Hamiltonian path that starts at the artificial vertex representing the initial state ofthe machine minimizes the overall change-over time. In the next section we give a mixed integerprogram to solve the problem.
In the following we assume that a directed graph G = ( V, E, c ) is given, where V denotes the setof 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 theweight of edge e .Our integer program is based on the following idea. Choose a vertex as the first vertex on thepath. This is typically an artificial vertex that represents the empty machine at the beginning ofa day. The order of vertices on the path implies for two vertices u and v following immediately onthe 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, ifand only if edge ( i, j ) is on the Hamiltonian path. We use integer valued variables p [ i ], i ∈ [ n ], suchthat 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. X ( i,j ) ∈ E x [ i, j ] ≤ ∀ i ∈ V and X ( i,j ) ∈ E x [ i, j ] ≤ ∀ j ∈ V The following constraints prevent loops over anti-parallel edges. If there are anti-parallel edges thenchoose at most one of them. This is ensured by the constraints: x [ i, j ] ≤ − x [ j, i ] ∀ ( i, j ) ∈ E : ( j, i ) ∈ E Each Hamiltonian path has length n − X ( i,j ) ∈ E x [ i, j ] = n − i, j ) belongs to the path then p [ j ] − p [ i ] = 1 must hold true: − n + ( n + 1) · x [ i, j ] ≤ p [ j ] − p [ i ] ∀ ( i, j ) ∈ E and p [ j ] − p [ i ] ≤ n − ( n − · x [ i, j ] ∀ ( i, j ) ∈ E The objective is to minimize the sum of the change-over times, i.e. to make the path length as smallas possible, so we have to minimize the objective function P ( i,j ) ∈ E c [ i, j ] · x [ i, j ]. Alternatively, wecan use max ( i,j ) ∈ E c [ i, j ] · x [ i, j ] as objective function to minimize the largest change-over time. We ran the mixed integer program on CPLEX 12.8.0 using default settings on some standard PCwith 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 withrandomly generated edge weights are shown in Table 3. The running times are average values over10 runs. Bold numbers represent times when the time limit of 1800 seconds, which is equal to 30minutes, was reached at least once and at most twice. It is well-known that any tournament on afinite number of vertices contains a Hamiltonian path. n
100 200 300 400 500time 2 . . .
519 783 stdev 0 . . . K n,m fordifferent values of n and m are shown in Table 4. The complete bipartite graph K n,m contains aHamiltonian path if and only if | n − m | ≤
1. The absence of such a path can be detected very quicklyby the MIP as can be seen in the columns m = n + 2. All complete bipartite graphs are co-graphsso these results show that our algorithm with running time linear in the input size would be verymuch faster than the integer program. Running times of more than 30 minutes are indicated by abar − . n = 50 n = 100 n = 150 n = 200 n = 250 m
50 51 52 100 101 102 150 151 152 200 201 202 250 251 252 time . . . . . . . −
370 0 . − . K n,m for different values of n and m . Here again, we assume that a directed graph G = ( V, E, c ) is given, where V denotes the set ofvertices, 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 ′ isrepresented by two anti-parallel edges in G , and the weight of the new edges are equal to the weightof edge e .We use additional binary variables y [ i ], i ∈ [ n ], such that y [ i ] is equal to one, if and only ifvertex i is contained in the path. These variables are only used to simplify the formulation of the15ollowing 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. Weuse integer valued variables p [ i ], i ∈ [ n ], such that p [ i ] = ℓ , if and only if vertex i is the ℓ -th vertexon the Steiner path. Each terminal vertex i has to be contained in the path. p [ i ] ≥ ∀ i ∈ T 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 bestated by the following constraints. x [ i, j ] ≤ p [ i ] ∀ ( i, j ) ∈ E and x [ i, j ] ≤ p [ j ] ∀ ( i, j ) ∈ E If there are anti-parallel edges then choose at most one of them. This is ensured by the constraint: x [ i, j ] ≤ − x [ j, i ] ∀ ( i, j ) ∈ E : ( j, i ) ∈ E It holds y [ i ] = 1 iff p [ i ] >
0, i.e. y [ i ] = 1 iff vertex i is on the path. y [ i ] ≤ p [ i ] ∀ i ∈ V and p [ i ] ≤ n · y [ i ] ∀ i ∈ V The path has to contain one edge less than vertices. X ( i,j ) ∈ E x [ i, j ] = X i ∈ V y [ i ] − p [ i ] = 0 then there has to be a x [ i, j ] = 1 or x [ j, i ] = 1. p [ i ] ≤ n · X ( i,j ) ∈ E x [ i, j ] + X ( j,i ) ∈ E x [ j, i ] ∀ i ∈ V For each vertex i ∈ V − T contained in the path we have one in-going and one outgoing edge. X ( i,j ) ∈ E x [ i, j ] = y [ i ] ∀ i ∈ V − T and X ( i,j ) ∈ E x [ i, j ] = y [ i ] ∀ j ∈ V − T (2)The path leaves each vertex i ∈ T at most once and it enters each vertex j ∈ T at most once. X ( i,j ) ∈ E x [ i, j ] ≤ ∀ i ∈ T and X ( i,j ) ∈ E x [ i, j ] ≤ ∀ j ∈ T If a vertex is in the path then its position must be at least one. X ( i,j ) ∈ E x [ i, j ] ≤ p [ i ] ∀ i ∈ V and X ( i,j ) ∈ E x [ i, j ] ≤ p [ j ] ∀ j ∈ V Finally, to avoid cycles, if edge ( i, j ) belongs to the path then p [ j ] − p [ i ] = 1 must hold true: − n + ( n + 1) · x [ i, j ] ≤ p [ j ] − p [ i ] ∀ ( i, j ) ∈ E and p [ j ] − p [ i ] ≤ n − ( n − · x [ i, j ] ∀ ( i, j ) ∈ E The objective is to minimize the sum of edge-weights P ( i,j ) ∈ E c [ i, j ] · x [ i, j ]. For unit-distance graphsthis objective function results in a Steiner path with least number of Steiner vertices. Running times to solve Steiner Path problems on complete bipartite graphs K n, n for different valuesof 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 ofsuch a path can be detected very quickly by the MIP as can be seen in the columns t = 2 n .The running times are average values over 10 runs, bold numbers represent times when the timelimit 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 − .16 = 25 n = 50 n = 75 n = 100 n = 125 t
12 25 50 25 50 100 37 75 150 50 100 200 62 125 250time 0 . . . . . . . . . − . K n, n fordifferent values of n and t MM MM MMMMs t
Figure 3: Graph extended by a source and a sink to compute an optimal Steiner Path Cover.
To simplify the objective function and the IP we modify the given directed graph G = ( V, E, c )in such a way, that a new vertex s as source and another new vertex t = s as sink is added.Vertex s gets edges to each terminal vertex and each terminal vertex gets an edge to the sink t as shown in Figure 3. The additional edges get a weight of M := | V | · | E | if the graph hasno edge weights, otherwise M := | V | · C where C := max e ∈ E { c ( e ) } denotes the maximum edgeweight of the graph. More formally, we get graph G ′ = ( V ′ , E ′ , c ′ ) such that V ′ := V ∪ { s, t } , E ′ := E ∪ { ( s, v ) | v ∈ T } ∪ { ( v, t ) | v ∈ T } , 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 ∈ 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 ] isequal to one, if and only if vertex i is contained in the path. Binary variables x [ i, j ], i, j ∈ [ n ], areused such that x [ i, j ] is equal to one, if and only if edge { i, j } is on the Steiner path. We use integervalued variables p [ i ], i ∈ [ n ], such that p [ i ] = ℓ , if and only if vertex i is the ℓ -th vertex on theSteiner path.The number of paths in the cover is equal to P ( s,v ) ∈ E ′ x [ s, v ], and since there is at least onepath in a Steiner Path Cover for G if T = ∅ , the following conditions must hold true: X ( s,v ) ∈ E ′ x [ s, v ] > X ( v,t ) ∈ E ′ x [ v, t ] > i exactly once, andthe path enters each terminal vertex j exactly once, which can be stated as follows. X ( i,j ) ∈ E ′ x [ i, j ] = 1 ∀ i ∈ T and X ( i,j ) ∈ E ′ x [ i, j ] = 1 ∀ j ∈ T Since non-terminal vertices need not be contained in the path, the path leaves each non-terminalvertex i at most once, and the path enters each non-terminal vertex j at most once, which can bestated as follows. X ( i,j ) ∈ E x [ i, j ] ≤ ∀ i ∈ V − T and X ( i,j ) ∈ E x [ i, j ] ≤ ∀ j ∈ V − T j then there has to be an edge that enters j and an edge that leaves j , which can be statedas: X ( i,j ) ∈ E x [ i, j ] = X ( j,k ) ∈ E x [ j, k ] ∀ j ∈ V − T If there are anti-parallel edges then choose at most one of them. This is ensured by the constraint: x [ i, j ] ≤ − x [ j, i ] ∀ ( i, j ) ∈ E : ( j, i ) ∈ E Each terminal vertex i has to be contained in the path. p [ i ] ≥ ∀ i ∈ T 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 bestated by the following constraints. x [ i, j ] ≤ p [ i ] ∀ ( i, j ) ∈ E and x [ i, j ] ≤ p [ j ] ∀ ( i, j ) ∈ E If p [ i ] = 0 then there has to be a x [ i, j ] = 1 or x [ j, i ] = 1. p [ i ] ≤ n · X ( i,j ) ∈ E x [ i, j ] + X ( j,i ) ∈ E x [ j, i ] ∀ i ∈ V Finally, to avoid cycles, if edge ( i, j ) belongs to the path then p [ j ] − p [ i ] = 1 must hold true: − n + ( n + 1) · x [ i, j ] ≤ p [ j ] − p [ i ] ∀ ( i, j ) ∈ E and p [ j ] − p [ i ] ≤ n − ( n − · x [ i, j ] ∀ ( i, j ) ∈ E Minimizing an objective function like P 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 leastnumber of Steiner vertices. By our definition of the costs of the additional edges from s to terminalvertices we can choose the same objective function as above, when we also take care of the additionaledges. The objective is to minimize the sum of edge-weights P ( i,j ) ∈ E ′ c [ i, j ] · x [ i, j ]. For unit-distancegraphs this objective function results in a Steiner path cover P of minimum size, with least numberof Steiner vertices P p ∈ P P e ∈ p c ( e ). Running times to solve Steiner Path Cover problems on complete bipartite graphs K n, n for differentvalues of n and t many randomly chosen terminal vertices are shown in Table 6. n = 25 n = 50 n = 75 n = 100 n = 125 t
12 25 50 25 50 100 37 75 150 50 100 200 62 125 250time 0 . . . . . . . . . . − K n, n for different values of n and t .The running times are average values over 10 runs. Running times of more than 30 minutes areindicated by a bar − , bold numbers represent times when the time limit was reached at least onceand at most twice. Table 7 shows running times to solve Steiner Path Cover problems on randomlygenerated 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 setto be / in our experiments. 18 = 200 n = 300 n = 400 n = 500 t n/ n/ n/ n/ n/ n/ n/ n/ n/ n/ n/ n/ . . . . . .
524 708
Table 7: Running times to solve Steiner Path Cover problems on randomly generated co-graphswith n vertices and t many randomly chosen terminal vertices. Algorithm 4
Random-Co-Graph (int t, int n)choose t distinct vertices at randomcall otimes (1, n) function otimes (int l, int r) if r - l = 1 then create edge ( l, r ) and return m := rand(l, r) ⊲ choose random number between l and rcall 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 thenreturn 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) In this paper we considered the directed Steiner path cover problem for directed co-graphs. Wecould show a linear time solution for computing the minimum number of paths within a directedSteiner path cover and the minimum number of Steiner vertices in such a directed Steiner pathcover in directed co-graphs. The results allowed us to give an algorithm which constructs a directedSteiner path cover of minimum cost for a directed co-graph in linear time. This leads to a lineartime 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 vertexgraph by disjoint union and join operations, see [CLSB81]. Given some undirected co-graph G , wecan solve the Steiner path cover problem in linear time by replacing every edge { u, v } of G by twodirected edges ( u, v ) and ( v, u ) and applying our solution for directed co-graphs. This reproves ourresult of [GHK + T = V ( G ) and p ( G ) = 1, our results imply the first linear time algorithm for the directedHamiltonian path problem on directed co-graphs. This generalizes the known results for undirectedco-graphs of Lin et al. [LOP95].In our future work we want to find out whether results can be transferred to other graph classessuch as chordal graphs, interval graphs, or distance-hereditary graphs. Acknowledgements
The work of the second and third author was supported by the Deutsche Forschungsgemeinschaft(DFG, German Research Foundation) – 38822185219 eferences [AACKS14] A.K. Abu-Affash, P. Carmi, M.J. Katz, and M. Segal. The euclidean bottlenecksteiner path problem and other applications of ( α , β )-pair decomposition. Discrete &Computational Geometry , 51(1):1–23, 2014.[BCKN15] H.L. Bodlaender, M. Cygan, S. Kratsch, and J. Nederlof. Deterministic single expo-nential time algorithms for connectivity problems parameterized by treewidth.
Infor-mation and Computation , 243:86–111, 2015.[BdGR97] D. Bechet, P. de Groote, and C. Retor´e. A complete axiomatisation of the inclusion ofseries-parallel partial orders. In
Rewriting Techniques and Applications , volume 1232of
LNCS , pages 230–240. Springer-Verlag, 1997.[BJG18] J. Bang-Jensen and G. Gutin, editors.
Classes of Directed Graphs . Springer-Verlag,Berlin, 2018.[BJM14] J. Bang-Jensen and A. Maddaloni. Arc-disjoint paths in decomposable digraphs.
Jour-nal of Graph Theory , 77:89–110, 2014.[CL18] A. Custic and S. Lendl. On streaming algorithms for the steiner cycle and path coverproblem on interval graphs and falling platforms in video games.
ACM ComputingResearch Repository (CoRR) , abs/1802.08577:9 pages, 2018.[CLSB81] D.G. Corneil, H. Lerchs, and L. Stewart-Burlingham. Complement reducible graphs.
Discrete Applied Mathematics , 3:163–174, 1981.[CMZ12] M. Chimani, P. Mutzel, and B. Zey. Improved steiner tree algorithms for boundedtreewidth.
Journal of Discrete Algorithms , 16:67–78, 2012.[CP06] C. Crespelle and C. Paul. Fully dynamic recognition algorithm and certificate fordirected cographs.
Discrete Applied Mathematics , 154(12):1722–1741, 2006.[CvdKS02] Y. Crama, J. van de Klundert, and F.C.R. Spieksma. Production planning problemsin printed circuit board assembly.
Discrete Applied Mathematics , 123(1-3):339–361,2002.[FGLS10] F.V. Fomin, P.A. Golovach, D. Lokshtanov, and S. Saurabh. Intractability of clique-width parameterizations.
SIAM Journal on Computing , 39(5):1941–1956, 2010.[GHK +
14] R. Ganian, P. Hlinen´y, J. Kneis, A. Langer, J. Obdrz´alek, and P. Rossmanith. Digraphwidth measures in parameterized algorithmics.
Discrete Applied Mathematics , 168:88–107, 2014.[GHK + Proceedings of the Con-ference on Current Trends in Theory and Practice of Computer Science (SOFSEM) ,volume 12011 of
LNCS , pages 556–565. Springer-Verlag, 2020.[GHK + Operations ResearchProceedings (OR 2019), Selected Papers , pages 331–338. Springer-Verlag, 2020.[GHO13] R. Ganian, P. Hlinen´y, and J. Obdrz´alek. A unified approach to polynomial algorithmson graphs of bounded (bi-)rank-width.
European Journal of Combinatorics , 34(3):680–701, 2013.[GKR19a] F. Gurski, D. Komander, and C. Rehs. Computing digraph width measures on di-rected co-graphs. In
Proceedings of International Symposium on Fundamentals ofComputation Theory (FCT) , volume 11651 of
LNCS , pages 292–305. Springer-Verlag,2019. 20GKR19b] F. Gurski, D. Komander, and C. Rehs. Oriented coloring on recursively defined di-graphs.
Algorithms , 12(4):87, 2019.[GKR20] F. Gurski, D. Komander, and C. Rehs. Acyclic coloring of special digraphs.
ACMComputing Research Repository (CoRR) , abs/2006.13911:16 pages, 2020.[GKR21a] F. Gurski, D. Komander, and C. Rehs. Acyclic coloring parameterized by directedclique-width. In
Proceedings of the International Conference on Algorithms and Dis-crete Applied Mathematics (CALDAM) , LNCS. Springer-Verlag, 2021. to appear.[GKR21b] F. Gurski, D. Komander, and C. Rehs. How to compute digraph width measures ondirected co-graphs.
Theoretical Computer Science , 2021. to appear.[GR18] F. Gurski and C. Rehs. Directed path-width and directed tree-width of directedco-graphs. In
Proceedings of the International Conference on Computing and Combi-natorics (COCOON) , volume 10976 of
LNCS , pages 255–267. Springer-Verlag, 2018.[Gur17] F. Gurski. Dynamic programming algorithms on directed cographs.
Statistics, Opti-mization and Information Computing , 5:35–44, 2017.[GWY16] F. Gurski, E. Wanke, and E. Yilmaz. Directed NLC-width.
Theoretical ComputerScience , 616:1–17, 2016.[HSW17] M. Hellmuth, P.F. Stadler, and N. Wieseke. The mathematics of xenology: di-cographs, symbolic ultrametrics, 2-structures and tree-representable systems of binaryrelations.
Journal of Mathematical Biology , 75(1):199–237, 2017.[LOP95] R. Lin, S. Olariu, and G. Pruesse. An optimal path cover algorithm for cographs.
Comput. Math. Appl. , 30:75–83, 1995.[MJV13] S.S. Moharana, A. Joshi, and S. Vijay. Steiner path for trees.
International Journalof Computer Applications , 76(5):11–14, 2013.[NEMM +
18] N. Nojgaard, N. El-Mabrouk, D. Merkle, N. Wieseke, and M. Hellmuth. Partial ho-mology relations - satisfiability in terms of di-cographs. In
Proceedings of InternationalComputing and Combinatorics Conference (COCOON) , volume 10976 of
LNCS , pages403–415. Springer-Verlag, 2018.[RW90] G. Reich and P. Widmayer. Beyond steiner’s problem: a VLSI oriented generalization.In
Proceedings of Graph-Theoretical Concepts in Computer Science (WG) , volume 411of
LNCS , pages 196–210. Springer-Verlag, 1990.[WC82] J.A. Wald and C.J. Colbourn. Steiner trees in outerplanar graphs. In
ThirteenthSoutheastern Conference on Combinatorics, Graph Theory, and Computing , pages15–22, 1982.[WC83] J.A. Wald and C.J. Colbourn. Steiner trees, partial 2-trees, and minimum IFI net-works.