4.15 Application: Gaussian Elimination 223 V (Di ) = {vπ(ni +1) , vπ(ni +2) , . . . , vπ(ni+1 ) }. It is easy to see that B has (n1 , . . . , np )-block-triangular structure. This implies that A has block-triangular structure. The above observation suggests the following procedure to reveal hidden block-triangular structure of A. 1. Replace every non-zero entry of A by 1 to obtain a (0, 1)-matrix B. 2. Construct a directed pseudograph D with vertex set {v1 , . . . , vn } such that B is the adjacency matrix of D. 3. Find the strong components of D. If D is strong, then B (and thus A) does not have hidden block-triangular structure6 . If D is not strong, let D1 , . . . , Dp be the strong components of D (in acyclic order). Find a permutation π on {1, . . . , n} such that V (Di ) = {vπ(ni +1) , vπ(ni +2) , . . . , vπ(ni+1 ) }. This permutation reveals hidden block-triangular structure of B (and thus A). Use π to permute rows and columns of A and coordinates of x and b. To perform Step 3 one may use Tarjan’s algorithm in Section 4.4. We will illustrate the procedure above by the following example. Suppose we wish to solve the system: x1 + 3x3 x2 2x1 + 2x2 + 4x3 3x2 + + + + 8x4 5x4 9x4 2x4 = 2, = 1, = 6, = 3. We first construct the matrix B and the directed pseudograph D. We have V (D) = {v1 , v2 , v2 , v4 } and A(D) = {v1 v3 , v1 v4 , v2 v4 , v3 v1 , v3 v2 , v3 v4 , v4 v2 } ∪ {vi vi : i = 1, 2, 3, 4}. The digraph D has strong components D(1) and D(2) , which are subdigraphs of D induced by {v1 , v3 } and {v2 , v4 }, respectively. These components suggest the following permutation π, π(i) = i for i = 1, 4, π(2) = 3 and π(3) = 2, of rows and columns of A as well as elements of x and b, the right-hand side. As a result, we obtain the following: + 8x04 = 2, x01 + 3x02 0 0 0 2x1 + 4x2 + 2x3 9x04 = 6, x03 + 5x04 = 1, 3x03 + 2x04 = 3, 6 Provided we do not change the set of entries of the diagonal of A 224 4. Classes of Digraphs where x0i = xi for i = 1, 4, x02 = x3 and x03 = x2 . Solving the last two equations separately, we obtain x03 = 1, x04 = 0. Now solving the first two equations, we see that x01 = 2, x02 = 0. Hence, x1 = 2, x2 = 1, x3 = x4 = 0. A discussion on practical experience with revealing and exploiting blocktriangular structures is given in [208]. 4.16 Exercises 4.1. Let φ(u) be the forefather of a vertex u as defined in Section 4.4. Combining (4.2) and (4.3), prove that φ(φ(u)) = φ(u). 4.2. Prove Proposition 4.3.1. 4.3. Prove Lemma 4.4.1. 4.4. In part (ii) ⇒ (i) of Theorem 4.5.1, prove that σ(D) = L(Q). 4.5. Derive Corollary 4.5.2 from Theorem 4.5.1 (iii). 4.6. (−) Prove Proposition 4.5.3 using Theorem 4.5.1 (i) and (ii). 4.7. Prove the following simple properties of line digraphs: ~n−1 if and only if D ∼ ~n ; (i) L(D) ∼ =P =P ∼ ~ ~ (ii) L(D) ∼ C if and only if D C = n = n. 4.8. Let D be a digraph. Show by induction that Lk (D) is isomorphic to the digraph H, whose vertex set consists of walks of D of length k and a vertex v0 v1 . . . vk dominates the vertex v1 v2 . . . vk vk+1 for every vk+1 ∈ V (D) such that vk vk+1 ∈ A(D). 4.9. Using the results in Exercise 4.7, prove the following elementary properties of iterated line digraphs: Let D be a digraph. Then (i) Lk (D) is a digraph with no arcs, for some k, if and only if D is acyclic; (ii) if D has a pair of cycles joined by a path (possibly of length 0), then lim nk = ∞, k →∞ where nk is the order of Lk (D); (iii) if no pair of cycles of D is joined by a path, then for all sufficiently large values of k, each connected component of Lk (D) has at most one cycle. 4.10. Prove by induction on k ≥ 1 Proposition 4.5.4. 4.11. Prove Lemma 4.6.1. 4.12. Prove Lemma 4.6.5. 4.13. Prove Lemma 4.6.6. 4.14. Prove Theorem 4.6.7. 4.16 Exercises 225 4.15. Upwards embeddings of MVSP digraphs. Prove that one can embed every MVSP digraph D into the Cartesian plane such that, if vertices u, v have coordinates (xu , yu ) and (xv , yv ), respectively, and there is a (u, v)-path in D, then xu ≤ xv and yu ≤ yv . Hint: consider series composition and parallel composition separately. 4.16. Prove Proposition 4.7.2. Hint: use induction on the number of reductions applied for the ‘if’ part and the number of arcs for the ‘only if’ part. 4.17. Prove Proposition 4.7.3. 4.18. Prove part (b) of Lemma 4.8.4. Hint: if u and v are in S then there is a path from u to v in U G(S). Similarly, if x and y are in S 0 . Use these paths (corresponding to sequences of non-adjacent vertices in D) to show that if xu and vy are arcs, then u = v and x = y must hold if D is quasi-transitive. 4.19. (−) Construct an infinite family of path-mergeable digraphs, which are not in-path-mergeable. 4.20. Prove Proposition 4.10.2. 4.21. (−) Show that the following ‘claim’ is wrong. Let D be a locally insemicomplete digraph and let D contain internally disjoint paths P1 , P2 such that Pi is an (xi , y)-path (i = 1, 2) and x1 6= x2 . Then x1 and x2 are adjacent. 4.22. Orientations of path-mergeable digraphs. Prove that every orientation of a path-mergeable digraph is a path-mergeable oriented graph. 4.23. (+) Prove Corollary 4.9.2. 4.24. Path-mergeable digraphs which are neither locally in-semicomplete nor locally out-semicomplete. Show by a construction that there exists an infinite class of path-mergeable digraphs, none of which is locally in-semicomplete or locally out-semicomplete. Then extend your construction to arbitrary degrees of vertex-strong connectivity. Hint: consider extensions. 4.25. (−) Path-mergeable transitive digraphs. Prove that a transitive digraph D = (V, A) is path-mergeable if and only if for every x, y ∈ V and every pair xuy, xvy of (x, y)-path of length 2 either u→v or v→u holds. 4.26. Reformulate Lemma 4.10.3 and Theorem 4.10.4 for locally out-semicomplete digraphs. 4.27. Orientations of locally in-semicomplete digraphs. Prove that every orientation of a digraph which is locally in-semicomplete is a locally intournament digraph. 4.28. Strong orientations of strong locally in-semicomplete digraphs. Prove that every strong locally in-semicomplete digraph on at least 3 vertices has a strong orientation. 4.29. Prove Lemma 4.11.2. 4.30. Prove Corollary 4.11.7. 4.31. Prove Theorem 4.11.8. 226 4. Classes of Digraphs 4.32. Recognition of round digraphs. Show that the proof of Theorem 4.11.4 implies a polynomial algorithm to decide whether a digraph D is round and to find a round labelling of D (if D is round). 4.33. (+) Using Lemma 4.11.13, show that, if D is a non-round decomposable locally semicomplete digraph, then the independence number of U G(D) is at most two. 4.34. (−) Give an example of a locally semicomplete digraph on 4 vertices with no 2-king. 4.35. Prove Proposition 4.11.16. 4.36. Prove the assertion stated in Exercise 4.33 using Lemma 4.11.14 and Proposition 4.11.16. 4.37. Extending in-path-mergeability. Prove that, if P, Q are internally disjoint (x, z)- and (y, z)-paths in an extended locally in-semicomplete digraph D and no vertex on P − z is similar to a vertex of Q − z, then there is a path R from either x or y to z in D such that V (R) = V (P ) ∪ V (Q). 4.38. Prove that there exists an O(mn + n2 )-algorithm for checking if a digraph D with n vertices and m arcs has a decomposition D = R[H1 , . . . , Hr ], r ≥ 2, where Hi is an arbitrary digraph and the digraph R is either semicomplete bipartite or connected extended locally semicomplete. 4.39. (−) Let D be a connected digraph which is both quasi-transitive and locally semicomplete. Prove that D is semicomplete. 4.40. (−) Let D be a connected digraph which is both quasi-transitive and locally in-semicomplete. Prove that the diameter of U G(D) is at most 2. 4.41. (−) Prove that the intersection number in(D) ≤ n for every digraph D of order n. Show that this upper bound is sharp (Sen, Das, Roy and West [661]). 4.42. Prove Corollary 4.14.3. Hint: use that each edge is on the boundary of precisely two faces and that each face has at least 3 edges. 4.43. (−) Check which of the following 4 × 4-matrices A = [aij ] have hidden blocktriangular structure (the entries not specified equal zero). Only simultaneous permutations of rows and columns are allowed. (a) a1i = i + 1 for i = 1, 2, 3, a2i = a3i = i for i = 2, 3, and a4i = 2 for i = 2, 3, 4; (b) a12 = a21 = a14 = a41 = a34 = a43 = 2 and aii = 1 for i = 1, 2, 3, 4. 5. Hamiltonicity and Related Problems In this chapter we will consider the hamiltonian path and cycle problems for digraphs as well as some related problems such as the longest path and cycle problems and the minimum path factor problem. We describe and prove a number of results in the area as well as formulate several open questions. We recall that a k-path factor of a digraph D is a collection of k vertexdisjoint paths covering V (D). Recall that the minimum positive integer k such that D has a k-path factor is the path covering number of D, denoted by pc(D). A pc(D)-path factor of D is also called a minimum path factor of D. Recall also that a digraph is traceable if it contains a hamiltonian path. For arbitrary digraphs the hamiltonian path and hamiltonian cycle problems are very difficult and both are N P-complete (see, e.g. the book [303] by Garey and Johnson). For convenience of later referencing we state these results as theorems. Theorem 5.0.1 The problem to check whether a given digraph has a hamiltonian cycle is N P-complete. u t Theorem 5.0.2 The problem to check whether a given digraph has a hamiltonian path is N P-complete. u t It is worthwhile mentioning that the hamiltonian cycle and path problems are N P-complete even for some special classes of digraphs. Garey, Johnson and Tarjan showed [305] that the problem remains N P-complete even for planar 3-regular digraphs. It follows easily from Theorems 5.0.1 and 5.0.2 that the problem to determine the minimum path factor as well as the longest path and cycle problems are N P-hard as optimization problems for arbitrary digraphs. This is also true for several special classes of digraphs. However, for some important special classes of digraphs these problems are polynomial time solvable. One such class is the class of acyclic digraphs (see Theorem 2.3.5 and Section 5.3). The reader will see in this chapter that many more such classes can be found. In Section 5.1, some powerful necessary conditions, due to Gutin and Yeo, are considered for a digraph to be hamiltonian. These conditions can be used for the hamiltonian path problem due to the following simple observation: 228 5. Hamiltonicity and Related Problems Proposition 5.0.3 A digraph D has a Hamilton path if and only if the digraph D∗ , obtained from D by adding a new vertex x∗ such that x∗ dominates every vertex of D and is dominated by every vertex of D, is hamiltonian. u t In Section 5.2 we prove that the path covering number of an arbitrary digraph is never more than its independence number. In Section 5.3 we show that the minimum path factor problem for acyclic digraphs can be solved quite efficiently. Furthermore, we show that algorithms for finding minimum path factors in acyclic digraphs are useful in a number of applications. In Section 5.4, we obtain necessary and sufficient conditions by BangJensen for a path-mergeable digraph to be hamiltonian. Since locally insemicomplete and out-semicomplete digraphs are proper subclasses (see Proposition 4.10.1) of path-mergeable digraphs, we may use these conditions, in Section 5.5, to derive a characterization of hamiltonian locally insemicomplete and out-semicomplete digraphs. As corollaries, we obtain the corresponding results for locally semicomplete digraphs. Digraphs with restricted degrees are considered in Section 5.6. There, a number of degreerelated sufficient conditions for a digraph to be hamiltonian are described. In that section, we also consider a recently introduced and powerful proof technique, called multi-insertion, that can be applied to prove many theorems on hamiltonian digraphs. In the last decade quite a number of papers were devoted to studying the structure of longest cycles and paths of semicomplete multipartite digraphs. In Section 5.7, we consider the most important results obtained in this area so far including some striking results by Yeo. The proofs in that section provide further illustrations of the multi-insertion technique. In Section 5.8, we discuss generalizations of characterizations of hamiltonian and traceable extended semicomplete digraphs to extended locally semicomplete digraphs. Sections 5.9 and 5.10 are devoted to quasi-transitive digraphs. We present two interesting methods to tackle the hamiltonian path and cycle problems, and the longest path and cycle problems, respectively, in this class of digraphs. The second method by Bang-Jensen and Gutin allows one to find even vertex-heaviest paths and cycles in quasi-transitive digraphs in polynomial time (where the weights are on the vertices). The last section is devoted to results on hamiltonian paths and cycles in some classes of digraphs not considered in the previous sections. The proof of Theorem 5.11.2 by Thomassen illustrates how the properties of tournaments can be used to prove results on more general digraphs. For additional information on hamiltonian and traceable digraphs, see e.g. the surveys [61, 66] by Bang-Jensen and Gutin, [126] by Bondy, [368] by Gutin and [728, 729] by Volkmann. 5.1 Necessary Conditions for Hamiltonicity of Digraphs 229 5.1 Necessary Conditions for Hamiltonicity of Digraphs An obvious condition for a digraph to be hamiltonian is to be strong. Another obvious and, yet, quite powerful necessary condition for a digraph to be hamiltonian is the existence of a cycle factor1 . Both conditions can be verified in polynomial time (see Sections 4.4 and 3.11.4). The purpose of this section is to describe a series of more powerful conditions, called k-quasi-hamiltonicity, which were recently introduced by Gutin and Yeo in [379]. An equivalent form of 1-quasi-hamiltonicity, pseudo-hamiltonicity, was actually investigated earlier by Babel and Woeginger in [35] for undirected graphs. We prove that every (k + 1)-quasi-hamiltonian digraph is also k-quasihamiltonian (however, there are digraphs which are k-quasi-hamiltonian, but not (k + 1)-quasi-hamiltonian). We introduce an algorithm that checks kquasi-hamiltonicity of a given digraph with n vertices and m arcs in time O(nmk ). Hence, these conditions can be efficiently verified for small values of k. Thus, they can be incorporated in software systems which investigate properties of digraphs (or graphs); one such system is described by Delorme, Ordaz and Quiroz in [189]. We prove that (n − 1)-quasi-hamiltonicity coincides with hamiltonicity and 1-quasi-hamiltonicity is equivalent to pseudohamiltonicity. 5.1.1 Path-Contraction In this section we consider, for technical reasons, directed multigraphs. We use a variation of the operation of contraction of a set of vertices in a directed multigraph. This operation is called path-contraction and is defined as follows. Let P be an (x, y)-path in a directed multigraph D = (V, A). Then D//P stands for the directed multigraph with vertex set V (D//P ) = V ∪ {z} − V (P ), where z ∈ / V , and µD//P (uv) = µD (uv), µD//P (uz) = µD (ux), µD//P (zv) = µD (yv) for all distinct u, v ∈ V − V (P ). In other words, D//P is obtained from D by deleting all vertices of P and adding a new vertex z such that every arc with head x (tail y) and tail (head) in V − V (P ) becomes an arc with head (tail) z and the same tail (head). Observe that a path-contraction in a digraph results in a digraph (no parallel arcs arise). We will often consider path-contractions of paths of length one, i.e. arcs e. Clearly, a directed multigraph D has a k-cycle (k ≥ 3) through an arc e if and only if D//e has a cycle through z. Observe that the obvious analogue of path-contraction for undirected multigraphs does not have this nice property which is of use in this section. The difference between (ordinary) contraction (which is also called set-contraction) and path-contraction is reflected in Figure 5.1. 1 Häggkvist [387] posed a problem to find classes of digraphs for which strong connectivity and the existence of a cycle factor are sufficient for hamiltonicity. In this chapter we consider some classes with this property. 230 5. Hamiltonicity and Related Problems a b d x u v y c D a 2 b a 2 2 d b z z d 3 c D/{x, u, v, y} c D//P, P = xuvy Figure 5.1 The two different kinds of contraction, set-contraction and pathcontraction. The integers 2 and 3 indicate the number of corresponding parallel arcs. As for set-contraction, for vertex-disjoint paths P1 , P2 , . . . , Pt in D, the path-contraction D//{P1 , . . . , Pt } is defined as the directed multigraph (. . . ((D//P1 )//P2 ) . . .)//Pt ; clearly, the result does not depend on the order of P1 , P2 , . . . , Pt . 5.1.2 Quasi-Hamiltonicity The results in the remainder of this section are due to Gutin and Yeo. Let D = (V, A) be a directed multigraph. Let QH1 (D) = (V, A1 ) be the directed multigraph with arc set A1 = {e ∈ A : e is contained in a cycle factor of D}. For k ≥ 2, QHk (D) = (V, Ak ) is the directed multigraph with arc set Ak = {e ∈ A : QHk−1 (D//e) is strong}. For k ≥ 1, a directed multigraph D is k-quasi-hamiltonian, if QHk (D) is strong. We assume (by definition) that every directed multigraph is 0-quasi-hamiltonian. The quasi-hamiltonicity number of a directed multigraph D of order n, qhn(D), is the maximum integer k(< n) such that D is k-quasi-hamiltonian. Figure 5.2 illustrates the notion of quasi-hamiltonicity. The directed multigraph H is 0-quasi-hamiltonian, but not 1-quasi-hamiltonian (QH1 (H) = H − {(3, 4), (4, 3)} is not strong). Hence, qhn(H) = 0. The directed multigraph D is 1-quasi-hamiltonian as QH1 (D) = D is strong (every arc of D 5.1 Necessary Conditions for Hamiltonicity of Digraphs 231 belongs to a cycle factor of D). However, D is not 2-quasi-hamiltonian since QH2 (D) is not strong (indeed, QH1 (D//(3, 4)) = QH1 (L) is not strong). Thus, qhn(D) = 1. 1 2 1 3 2 1 2 3 34 4 6 4 5 H 6 5 6 D 5 L Figure 5.2 Digraphs. We start with some basic facts on k-quasi-hamiltonicity. Proposition 5.1.1 [379] Let D be a directed multigraph of order n(≥ 2) and let k ∈ {2, 3, . . . , n − 1}. Then A(QHk (D)) ⊆ A(QHk−1 (D)). In particular, if D is k-quasi-hamiltonian, it is (k − 1)-quasi-hamiltonian. Proof: We prove the claim by induction on k. Let e ∈ A(QH2 (D)). Thus, QH1 (D//e) is strong which, in particular, means that D//e has a cycle factor. Hence, e ∈ A(QH1 (D)). Let now k ≥ 3 and let e ∈ A(QHk (D)). Then, QHk−1 (D//e) is strong. By the induction hypothesis, QHk−2 (D//e) is also strong. Hence, e ∈ A(QHk−1 (D)). u t Theorem 5.1.2 [379] A directed multigraph is hamiltonian if and only if it is (n − 1)-quasi-hamiltonian. Proof: Clearly every hamiltonian directed multigraph of order 2 is 1-quasihamiltonian. Now assume that all hamiltonian directed multigraphs of order n − 1 are (n − 2)-quasi-hamiltonian, and let D be a hamiltonian digraph of order n. Whenever we contract an arc belonging to a hamiltonian cycle we obtain a hamiltonian digraph of order n − 1, which therefore is (n − 2)-quasihamiltonian. Hence, every arc on a Hamilton cycle lies in QHn−1 (D), which implies that QHn−1 (D) is strong, i.e. D is (n − 1)-quasi-hamiltonian. Thus, the ‘only if’ part is proved. We prove the ‘if’ part. Let D be a directed multigraph, such that QHn−1 (D) is strong. Let e1 be an arc in QHn−1 (D). Since QHn−2 (D//e1 ) is strong there exists an arc e2 in QHn−2 (D//e1 ). Since QHn−3 ((D//e1 )//e2 ) 232 5. Hamiltonicity and Related Problems is strong there exists an arc e3 in QHn−3 ((D/e1 )//e2 ). Continuing this procedure we obtain arcs e1 , e2 , . . . , en−2 , such that the directed multigraph QH1 ((((D//e1 )//e2 ) . . .)//en−2 ) is strong. Let D0 = (((D//e1 )//e2 ) . . .)//en−2 , and observe that, since QH1 (D0 ) is strong and D0 has order 2, D0 must be hamiltonian. By inserting the arcs e1 , e2 , . . . , en−2 into a Hamilton cycle in D0 , we obtain a Hamilton cycle in D. u t We leave the proof of the following theorem as a non-trivial exercise (Exercise 5.1). Theorem 5.1.3 [379] For every k ≥ 0, there exists a digraph D such that qhn(D) = k < n. u t 5.1.3 Pseudo-Hamiltonicity and 1-Quasi-Hamiltonicity For a positive integer h, a sequence of vertices Q = v1 v2 . . . vhn v1 in a directed multigraph D of order n is an h-pseudo-hamiltonian walk if every vertex of D appears h times in the sequence v1 v2 . . . vhn and vi vi+1 ∈ A(D) for every i = 1, 2, . . . , hn (vhn+1 = v1 ). A directed multigraph D possessing such a sequence is called h-pseudo-hamiltonian and the minimum h for which D is h-pseudo-hamiltonian is the pseudo-hamiltonicity number ph(D) of D. If D has no h-pseudo-hamiltonian walk for any positive integer h, then ph(D) = ∞. A directed multigraph D is pseudo-hamiltonian if ph(D) < ∞. For example, in Figure 5.2, the digraph D is 2-pseudo-hamiltonian: 1212345656431 is a 2-pseudo-hamiltonian walk of D. This digraph is not 1-pseudo-hamiltonian as D is not hamiltonian. Thus, ph(D) = 2. It is not difficult to see that the digraph H in Figure 5.2 is not pseudo-hamiltonian. We have already seen that D is 1-quasi-hamiltonian, but H is not. The above conclusions on pseudo-hamiltonicity of D and H can actually be obtained from Theorem 5.1.5. Lemma 5.1.4 follows from the fact that every regular directed multigraph has a cycle factor (see Exercise 3.70), which implies that every h-regular directed multigraph can be decomposed into h cycle factors. Lemma 5.1.4 Every arc of a regular directed multigraph is included in a cycle factor. u t Theorem 5.1.5 [379] A directed multigraph is pseudo-hamiltonian if and only if it is 1-quasi-hamiltonian. 5.1 Necessary Conditions for Hamiltonicity of Digraphs 233 Proof: Let D be a pseudo-hamiltonian directed multigraph, let Q be an h-pseudo-hamiltonian walk in D, and let A(Q) = (v1 v2 , v2 v3 , . . . , vhn−1 vhn , vhn v1 ) be the sequence of arcs in Q. Construct a new directed multigraph H(D, Q) from D by replacing, for every pair x, y with µD (xy) > 0, all arcs from x to y in D by t(≥ 0) parallel arcs from x to y, where t is the number of appearances of xy in A(Q). By the definition of an h-pseudo-hamiltonian walk, H(D, Q) is an h-regular directed multigraph. Thus, by Lemma 5.1.4, every arc xy in H(D, Q) is in a cycle factor. Therefore, µH(D,Q) (xy) > 0 implies µQH1 (D) (xy) > 0. Since H(D, Q) is strong, we obtain that QH1 (D) is also strong, i.e. D is 1-quasi-hamiltonian. Now let D be a 1-quasi-hamiltonian directed multigraph, i.e. QH1 (D) is strong. For each arc e in QH1 (D) let Fe be a cycle factor in D including e. Let D0 = ∪e∈A(QH1 (D)) Fe . As the union of cycle factors, D0 is regular. Since QH1 (D) is strong, D0 is also strong. Therefore, D0 has a eulerian trail, which corresponds to a pseudo-hamiltonian walk in D. u t The following theorem provides a sharp upper bound for the pseudohamiltonicity number of a digraph. Theorem 5.1.6 [379] For a pseudo-hamiltonian digraph D, ph(D) ≤ (n − 1)/2. For every integer n ≥ 3, there exists a digraph Hn of order n such that ph(Hn ) = b(n − 1)/2c. Proof: Exercise 5.2. u t 5.1.4 Algorithms for Pseudo- and Quasi-Hamiltonicity It is easy to check whether a digraph is 1-quasi-hamiltonian (i.e., by Theorem 5.1.5 is pseudo-hamiltonian). Indeed, checking whether QH1 (D) is strong can be done in time O(n + m) (see Section 4.4). Hence, it suffices to show how to verify for each arc xy if this arc is on some cycle factor. We can merely replace xy by a path xzy, where z is not in D, and check √ whether the new digraph has a cycle factor. This can be done√in time O( nm) by Corollary 3.11.7. Thus, we obtain the total time of O( nm2 ). This complexity bound was improved by Gutin and Yeo [379] as follows. Theorem 5.1.7 We can check whether a directed multigraph D is pseudohamiltonian in O(nm) time. Proof: Exercise 5.3. u t The following theorem implies that one can check k-quasi-hamiltonicity for a constant k in polynomial time. Theorem 5.1.8 [379] In O(nmk ) time, one can check if a directed multigraph is k-quasi-hamiltonian. 234 5. Hamiltonicity and Related Problems Proof: In this proof, we describe an algorithm A that, in time T (k), checks whether a directed multigraph D is k-quasi-hamiltonian. We will show that T (k) = O(nmk ). If k = 1, the algorithm A uses the algorithm B of Theorem 5.1.7. Thus, T (1) = O(nm). If k ≥ 2 then, for each arc e in D, A verifies whether D//e is (k − 1)-quasi-hamiltonian. The algorithm A forms QHk (D) from all arcs e such that D//e is (k − 1)-quasi-hamiltonian. Finally, A checks whether QHk (D) is strong (in time O(m)). This implies that, for k ≥ 2, T (k) ≤ mT (k − 1) + O(m). Since T (1) = O(nm), we obtain that T (k) = O(nmk ). u t 5.2 Path Covering Number The following attainable lower bound for the path covering number of a digraph D is quite trivial: pcc(D) ≤ pc(D). We will see later in this chapter that pcc(D) = pc(D) for acyclic digraphs and semicomplete multipartite digraphs D. The aim of this short section is to obtain a less trivial attainable upper bound for pc(D). This bound is of use in several applications (see, e.g., Section 5.3). Recall that the independence number α(D) of a digraph D is the cardinality of a maximum independent set of vertices of D (a set X ⊆ V (D) is independent if no pair of vertices in X is adjacent). Rédei’s theorem (Theorem 1.4.5) can be rephrased as saying that every digraph with independence number 1 has a hamiltonian path and hence path covering number equal 1. Gallai and Milgram generalized this as follows. Theorem 5.2.1 (Gallai-Milgram theorem) [298] For every digraph D, pc(D) ≤ α(D). This theorem is an immediate consequence of the following lemma by Bondy [126]: Lemma 5.2.2 Let D be a digraph and let P = P1 ∪ P2 ∪ . . . ∪ Ps be an s-path factor of D. Let i(P) (t(P)) denote the set of initial (terminal) vertices of the paths in P. Suppose that s > α(D). Then there exists an (s − 1)-path factor P 0 of D such that i(P 0 ) ⊂ i(P) and t(P 0 ) ⊂ t(P). Proof: The proof is by induction on n, the order of D. The case n = 1 holds vacuously. Let P be as described in the lemma. Let the path Pj in P be denoted by xj1 xj2 . . . xjrj , j = 1, 2, . . . , s. Since s > α(D) the subdigraph Dhi(P)i must contain an arc xk1 xj1 for some k 6= j (1 ≤ k, j ≤ s). If rk = 1, then we can replace Pk , Pj by the path xk1 Pj and obtain the desired path factor. So suppose that rk > 1. Now consider D∗ = D − xk1 and 5.3 Path Factors of Acyclic Digraphs with Applications 235 the path factor P ∗ which we obtain from P by deleting xk1 from the path Pk . Clearly α(D∗ ) ≤ α(D) and we have i(P ∗ ) = i(P) − xk1 + xk2 , t(P ∗ ) = t(P). Thus it follows by the induction hypothesis that D∗ has an (s−1)-path factor Q such that t(Q) ⊂ t(P ∗ ), i(Q) ⊂ i(P ∗ ). If xk2 ∈ i(Q), let Qp be the path of Q whose initial vertex is xk2 . Replacing Qp with xk1 Qp we obtain a path factor in D with the desired properties. So suppose that xk2 is not an initial vertex of any of the paths in Q. Then xj1 must belong to i(Q) and we obtain the desired path factor by replacing the path Qr of Q which starts at xj1 by the path xk1 Qr . u t The following theorem due to Erdős and Szekeres [596] follows easily from Theorem 5.2.1. Theorem 5.2.3 Let n, p, q be positive integers with n > pq, and let I = (i1 , i2 , . . . , in ) be a sequence of n distinct integers. Then there exists either a decreasing subsequence of I with more than p integers or an increasing subsequence of I with more than q integers. Proof: Let D = (V, A) be the digraph with V = {i1 , i2 , . . . , in } and A = {im ik : m < k and im < ik }. Observe the obvious correspondence between independent sets of D and decreasing subsequences of I (respectively, paths of D and increasing subsequences of I). Let F = P1 ∪ . . . ∪ Ps be a minimal path factor of D. By Theorem 5.2.1, s ≤ α(D). Hence, α(D)·maxsj=1 |Pj | ≥ n > pq. Thus, either α(D) > p, i.e., there exists a decreasing subsequence with α(D) > p integers, or maxsj=1 |Pj | > q, i.e., there exists an increasing subsequence with more than q integers. u t Very recently, the following improvement on Theorem 5.2.1 in the case of strong digraphs was proved by Thomassé. This was originally conjectured by Las Vergnas (see [107]). Theorem 5.2.4 [695] If a digraph D is strong, then pc(D) ≤ max{α(D) − 1, 1}. Las Vergnas (see [106]) proved the following generalization of Theorem 5.2.1. Theorem 5.2.5 Every digraph D of finite out-radius has an out-branching with at most α(D) vertices of out-degree zero. u t Theorem 5.2.5 implies Theorem 5.2.1 (Exercise 5.7). 5.3 Path Factors of Acyclic Digraphs with Applications For acyclic digraphs it turns out that the minimum path factor problem can be solved quite efficiently. This is important since this problem has many practical applications. One such example is as follows. 236 5. Hamiltonicity and Related Problems A news agency wishes to cover a set of events E1 , E2 , . . . , En which take place within the coming week starting at a prescribed time Ti . For each event Ei its duration time ti and geographical site Oi is known. The news agency wishes to cover each of these events by having one reporter present for the full duration of the event. At the same time it wishes to use as few reporters as possible. Assuming that the travel time tij from Oi to Oj is known for each 1 ≤ i, j ≤ n, we can model this problem as follows. Form a digraph D = (V, A) by letting V = {v1 , v2 , . . . , vn } and for every choice of i 6= j put an arc from vi to vj if Tj ≥ Ti + ti + tij . It is easy to see that D is acyclic. Furthermore, if the events can be covered by k reporters then D has a k-path factor (just follow the routes travelled by the reporters). It is also easy to see that the converse also holds. Hence having an algorithm for the minimum path factor problem for acyclic digraphs will provide a solution to this and a large number of similar problems (such as airline and tanker scheduling, see Exercise 5.8). Clearly, pc(D) = pcc(D) for every acyclic digraph D. Using flows in networks, we can effectively find a pcc(D)-path-cycle factor in any digraph D (see Exercises 3.59 and 3.7). Since a k-path-cycle factor in an acyclic digraph has no cycles, this implies that the minimum path factor problem for acyclic digraphs is easy (at least from an algorithmic point of view). Theorem 5.3.1 For √ acyclic digraphs the minimum path factor problem is solvable in time O( nm). u t Another application of the path covering number of acyclic digraphs is for partial orders. A partial order consists of a set X and a binary relation ‘ ≺ 0 which is transitive (that is, x ≺ y, y ≺ z implies x ≺ z). Let P = (X, ≺) be a partial order. Two elements x, y ∈ X are comparable if either x ≺ y or y ≺ x holds. Otherwise x and y are incomparable. A chain in P is a totally ordered subset Y of X, that is, all elements in Y are pairwise comparable. An antichain on P is a subset Z of X, no two elements of which are comparable. Dilworth proved the following famous min-max result relating chains to antichains: Theorem 5.3.2 (Dilworth’s theorem) [193] Let P = (X, ≺) be a partial order. Then the minimum number of chains needed to cover X equals the maximum number of elements in an antichain. Proof: Given P = (X, ≺), let D = (X, A) be the digraph such that xy ∈ A for x 6= y ∈ X if and only if x ≺ y. Clearly, D is transitive. Furthermore, a path (an independent set) in D corresponds to a chain (antichain) in P . We need to show that pc(D) = α(D). By Theorem 5.2.1, pc(D) ≤ α(D). Let F = P1 ∪ P2 ∪ . . . ∪ Pk be a minimum path factor of D. By transitivity of D, each V (Pi ) induces a complete subgraph in U G(D). Hence, α(D) = α(U G(D)) ≤ k = pc(D). Thus, pc(D) = α(D). u t 5.4 Hamilton Paths and Cycles in Path-Mergeable Digraphs 237 The last theorem can obviously be reformulated as follows: α(D) = pc(D) for every transitive oriented graph D. We conclude this section with an extension of the analogous result to extended semicomplete digraphs. Lemma 5.3.3 will be used in Section 6.11. Lemma 5.3.3 Let D be an acyclic extended semicomplete digraph with α(D) = k, then the following holds: (a) pc(D) = k. (b) One can obtain a minimum path factor of D as follows: choose a longest path P in D, remove V (P ) and continue recursively. (c) One can find a minimum path factor using the greedy algorithm in (b) in total time O(n log n) (using the adjacency matrix). Proof: By Theorem 5.2.1 pc(D) ≤ k. On the other hand no path can contain two vertices from the same independent set as that would imply that D contains a cycle. Hence pc(D) = k. To prove (b), let P be a longest path of D. By the argument above α(D − P ) ≥ k − 1. On the other hand D can be written as D = S[K a1 , K a2 , . . . , K as ], where S is a semicomplete digraph and s = |V (S)|. By Rédei’s theorem (Theorem 1.4.5), S has a hamiltonian path P 0 . In D this path corresponds to a path Q which contains precisely one vertex from each maximal independent set. Hence Q is a longest path in D by the remark above and we have α(D − Q) = k − 1. Now the second claim follows by induction on k. The third claim follows from the description of procedure MergeHamPathTour in Section 1.9.1, assuming that we have an adjacency matrix representation of D. Note that we delete the paths as we find them and hence the total complexity is still O(n log n). u t 5.4 Hamilton Paths and Cycles in Path-Mergeable Digraphs The class of path-mergeable digraphs was introduced in Section 4.9, where some of its properties were studied. In this section, we prove a characterization of hamiltonian path-mergeable digraphs due to Bang-Jensen [50]. We begin with a simple lemma which forms the basis for the proof of Theorem 5.4.2. For a cycle C, a C-bypass is a path of length at least two with both end-vertices on C and no other vertices on C. Lemma 5.4.1 [50] Let D be a path-mergeable digraph and let C be a cycle in D. If D has a C-bypass P , then there exists a cycle in D containing precisely the vertices V (C) ∪ V (P ). Proof: Let P be an (x, y)-path. Then the paths P and C[x, y] can be merged into one (x, y)-path R, which together with C[y, x] forms the desired cycle. u t 238 5. Hamiltonicity and Related Problems Theorem 5.4.2 (Bang-Jensen) [50] A path-mergeable digraph D of order n ≥ 2 is hamiltonian if and only if D is strong and U G(D) is 2-connected. Proof: ‘Only if’ is obvious; we prove ‘if’. Suppose that D is strong, U G(D) is 2-connected and D is not hamiltonian. Let C = u1 u2 . . . up u1 be a longest cycle in D. Observe that, by Lemma 5.4.1, there is no C-bypass. For each i ∈ {1, . . . , p} let Xi (respectively Yi ) be the set of vertices of D − V (C) that can be reached from ui (respectively, from which ui can be reached) by a path in D − (V (C) − ui ). Since D is strong, X1 ∪ . . . ∪ Xp = Y1 ∪ . . . ∪ Yp = V (D) − V (C). Since there is no C-bypass, every path starting at a vertex in Xi and ending at a vertex in C must end at ui . Thus, Xi ⊆ Yi . Similarly, Yi ⊆ Xi and, hence, Xi = Yi . Since there is no C-bypass, the sets Xi are disjoint. Since we assumed that D is not hamiltonian, at least one of these sets, say X1 , is non-empty. Since U G(D) is 2-connected, there is an arc with one end-vertex in X1 and the other in V (D) − (X1 ∪ u1 ), and no matter what its orientation is, this implies that there is a C-bypass, a contradiction. u t Using the proof of this theorem, Lemma 5.4.1 and Proposition 4.9.3, it is not difficult to show the following (Exercise 5.10): Corollary 5.4.3 [50] There is an O(nm)-algorithm to decide whether a given strong path-mergeable digraph has a hamiltonian cycle and find one if it exists. Clearly, Theorem 5.4.2 and Corollary 5.4.3 imply an obvious characterization of longest cycles in path-mergeable digraphs and a polynomial algorithm to find a longest cycle. Neither a characterization nor the complexity of the hamiltonian path problem for path-mergeable digraphs is currently known. The following problem was posed by Bang-Jensen and Gutin: Problem 5.4.4 [65] Characterize traceable path-mergeable digraphs. Is there a polynomial algorithm to decide whether a path-mergeable digraph is traceable? For a related result, see Proposition 6.3.2. This result may be considered as a characterization of traceable path-mergeable digraphs. However, this characterization seems of not much value from the complexity point of view. 5.5 Hamilton Paths and Cycles in Locally In-Semicomplete Digraphs According to Proposition 4.10.1, every locally in-semicomplete digraph is path-mergeable. By Exercise 5.12, every strong locally in-semicomplete di- 5.5 Hamilton Paths and Cycles in Locally In-Semicomplete Digraphs 239 graph has a 2-connected underlying graph. Thus, Theorem 5.4.2 implies the following characterization of hamiltonian locally in-semicomplete digraphs2 . Theorem 5.5.1 (Bang-Jensen, Huang and Prisner) [81] A locally insemicomplete digraph D of order n ≥ 2 is hamiltonian if and only if D is strong. u t This theorem generalizes Camion’s theorem on strong tournaments (Theorem 1.5.2). Bang-Jensen and Hell [75] showed that for the class of locally in-semicomplete digraphs Corollary 5.4.3 can be improved to the following result. Theorem 5.5.2 [75] There is an O(m + n log n)-algorithm for finding a hamiltonian cycle in a strong locally in-semicomplete digraph. In Section 5.4, we remarked that the Hamilton path problem for pathmergeable digraphs is unsolved so far. For a subclass of this class, locally in-semicomplete digraphs, an elegant characterization, due to Bang-Jensen, Huang and Prisner, exists. Theorem 5.5.3 [81] A locally in-semicomplete digraph is traceable if and only if it contains an in-branching. Proof: Since a Hamilton path is an in-branching, it suffices to show that every locally in-semicomplete digraph D with an in-branching T is traceable. We prove this claim by induction on the number b of vertices of T of in-degree zero. For b = 1, the claim is trivial. Let b ≥ 2. Consider a pair of vertices x, y of in-degree zero in T . By the definition of an in-branching there is a vertex z in T such that T contains both (x, z)-path P and (y, z)-path Q. Assume that the only common vertex of P and Q is z. By Proposition 4.10.2, there is a path R in D that starts at x or y and terminates at z and V (R) = V (P ) ∪ V (Q). Using this path, we may replace T with an in-branching with b − 1 vertices of in-degree zero and apply the induction hypothesis of the claim. u t Clearly, Theorem 5.5.3 implies that a locally out-semicomplete digraph is traceable if and only if it contains an out-branching. By Proposition 1.6.1, we have the following: Corollary 5.5.4 A locally in-semicomplete digraph is traceable if and only if it contains only one terminal strong component. u t 2 Actually, this characterization, as well as the other results of this section, were originally proved only for oriented graphs. However, as can be seen from Exercises 4.27 and 4.28, the results for oriented graphs immediately imply the results of this section. 240 5. Hamiltonicity and Related Problems Using Corollary 5.5.4, Bang-Jensen and Hell [75] proved the following: Theorem 5.5.5 A longest path in a locally in-semicomplete digraph D can be found in time O(m + n log n). u t Corollary 5.5.4 and Lemma 4.10.3 imply the following: Corollary 5.5.6 (Bang-Jensen) [44] A locally semicomplete digraph has a hamiltonian path if and only if it is connected. u t Notice that there is a nice direct proof of this corollary (using Proposition 4.10.2), which is analogous to the classical proof of Rédei’s theorem displayed in procedure HamPathTour in Section 1.9.1. See Exercise 5.14. 5.6 Hamilton Cycles and Paths in Degree-Constrained Digraphs In Subsection 5.6.1 we formulate certain sufficient degree-constrained conditions for hamiltonicity of digraphs. Several of these conditions do not follow from the others, i.e. there are certain digraphs that can be proved to be hamiltonian using some condition but none of the others. (The reader will be asked to show this in the exercises.) In Subsection 5.6.3 we provide proofs to some of these conditions to illustrate the power of a recently introduced approach, which we call the multiinsertion technique. (This technique can be traced back to Ainouche [9] for undirected graphs and to Bang-Jensen [48] for digraphs, see also the paper [68] by Bang-Jensen, Gutin and Huang). The technique itself is introduced in Subsection 5.6.2. The strength of the multi-insertion technique lies in the fact that we can prove the existence of a hamiltonian cycle without actually exhibiting it. Moreover, our hamiltonian cycles may have quite a complicated structure. For example, compare the hamiltonian cycles in the proof of Theorem 5.6.1 to the hamiltonian paths constructed in the inductive proof of Theorem 1.4.5. The multi-insertion technique is used in some other parts of this book, see e.g. Section 5.7. Let x, y be a pair of distinct vertices in a digraph D. The pair {x, y} is dominated by a vertex z if z→x and z→y; in this case we say that the pair {x, y} is dominated. Likewise, {x, y} dominates a vertex z if x→z and y→z; we call the pair {x, y} dominating. 5.6.1 Sufficient Conditions Considering the converse digraph and using Theorem 5.5.1, we see that a locally out-semicomplete digraph is hamiltonian if and only if it is strong. This can be generalized as follows. We prove Theorem 5.6.1 in Subsection 5.6.3. 5.6 Hamilton Cycles and Paths in Degree-Constrained Digraphs 241 Theorem 5.6.1 (Bang-Jensen, Gutin and Li) [69] Let D be a strong digraph of order n ≥ 2. Suppose that, for every dominated pair of non-adjacent vertices {x, y}, either d(x) ≥ n and d(y) ≥ n−1 or d(x) ≥ n−1 and d(y) ≥ n. Then D is hamiltonian. The following example shows the sharpness of the conditions of Theorem 5.6.1 (and Theorem 5.6.5), see Figure 5.3. Let G and H be two disjoint transitive tournaments such that |V (G)| ≥ 2, |V (H)| ≥ 2. Let w be the vertex of out-degree 0 in G and w0 the vertex of in-degree 0 in H. Form a new digraph by identifying w and w0 to one vertex z. Add four new vertices x, y, u, v and the arcs {xv, yv, ux, uy} ∪ {xz, zx, yz, zy} ∪ {rg : r ∈ {x, y, v}, g ∈ V (G) − w} ∪ {hs : h ∈ V (H) − w0 , s ∈ {u, x, y}}. Denote the resulting digraph by Qn , where n is the order of Qn . It is easy to check that Qn is strong and non-hamiltonian (Exercise 5.17). Also x, y is the only pair of non-adjacent vertices which is dominating (dominated, respectively). An easy computation shows that d(x) = d(y) = n − 1 = d+ (x) + d− (y) = d− (x) + d+ (y). v y x u z G−w H − w0 Figure 5.3 The digraph Qn . The two unoriented edges denote 2-cycles. Combining Theorem 5.6.1 with Proposition 5.0.3 one can obtain sufficient conditions for a digraph to be traceable (see also Exercise 5.16). Theorem 5.6.1 also has the following immediate corollaries. Corollary 5.6.2 (Ghouila-Houri) [315] If the degree of every vertex in a strong digraph D of order n is at least n, then D is hamiltonian. u t Corollary 5.6.3 Let D be a digraph of order n. If the minimum semi-degree of D, δ 0 (D) ≥ n/2, then D is hamiltonian. u t It turns out that even a slight relaxation of Corollary 5.6.3 brings in nonhamiltonian digraphs. In particular, Darbinyan [177] proved the following: 242 5. Hamiltonicity and Related Problems Proposition 5.6.4 Let D be a digraph of even order n ≥ 4 such that the degree of every vertex of D is at least n − 1 and δ 0 (D) ≥ n/2 − 1. Then either D is hamiltonian or D belongs to a non-empty finite family of nonhamiltonian digraphs. u t By Theorem 5.5.1, a locally semicomplete digraph is hamiltonian if and only if it is strong [44]. This result was generalized by Bang-Jensen, Gutin and Li [69] as follows. Theorem 5.6.5 Let D be a strong digraph of order n. Suppose that D satisfies min{d+ (x) + d− (y), d− (x) + d+ (y)} ≥ n for every pair of dominating non-adjacent and every pair of dominated non-adjacent vertices {x, y}. Then D is hamiltonian. We prove this theorem in Subsection 5.6.3. Theorem 5.6.5 implies Corollary 5.6.3 as well as the following theorem by Woodall [739]: Corollary 5.6.6 Let D be a digraph of order n ≥ 2. If d+ (x) + d− (y) ≥ n for all pairs of vertices x and y such that there is no arc from x to y, then D is hamiltonian. u t The following theorem generalizes Corollaries 5.6.2, 5.6.3 and 5.6.6. The ↔ inequality of Theorem 5.6.7 is best possible: Consider K n−2 (n ≥ 5) and fix ↔ a vertex u in this digraph. Construct the digraph Hn by adding to K n−2 a ↔ pair v, w of vertices such that both v and w dominate every vertex in K n−2 and are dominated by only u, see Figure 5.4. It is easy to see that Hn is strong and non-hamiltonian (Hn − u is not traceable). However, v, w is the only pair of non-adjacent vertices in Hn and d(v) + d(w) = 2n − 2. v w u ↔ K n−3 Figure 5.4 The digraph Hn . Theorem 5.6.7 (Meyniel’s theorem) [564] Let D be a strong digraph of order n ≥ 2. If d(x) + d(y) ≥ 2n − 1 for all pairs of non-adjacent vertices in D, then D is hamiltonian. u t