Journal of Algorithms 36, 253᎐275 Ž2000. doi:10.1006rjagm.2000.1085, available online at http:rrwww.idealibrary.com on
Finding an Oriented Hamiltonian Path in a Tournament Frederic ´ ´ Havet Laboratoire LMD, UFR de Mathematiques, Uni¨ ersite´ Claude Bernard, 43, Boule¨ ard ´ du 11 no¨ embre 1918, 69622 Villeurbanne Cedex, France E-mail:
[email protected] Received June 2, 1999
We present an O Ž n2 . algorithm for finding a specified oriented path of order at least n in a tournament of order n. Using this algorithm, we present an O Ž n2 . algorithm that finds a specified oriented path from a given vertex if one exists. 䊚 2000 Academic Press
One of the earliest results on tournaments is Redei’s theorem, which ´ asserts that every tournament has a directed hamiltonian path. His proof yields an algorithm in O Ž n2 . finding such a path in a tournament. Hell and Rosenfeld w4x gave a faster algorithm, in time O Ž n log n., for the same problem. This algorithm is an analog of the binary tree insertion sort. In the particular case of a transitive tournament, it is optimal: finding a directed hamiltonian path is equivalent to sorting its vertices. Hell and Rosenfeld w4x also showed that, for all 0 F ␣ F 1, there exist paths that require O Ž n log ␣ n. comparisons to be found. In particular, they proved that finding an alternating hamiltonian path Žin which adjacent arcs have opposite sense. necessitates O Ž n. comparisons. Bampis et al. w1x described an algorithm in time O Ž n. which finds an alternating hamiltonian path in a tournament. In 1986, Thomason w6x proved that every sufficiently large tournament Žof order at least 2 128 . contains every oriented hamiltonian path. However, as no efficient algorithm was known to find an arbitrary oriented hamiltonian path in a tournament, even in one sufficiently large, Thomason’s proof was not constructive. Recently, Havet and Thomasse ´ w3x proved that with three exceptions Žof orders 3, 5, and 7., every tournament of order n contains every oriented hamiltonian path. 253 0196-6774r00 $35.00 Copyright 䊚 2000 by Academic Press All rights of reproduction in any form reserved.
254
FREDERIC HAVET ´ ´
Using the results of w3x, we present here an algorithm in time O Ž n2 . that, given a tournament T of order n and an oriented path P of order at most n, finds an occurrence of P in T. This algorithm is based on Theorem 1 below. Because of the exceptional cases in this theorem, it requires some special subroutines to examine these exceptions. In order to give a clearer view of this algorithm, we first present it with a restriction to paths of order at most n y 1. In this case, there are no exceptions to Theorem 1 and thus no special subroutines are needed. To conclude, we apply our algorithm to show how to find a specified oriented path of order at most n starting from a given vertex in a tournament of order n, if such a path exists.
1. PRELIMINARIES DEFINITION 1. A tournament is an orientation of the edges of a complete graph. Let T be a tournament. If X is a subset of V ŽT ., the subtournament of T induced by X is denoted by T Ž X .; for convenience we denote T Ž V _ X . by T y X and T y x 4 by T y x. Let D be a digraph. We say that T contains D if D is a subgraph of T. The order of a digraph D, denoted by < D <, is its number of vertices. An oriented path of order n is an orientation of the path P s Ž x 1 , . . . , x n .. Occasionally, we abbreviate ‘‘oriented path’’ to ‘‘path.’’ Let P s Ž x 1 , . . . , x n . be a path. We say that x 1 is the origin of P and x n is the terminus of P. If x 1 ª x 2 , P is an outpath; otherwise, P is an inpath. The directed outpath of order n is the path P s Ž x 1 , . . . , x n . in which x i ª x iq1 for all i, 1 F i - n; the dual notion is the directed inpath. The length of a path is its number of arcs. We denote the path Ž x 2 , . . . , x n . by *P. The blocks of P are the maximal directed subpaths of P. We enumerate the blocks of P from the origin to the terminus. The first block of P is denoted by B1Ž P . and its length by b1Ž P .. Likewise, the ith block of P is denoted by Bi Ž P . and its length by bi Ž P .. The path P is totally described by the signed sequence sgnŽ P .Ž b1Ž P ., b 2 Ž P ., . . . , bk Ž P .., where k is the number of blocks of P and sgnŽ P . s q if P is an outpath and sgnŽ P . s y if P is an inpath. Let X be a subset of vertices of T. We denote by I X Žresp., OX . an arbitrary directed hamiltonian inpath Žresp., outpath. of T Ž X .. The dual Žsometimes called the converse. of a tournament T is the tournament yT on the same set of vertices such that x ª y is an arc of yT if and only if y ª x is an arc of T. Likewise, the dual of a path P is the path, denoted yP, on the same set of vertices such that x ª y is an arc of yP if and only if y ª x is an arc of P.
FINDING AN ORIENTED HAMILTONIAN PATH
255
A tournament is strong if for any two vertices x and y there exists a directed outpath with origin x and terminus y. A Žstrong. component of T is a strong subtournament of T which is maximal with respect to inclusion. A tournament is k-strong if < V ŽT .< G k q 1 and T y X is strong for any set X of k y 1 vertices. Let X be a set of vertices of T. The outsection generated by X in T is the set of vertices y to which there exists a directed outpath from x g X; we denote this set by STqŽ X . Žnote th at X : STqŽ X . since we allow paths of length zero.. We abbreviate STqŽ x 4. to STqŽ x . and STqŽ x, y4. to STqŽ x, y .. Ž . The dual notion, the insection, is denoted by SyŽ X .. We also write sq T X qŽ yŽ Žresp. sy Ž .. . Ž .. X for the number of vertices of S X resp., S X . If T T T q Ž Ž . . X : Y : V, we write Sq X instead of S X . An outgenerator of T is a Y T ŽY . vertex x g T such that SqŽ x . s t; the dual notion is an ingenerator. Our algorithm is based on the following theorem and its dual: THEOREM 1 ŽHavet and Thomasse ´ w3x.. Let T be a tournament of order Ž . Ž . n, P an outpath, and x and y two ¨ ertices of T such that sq T x, y G b 1 P q 1. Ž1. If < P < F n y 1 then x or y is an origin of P in T. Ž2. If < P < s n G 8 and ŽT ; P . is not an exception Fi , then x or y is an origin of P in T. DEFINITION 2. We now introduce the exceptions Fi Ž n. s Ž Fi Ž n., P ., where Fi Ž n. is the tournament on n vertices depicted as Fi in Fig. 1. We denote by S the set of vertices of Fi Ž n. which are not origins of P. Conditions are given on the tournament. Finally, we give the paths P with origin x f S. F1Ž n. s Ž F1Ž n., Ž1, n y 2..; S s 1, 2, 3x. Conditions: < A < G 1. Paths: For any u g A, P s u132 IA_u4. F2 Ž n. s Ž F2 Ž n., Ž2, n y 3..; S s 3, 4x. Conditions: < A < G 1. Paths: P s 1234IA , P s 2314IA , and for any u g A, P s u4321 IA_u4. F3 Ž n. s Ž F3 Ž n., Ž1, n y 2..; S s 1, 34 . Conditions: NqŽ 3. / 24 and 3 is an ingenerator of T Ž A. Žin particular, there exists a directed hamiltonian inpath u3 R1 of T Ž A. and another 3 ¨ R 2 of T Ž A... Paths: P s 21u3 R1 , and for any y g A _ 34 , P s y12 IA_ y4. F4Ž n. s Ž F4Ž n., Ž2, n y 3..; S s 1, 44 . Conditions: NqŽ 3. / 24 and 3 is an ingenerator of T Ž A. Žin particular, there exists a directed hamiltonian inpath u3 R1 of T Ž A. and another 3 ¨ R 2 of T Ž A... Paths: P s 214u3 R1 , P s 3241¨ R 2 , and for any y g A _ 34 , P s y142 IA_ y4. F5 Ž n. s Ž F5 Ž n., Ž1, n y 2..; S s 1, 24 . Conditions: n G 5, < B < G 2, and 2 is an ingenerator of T Ž A.. Paths: for any x g A _ 24 , P s x1 IB IA x4 , and for any y g B, P s y1 IB _ y4 IA .
256
FREDERIC HAVET ´ ´
FIG. 1. Tournaments Fi .
F6 Ž n. s Ž F6 Ž n., Ž2, n y 3..; S s 1, 34 . Conditions: < B < G 2 and 2 is an ingenerator of T Ž A.. Paths: for any x g A, P s xz13 IB _ z4 IA_ x4 Žfor a given z g B ., and for any y g B, P s y31 IB _ y4 IA . F7 Ž n. s Ž F7 Ž n., Ž1, 1, n y 3.., S s 2, 34 . Conditions: T Ž B . is not a 3-cycle Ži.e., T Ž B . is not isomorphic to T3 . and < B < G 3. Paths: since T Ž B . is not the 3-cycle, there is a path Q s yŽ1, n y 5. in T Ž B .. ŽThis is clear if
FINDING AN ORIENTED HAMILTONIAN PATH
257
T Ž B . is not strongly connected; if T Ž B . is strongly connected with at least 4 vertices, one can find a vertex w g B such that T Ž B . _ w4 is strongly connected. Such a vertex w is certainly an origin of Q.. We then have P s 1Q32. For any y g B, P s y231OB _ y4. F8 s Ž F8 Ž n., Ž n y 4, 1, 1, 1..; S s A. Conditions: T3 is the 3-cycle, its set of vertices is 1, 2, 34 , and we furthermore need < A < G 2. Paths: P s 1OA_u4 2 u3, P s 2 OA_u41u3, and P s 3OA_u4 2 u1 for a given u g A. F8X Ž n. s Ž F8 Ž n., Ž n y 4, 2, 1..; S s A. Conditions: T3 is the 3-cycle, its set of vertices is 1, 2, 34 , and we furthermore need < A < G 2. Paths: P s 1OA_u4 32 u, P s 2 OA_u413u, and P s 3OA_u4 21u for a given u g A. F9 Ž n. s Ž F9 Ž n., Ž n y 6, 1, 1, 1, 1, 1..; S s A. Conditions: T5 is the 2regular tournament, its set of vertices is 1, 2, 3, 4, 54 , and we furthermore need < A < G 2. Paths: P s 1OA_u4 2 u453, P s 2 OA_u4 3u514, P s 3OA_u44 u125, P s 4 PA_u4 5u231, and P s 5OA_u41u342 for a given u g A. F9X Ž n. s Ž F9 Ž n., Ž n y 6, 2, 1, 1, 1..; S s A. Conditions: T5 is the 2-regular tournament, its set of vertices is 1, 2, 3, 4, 54 , and we furthermore need < A < G 2. Paths: P s 1OA_u4 32 u45, P s 2 OA_u443u51, P s 3OA_u4 54 u12, P s 4OA_u415u23, and P s 5OA_u4 21u34 for a given u g A. F10 Ž n. s Ž F10 Ž n., Ž n y 8, 1, 1, 1, 1, 1, 1, 1..; S s A. Conditions: T7 is the Paley tournament on 7 vertices, its set of vertices is 1, 2, 3, 4, 5, 6, 74 , and we furthermore need < A < G 2. Paths: P s 1OA_u4 2 u45376, P s 2 OA _u4 3u56417, P s 3OA _u44 u67521, P s 4 OA _u4 5u71632, P s 5OA_u46 u12743, P s 6OA_u47u23154, and P s 7OA_u41u34265 for a given u g A. F10X Ž n. s ŽŽ F10 Ž n., Ž n y 8, 2, 1, 1, 1, 1, 1..; S s A. Conditions: T7 is the Paley tournament on 7 vertices, its set of vertices is 1, 2, 3, 4, 5, 6, 74 , and we furthermore need < A < G 2. Paths: P s 1OA_u4 32 u4657, P s 2 OA _u443u5761, P s 3OA _u4 54 u6172, P s 4 OA _u4 65u7213, P s 5OA_u476 u1324, P s 6OA_u417u2435, and P s 7OA_u4 21u3546 for a given u g A. F11Ž n. s Ž F11Ž n., Ž1, 1, n y 3..; S s 1, 24 . Conditions: < A < G 2. Paths: P s 31OA 2 and, for all u g A, P s u1OA_u4 23. F12 Ž n. s Ž F12 Ž n., Ž2, 1, n y 4..; S s 1, 44 . Conditions: < A < G 2. Paths: P s 231OA 4 and, for all u g A, P s u41OA_u4 23. F13 Ž n. s Ž F13 Ž n., Ž1, 1, n y 3..; S s 1, 24 . Conditions: < A < G 2. Paths: P s 3425OA1, P s 4523OA1, P s 5324OA1, and, for all u, ¨ in A, P s u1¨ 2345OA_u, ¨ 4. F14 Ž n. s Ž F14 Ž n., Ž2, 1, n y 4..; S s 1, 64 . Conditions: < A < G 2. Paths: for every vertex u of A, P s 24 u53OA_u461, P s 3u16245OA_u4 , P s 4 u16253OA_u4 , P s 5u16234OA_u4 , and P s u61345OA_u4 2.
FREDERIC HAVET ´ ´
258
In view of Theorem 1, we say that two vertices x and y are potential Ž . Ž . origins of P in T if sq T x, y G b 1 P q 1 when P is an outpath and if Ž . Ž . sy x, y G b P q 1 when P is an inpath. T 1 The basic idea of our algorithm is to construct step by step the path P in T. Suppose that P is an outpath and that x and y are potential origins of P in T. By Theorem 1, at least one of these two vertices is an origin of T. We determine next which of x and y is an origin of P by finding two outneighbours of this fixed vertex t which are potential origins of *P in T y t. We then reapply this process until the whole path is constructed. This process remains valid whenever Theorem 1 is valid. Thus whenever our process leads to an exception we must incorporate a special routine. We first describe an algorithm to find a path of order at most n y 1 in a tournament of order n. As there is no exception to Theorem 1 in this case, we do not require any special subroutine. We will often use the following proposition Žwithout specifically referring to it. for finding two potential origins of a path in a tournament. The proposition guarantees that whenever we execute n y 1pathŽ P⬘, T ⬘, u, ¨ . or pathŽ P⬘, T ⬘, u, ¨ . described below, the vertices x and y are potential origins of P⬘ in T ⬘. PROPOSITION 1. Let X be a set of ¨ ertices of a tournament T and t be an qŽ . Ž . outgenerator of X. Then sq T X s sT t . In particular, if t is an outgenerator qŽ . q Ž . qŽ . of NT x then sT x s sTyx t q 1. 2. FINDING A PATH OF ORDER AT MOST n y 1 IN A TOURNAMENT OF ORDER n 2.1. The Algorithm The routine n-1pathŽT, P, x, y . below corresponds to Theorem 1.1 and its dual : with input a tournament of order n, a path of order at most n y 1, and two potential origins x and y of P in T, it returns an occurrence of P in T with origin x or y. It is divided into two dual routines, n-1pathq and n-1pathy , depending on whether P is an outpath or an inpath. Because these two routines are duals we present just one of them here, n-1pathq . n-1pathqŽT, P, x, y . Begin If x ¤ y, do n-1pathqŽT, P, y, x .. Now x ª y. If < P < s 1, return Ž x, y ..
FINDING AN ORIENTED HAMILTONIAN PATH
259
If b1Ž P . G 2, Ž . If dq T x G 2, Find an outgenerator z of NTqŽ x . and t g NTqŽ x . _ z 4 . Return Ž x, n-1pathqŽT y x, *P, z, t .. Ž . Else dq T x s 1. Find an outgenerator z of NTqŽ y ., Return Ž y, n-1pathqŽT y y, *P, z, x ... Note that n-1pathqŽT y y, *P, z, x . certainly returns a path with origin z because x ¤ u for e¨ ery u g V ŽT y y . and *P is an outpath. Else b1Ž P . s 1. Ž . If dq T x G 2, Find an ingenerator z of NTqŽ x . and t g NTq_ z 4 . Ž . Ž . If sy Ty x z G b 2 P q 1, Return Ž x, n-1pathyŽT y x, *P, z, t ... y Ž .. Else, set Y s T y Ž x, STy x z . Find an ingenerator u of Y and ¨ g Y y u. Return Ž y, n-1pathyŽT y y, *P, u, ¨ ... Ž . Else dq T x s 1. qŽ . If dT y - 2, y Ž . Find an outgenerator x⬘ and an ingenerator y⬘ of NTy x y . Return Ž x, y, n-1pathŽT y Ž x, y ., **P, x⬘, y⬘...
Ž . Else dq T y G 2, Find an ingenerator z of NTqŽ y . and t g NTqŽ y . _ z 4 . Ž . Ž . If sy Ty y z G b 2 P q 1, Return Ž y, n-1path I ŽT y y, *P, z, t ... Ž . Ž . Else sy Ty y z F b 2 P . y Ž . . Set X s T y Ž STy y z , x, y .
Find an ingenerator ¨ of X. If < X < G 2, let u g X y ¨ . Return Ž x, y, n-1pathŽT y Ž x, y ., **P, ¨ , u... Else find a directed hamiltonian inpath H of T y Ž x, y, ¨ .. Return Ž x, y, ¨ , *H .. End
260
FREDERIC HAVET ´ ´
This algorithm readily yields an algorithm smallpath to find an occurrence of a path P of order at most n y 1 in a tournament of order n. It suffices to find an outgenerator x of T and an ingenerator y of T y x and to run n-1pathŽT, P, x, y .. 2.2. Complexity The above algorithm necessitates subroutines that Ž1. find the out- and inneighbourhoods of a vertex; Ž2. find an ingenerator Žor outgenerator. of a tournament; Ž3. test whether the insection Žor outsection. is greater than a given integer k; Ž4. remove a vertex of a tournament. Ž1. Finding the outneighbourhood and inneighbourhood of a vertex x in a tournament of order n requires n y 1 comparisons Žwe must compare x to all other vertices.. Ž2. One can find an ingenerator of a tournament of order n by doing n y 1 comparisons. Indeed, assume that we have an ingenerator y of the tournament T y x. We just need to compare x and y to know which of them is an ingenerator of T. If x ¤ y, it is x; otherwise it is y. Ž3. Testing if the insection induced by a set S in a tournament of order n has size greater than k requires O Ž k ⭈ n. operations. Indeed, one can find an ingenerator x of S or of any k-subset of S if < S < G k with k comparisons. And if < S < - k, it suffices to construct an in-arborescence with root x Žthat is, a tree such that all induced paths with origin x are inpaths. as big as possible and stop whenever the tree has order k. This can be achieved with a breadth-first or depth-first search algorithm in O Ž kn. operations. Ž4. Removal of a vertex from a tournament can be effected in O Ž n. operations. It is, for example, equivalent to removing a row and a column from the adjacency matrix of the tournament. In the above algorithm, one computes the outneighbourhood and inneighbourhood of at most two vertices Ž x and y . in each loop of the n-1path. So we determine for out- and inneighbourhoods at most 2 n y 2 times. To do this, we need fewer than n2 comparisons. In each loop of n-1path, one has to find at most two in- or outgenerators. This necessitates fewer than 2 n2 comparisons. We test if an insection Žor outsection. is bigger than the length of the second block of the path only when the first block of the path is of length one. Thus the algorithm does this whenever it has to fix the last edge of a
FINDING AN ORIENTED HAMILTONIAN PATH
261
block. So, if P s Ž b1 , b 2 , . . . , bl ., computing the size of the in- or outsection requires O Ž b 2 ⭈ n. q O Ž b 3 ⭈ n. q ⭈⭈⭈ qOŽ bl ⭈ n. s O Ž n2 . operations. Finally, the algorithm removes a vertex from a tournament n y 2 times, and this takes O Ž n2 . operations. Thus, the above algorithm runs in O Ž n2 . time. Remark 1. This algorithm is easy to implement. It has been implemented in Scheme. ŽSee w2, Annexe Ax..
3. FINDING A HAMILTONIAN PATH IN A TOURNAMENT 3.1. The Algorithm The general algorithm is based on a routine pathŽT, P, x, y . that corresponds to Theorem 1 and its dual. This routine is based on the same principles as n-1path. It is also divided into two dual routines, pathq and pathy . Because of this duality, we present only pathq here. With input a tournament T of order n, an outpath P of order at most n such that ŽT ; P . is not an exception, and two potential origins x and y of P in T, pathq returns an occurrence of P in T with origin x or y. The idea is to find the vertex t g x, y4 and two outneighbours u, ¨ of t which are potential origins of *P in T y t. The problem is that Theorem 1 guarantees the existence of an origin of *P of u, ¨ 4 only if ŽT y t, *P . is not an exception. So we must check whether ŽT y t, *P . is an exception or not. If it is not, we execute a recursive call to pathŽT y t, *P, u, ¨ .. Otherwise, we have to run certain subroutines : extension1, extension2, and tombexcepi, i g 1, 2, 3, 44 . Moreover, it is sometimes difficult to find the vertex t and two of its outneighbours which are potential origins of *P in T y t, but it is easy to find P in T with origin x or y. In such cases, we apply one of the routines special which returns such an occurrence of P in T. Since Theorem 1.2 is valid when n G 9, we need a routine path9-1011ŽT, P, x, y . that gives the result whenever T and P have the same order n g 9, 10, 114 . Indeed, this routine for 9, 10, and 11 is enough since the following routine path calls itself with tournaments having at most three fewer vertices. pathq ŽT, P, x, y . Begin If x ¤ y, do pathq ŽT, P, y, x ..
FREDERIC HAVET ´ ´
262 Now x ª y.
If T has order 9, 10, or 11, return path9-10-11ŽT, P, y, x .. If b1Ž P . G 2, Ž . If dq T x G 2, If ŽT y x; *P . is an exception, do extension1ŽT, P, x, y .. Else find an outgenerator z of NqŽ x . and t g NqŽ x . y z. Return Ž x, pathq ŽT y x, *P, z, t ... Ž . Else dq T x s 1. If ŽT y y; *P . is an exception, do tombexcep1ŽT, P, x, y .. Else find an outgenerator z of NqŽ y .. Return Ž y, pathq ŽT y y, *P, z, x ... Else b1Ž P . s 1. y Ž qŽ .. Set X s STy x . x N Ž . < < Ž . If dq T x G 2 and X G b 2 P q 1, If ŽT y x, *P . is an exception, do extension2ŽT, P, x, y .. Else find an ingenerator z of NqŽ x . and t g NqŽ x . y z. Return Ž x, path y ŽT y x, *P, z, t ... Ž . < < Ž . If dq T x G 2 et X F b 2 P , If P s qŽ1, n y 2., P s qŽ1, n y 3, 1., P s qŽ1, n y 4, 2. or P s qŽ1, n y 4, 1, 1., do special1. Else we have < X < F b 2 Ž P . F n y 5. Set Y s T y Ž x, X .. Find an ingenerator z of Y and t g Y y z. Return Ž y, pathŽT y y, *P, z, t ... Ž . < < Ž . If dq T x s 1 et X G b 2 P q 1, qŽ . If dT y s 0, Find an outgenerator z of T y Ž x, y . and an ingenerator t of T y Ž x, y .. Return Ž x, y, pathŽT y Ž x, y ., **P, z, t ... Ž . If dq T y s 1, If ŽT y Ž x, y .; **P . is an exception, do tombexcep2ŽT, P, x, y ..
FINDING AN ORIENTED HAMILTONIAN PATH
263
Else ŽT y Ž x, y .; **P . is not an exception. If P s Ž1, n y 2. or P s Ž1, 1, n y 3. do special2. Else b1Ž**P . q 1 - n y 2 s < T y Ž x, y .<. Find an outgenerator u and an ingenerator ¨ of ŽT y Ž x, y .. q Ž . If u s z, replace u by an outgenerator of NTy Ž x, y . u . y If ¨ s z, replace ¨ by an ingenerator of NTy Ž x, y .Ž ¨ .. Return Ž x, y; pathŽT y Ž x, y ., **P, u, ¨ ... Ž . Else dy T y G 2. y Ž qŽ .. Set Z s STy y and W s T y Ž Z, x, y .. y N If < Z < G b 2 Ž P . q 1, If ŽT y y; *P . is an exception, do tombexcep3ŽT, P, x, y .. Else find an ingenerator z of NqŽ y . and t g NqŽ y . y z. Return Ž y, path y ŽT y y, *P, z, t ... Else < Z < F b 2 Ž P .. If ŽT y Ž x, y .; **P . is an exception, do tombexcep4ŽT, P, x, y .. Else, If < W < G 2, Find an ingenerator u of W and ¨ g W y u. Return Ž x, y, pathŽT y Ž x, y ., **P, u, ¨ ... If < W < s 1, say W s w4 , If y is dominated by a vertex ¨ of Z, Return x, y, pathŽT y Ž x, y ., **P, w, ¨ ... Else Z s NqŽ y .. Find an ingenerator u and an outgenerator ¨ of T y Ž x, y, w .. Return Ž x, y, z, pathŽT y Ž x, y, w ., **P, u, ¨ ... Else W s ⭋, thus P s qŽ1, n y 2. and y is an ingenerator of T y x. Return special3ŽT, x, y .. Ž . < < Ž . If dq T x s 1 and X F b 2 P , Set Y s T y Ž x, X .. We have < Y < G 2 and b 2 Ž P . G n y 2 because ŽT ; P . is not an exception.
FREDERIC HAVET ´ ´
264
If ŽT y y; *P . is an exception, do tombexcep5ŽT, P, x, y .. Else find an ingenerator u of Y and ¨ g Y y u. Return Ž y, pathŽT y y, *P, u, ¨ ... End This routine path, together with a routine pathexcep that for every exception ŽT ; P . returns an occurrence of P in T, yields an algorithm to find a path P of order at most n in a tournament T of order n; in particular, it finds hamiltonian paths in tournaments. If ŽT ; P . is an exception, we run pathexcep; otherwise, we find an ingenerator x and an outgenerator y of T and run pathŽT, P, x, y .. 3.2. Subroutines The above algorithms require the use of subroutines called by n-1path. Moreover, we have to recognize exceptions and to execute the subroutines extension, tombexcep, and special. We present in this subsection all of these routines. Note that we only present the routines required by pathq . So we also need the dual of each of these in order to perform pathy . 3.2.1. Recognizing Exceptions To check if a pair ŽT ; P . is an exception, we first check if P is a path occurring in one of the exceptions. Since every such path has at most eight blocks, this can be checked in constant time. Next, if P corresponds to an exception Fi , we have to check if T is a tournament Fi . For this task, it is sufficient to look at vertices with small ŽF 3. out- or indegree and then to look at the subtournament induced by these vertices. For example, to check if a tournament belongs to F1 , it suffices to check if it has three vertices of outdegree 1. To check if a tournament belongs to F2 , it suffices to check that it has exactly two vertices of outdegree 1, say x 1 and x 3 , and exactly two vertices of outdegree 2, say x 2 and x 4 ; such that x 1 ª x 2 and x 2 ª x 3 , x 4 4. Now one can find all the vertices of outdegree at most k in a tournament of order n with at most Ž2 k q 1. n comparisons using the following algorithm. This algorithm examines each vertex of x 1 , x 2 , . . . , x n4 in turn and memorizes the list L of vertices which might have outdegree at most k, that is, the vertices whose outdegree in T Ž x 1 , . . . , x i . is at most k: Begin Initialize L to empty list.
FINDING AN ORIENTED HAMILTONIAN PATH
265
For each vertex x do: Initialize the temporary outdegree of x to 0. For each vertex y of L do: If x dominates y then increment the temporary outdegree of x. Else increment the temporary outdegree of y. Put x in L. Remove all vertices of L with temporary outdegree greater than k. End In this algorithm, each vertex in turn is compared with all vertices of L. Since the vertices of L have outdegree at most k in the tournament induced by the vertices already visited, L contains at most 2 k q 1 vertices. So this algorithm requires at most Ž2 k q 1. n comparisons. Hence, we can check whether ŽT ; P . is an exception in time O Ž n.. 3.2.2. Subroutines pathexcep The subroutine pathexcepŽT, P, x . returns an occurrence of P in T with origin x whenever ŽT ; P . is an exception Fi and x is an origin of P in T. Such a path of origin x is given in Definition 2. Therefore, it only requires to find directed hamiltonian paths of subtournaments. So it can be executed in time O Ž n log n. with the algorithm of Hell and Rosenfeld w4x. 3.2.3. Subroutines extension For all the following procedures, we will use the notation of Fig. 1. So the tournaments A and B and the vertices 1, 2, . . . are those depicted in Fig. 1. The subroutine extension1 finds the desired path P whenever b1Ž P . G 2 and the vertex x has outdegree 2, but path cannot be used on ŽT y x; *P . because it is an exception. extension1ŽT, P, x, y . Begin Set S the set of vertices of T which are not origins of *P in T y x. If NTqŽ x . o S, Pick u a vertex of NTqŽ x . _ S and ¨ an outneighbour of x distinct from u. Return Ž x, pathŽT y x, *P, u, ¨ .. Else, since ŽT ; P . is not an exception, ŽT y x, *P . is an exception Fi for i g 1, 2, 4, 6, 7, 12, 144 .
266
FREDERIC HAVET ´ ´
If ŽT y x; *P . is exception F1 , Find a directed hamiltonian inpath IA of A s NTyŽ x .. Free to rename vertices, one can assume y s 1, return Ž1, 2, 3, x, IA .. Ž If T y x; *P . is exception F2 , Find a directed hamiltonian inpath IA of A. If y s 3, return Ž3, 1, 2, 4, x, IA .; if y s 4 return Ž4, 1, 2, 3, x, IA .. If ŽT y x; *P . is exception F4 , Find a directed hamiltonian inpath IAy 3 of A y 3. If y s 1, return Ž1, 3, x, 4, 2, IAy 3 .; if y s 4, return Ž4, 3, x, 1, 2, IAy 3 .. Ž If T y x; *P . is exception F6 , Find a directed hamiltonian inpath IB of B Find a directed hamiltonian inpath IAy 2 of A y 2. If y s 1, return Ž1, 2, x, 3, IB , IAy2 .; if y s 3, return Ž3, 2, x, 1, IB , IAy2 .. If ŽT y x; *P . is exception F7 , Find OB of B. If y s 2, return Ž2, 1, x, OB , 3.; if y s 3 return Ž3, 1, x, OB , 2.. If ŽT y x; *P . is exception F12 . Find a directed hamiltonian outpath OA of A. If y s 1, return Ž1, 2, x, 4, 3, OA .; if y s 6, return Ž6, 2, x, 1, 3, 4, 5, OA .. End extension2ŽT, P, x, y . Begin Let S be the set of vertices of T which are not origins of *P in T y x. If NTqŽ x . o S, Pick a vertex u of NTqŽ x . _ S and ¨ an outneighbour of x distinct from u. Return Ž x, pathŽT y x, *P, u, ¨ .. Else, If ŽT y x; *P . is exception F1 dual, If NqŽ x . s 1, 2, 34 , then, by renaming if necessary, y s 1. Find a directed hamiltonian outpath OA of A. Return Ž1, 3, x, 2, OA ..
FINDING AN ORIENTED HAMILTONIAN PATH
267
Else NqŽ x . s 1, 24 Žby renaming if necessary .. Pick a vertex u of A. Find a directed hamiltonian outpath OAy u of A y u. If y s 1, return Ž1, u, 3, x, 2, OAy u .; if y s 2, return Ž2, u, 3, x, 1, OAy u .. If ŽT y x; *P . is exception F2 dual, Find a directed hamiltonian outpath OA of A. If y s 3, return Ž3, 2, 4, 1, OA , x .; if y s 4, return Ž4, 2, 3, 1, OA , x .. If ŽT y x; *P . is exception F3 dual, If y s 1, find a directed hamiltonian outpath Ž u, 3, R1 . of A. Return Ž1, u, 2, x, 3, R1 .. If y s 3, find a directed hamiltonian outpath Ž3, ¨ , R 2 . of A. Return Ž3, ¨ , 1, 2, R 2 , x .. If ŽT y x; *P . is exception F4 dual, Find a directed hamiltonian outpath Ž3, ¨ , R 2 . of A. If y s 1, return Ž1, ¨ , 3, 2, x, 4, R 2 .; if y s 4, return Ž4, ¨ , 3, 2, x, 1, R 2 .. If ŽT y x; *P . is exception F5 dual, If y s 1, find a directed hamiltonian outpath of A, Ž2, Q, ¨ .. Find a directed hamiltonian outpath OB of B. Return Ž1, ¨ , OB , x, 2, Q .. If y s 2, find a directed hamiltonian outpath OB of B. Find a vertex u of A that is dominated by 2. Find a directed hamiltonian outpath O of A y Ž u, 2.. Return Ž2, u, OB , x, 1, O .. If ŽT y x; *P . is exception F6 dual, If < A < G 2, find a vertex u of A that is dominated by 2. Find a directed hamiltonian outpath OB of B. Find a directed hamiltonian outpath O of A y Ž u, 2.. If y s 1, return Ž1, u, 2, OB , x, 3, O .; if y s 3, return Ž3, u, 2, OB , x, 1, O ..
268
FREDERIC HAVET ´ ´
If < A < s 2, then < Y < G 3. Pick three vertices u, ¨ , and w of B such that u ¤ ¨ ¤ w. Find a directed hamiltonian outpath O of B y Ž u, ¨ , w .. If y s 1, return Ž1, u, ¨ , w, 2, x, 3, O .; if y s 3, return Ž3, u, ¨ , w2, x, 1, O .. If ŽT y s; *P . is exception F7 dual, Pick two vertices u and ¨ of B such that u ¤ ¨ . Find a directed hamiltonian inpath IBy Ž u, ¨ . of B y Ž u, ¨ .. If y s 2, return Ž2, u, ¨ , x, IBy Ž u, ¨ . , 3, 1.; if y s 3, return Ž3, u, ¨ , x, IBy Ž u, ¨ . , 2, 1.. If ŽT y x; *P . is exception F8 dual, Find a directed hamiltonian inpath IAy y of A y y . Return Ž y, 1, IAy y , 2, 3, x .. If ŽT y x; *P . is exception F8X dual, Find a directed hamiltonian inpath IAy y of A y y. Return Ž y, 1, IAy y , 2, x, 3.. If Ž t y x; *P . is exception F9 dual, Find a directed hamiltonian inpath IAy y of A y y. Return Ž y, 1, IAy y , 2, 4, 3, 5, x .. If ŽT y x; *P . is exception F9X dual, Find a directed hamiltonian inpath IAy y of A y y. Return Ž y, 1, IAy y , 2, x, 4, 3, 5.. If ŽT y x; *P . is exception F10 dual, Find a directed hamiltonian inpath IAy y of A y y. Return Ž y, 1, IAy y , 2, 4, 3, 7, 5, 6, x .. If ŽT y x; *P . is exception F10X dual, Find a directed hamiltonian inpath IAy y of A y y. Return Ž y, 1, IAy y , 2, x, 4, 3, 7, 5, 6.. If ŽT y x; *P . is exception F11 dual, Pick two vertices u and ¨ of A such that u ¤ ¨ . Find a directed hamiltonian inpath IAy Ž u, ¨ . of A y Ž u, ¨ .. If y s 1, return Ž1, 3, ¨ , u, 2, x, IAy Ž u, ¨ . .; if y s 2, return Ž2, u, ¨ , x, 3, IAy Ž u, ¨ . , 1..
FINDING AN ORIENTED HAMILTONIAN PATH
269
If ŽT y x; *P . is exception F12 dual, Pick a vertex u of A. Find a directed hamiltonian inpath IAy u of A y u. If y s 1, return Ž1, u, 2, 3, x, IAy u , 4.; if y s 4, return Ž4, u, 2, 3, x, IAy u , 1.. If ŽT y x; *P . is exception F13 dual, If y s 1, find a directed hamiltonian inpath IA of A. Return Ž1, 3, 4, 2, x, 5, IA .. If y s 2, pick two vertices u and ¨ of A such that u ¤ ¨ . Find a directed hamiltonian inpath IAy Ž u, ¨ . of A y Ž u, ¨ .. Return Ž2, u, ¨ , x, 3, 4, 5, IAy Ž u, ¨ . , 1.. If ŽT y x; *P . is exception F14 dual, Find a directed hamiltonian inpath IA of A. If y s 1, return Ž1, 3, 4, 5, x, I X , 6, 2.; if y s 6, return Ž6, 3, 4, 5, x, IA , 1, 2.. End 3.2.4. Subroutines tombexcep We run tombexcep1ŽT, P, x, y . when b1Ž P . G 2, NqŽ x . s y, and ŽT y y; *P . is an exception but ŽT ; P . is not. Thus there exists a vertex z of NTqŽ y . _ S with S the set of vertices which are not origins of *P in T y y. So we find such a z and return Ž y, pathŽT y y, *P, z, x ... Note that pathŽT y y, *P, z, x . will certainly return a path with origin z since x is dominated by every vertex of T y Ž x, y . and therefore cannot be an origin of *P in T y y. We run tombexcep2ŽT, P, x, y . when b1Ž P . s 1, NqŽ x . s y, dqŽ y . s 1, < X < G b 2 Ž P . q 1, and ŽT y Ž x, y .; **P . is an exception. Since there are at least two origins of **P in T y Ž x, y ., there exists a vertex u of T y Ž x, y . which dominates y and which is an origin of **P. We just have to find this vertex u and to return Ž x, y, pathŽT y Ž x, y ., **P, u, ¨ .., with ¨ any vertex of T y Ž x, y, z . distinct from u. We execute tombexcep3 when b1Ž P . s 1, NqŽ x . s y, dqŽ y . G 2, < X < G b 2 Ž P . q 1, and < Z < G b 2 Ž P . q 1, and ŽT y y; *P . is an exception. Therefore, it is easy to check that ŽT y y; *P . is the dual of one of the exceptions F1 , F2 , F3 , F4 , F5 , or F6 . In the following routine, the vertices denoted 1, 2, . . . and the sets A and B represent the vertices and sets depicted as such in Fig. 1.
FREDERIC HAVET ´ ´
270 tombexcep3ŽT, P, x, y .
Begin If ŽT y y; *P . is exception F1 dual, If y has an inneighbour u g A, Find OAy u a directed hamiltonian outpath of A y u. Return Ž y, u, 1, 3, 2, OAy u .. If y has an inneighbour u f A, say 1 Žby renaming if necessary ., Find OAy x a directed hamiltonian outpath of A y x. Return Ž x, y, 1, 3, 2, OAy x .. If ŽT y y; *P . is exception F2 dual, If y has an outneighbour u f 3, 44 , Return Ž y, pathexcepŽT y y, *P, u... Else pick u g A y x. Find a directed hamiltonian outpath OAy Ž x, u. of A y Ž x, u.. Return Ž x, y, u, 2, 1, 3, 4, OAy Ž x, u. .. If ŽT y y; *P . is exception F3 dual, If y has an outneighbour u f 1, 34 , Return Ž y, pathexcepŽT y y, *P, u... Else find a directed hamiltonian outpath OAy Ž x, 3. of A y Ž x, 3.. Return Ž x, y, 2, 3, 1, OAy Ž x, 3. .. If ŽT y y; *P . is exception F4 dual, If y has an outneighbour u f 1, 44 , Return Ž y, pathexcepŽT y y, *P, u... Else pick u g A y Ž x, 3.. Find OAy Ž x, u, 3. a directed hamiltonian outpath of A y Ž x, u, 3.. Return Ž x, y, u, 2, 3, 4, 1, OAy Ž x, u, 3. .. If ŽT y y; *P . is exception F5 dual, If y has an outneighbour u f 1, 24 , Return Ž y, pathexcepŽT y y, *P, u... Else find OAy Ž x, 2. and OB directed hamiltonian outpath of A y Ž x, 2. and B. Return Ž x, y, OB , 2, 1, OAyŽ x, 2. .. If ŽT y y; *P . is exception F6 dual,
FINDING AN ORIENTED HAMILTONIAN PATH
271
If y has an outneighbour u f 1, 34 , Return Ž y, pathexcepŽT y y, *P, u... Else pick an arc u ª ¨ of B. Find OAy Ž x, 2. and OByŽ u, ¨ . directed hamiltonian outpaths of A y Ž x, 2. and B y Ž u, ¨ .. Return Ž x, y, u, ¨ , 2, 1, 3, OBy Ž u, ¨ . , OAyŽ x, 2. .. End We run tombexcep4ŽT, P, x, y . when B1Ž P . s 1, NqŽ x . s y, dqŽ y . G 2, < X < G b 2 Ž P . q 1, < Z < F b 2 Ž P ., ŽT y Ž x, y .; **P . is an exception, T y Ž x, y . is reducible with decomposition W ¤ Z, and **P is an inpath. We find a vertex u g W which is an origin of **P in T y Ž x, y . Žit is easy to check that such a vertex exists. and we return Ž x, y, pathexcepŽT y Ž x, y ., **P, u... We run tombexcep5ŽT, P, x, y . when b1Ž P . s 1, NqŽ x . s y, < X < F b 2 Ž P ., ŽT y y; *P . is an exception, and y ª T y Ž x, y .. Hence, it suffices to pick a vertex u g T y Ž x, y . and an origin of *P in T y y and return Ž y, pathexcepŽT y y, *P, u... 3.2.5. Subroutines special We execute special1 when dqŽ x . G 2, < X < F b 2 Ž P ., and ŽT ; P . is not an exception, and P is one of the paths qŽ1, n y 2., qŽ1, n y 3, 1., qŽ1, n y 4, 2., and qŽ1, n y 4, 1, 1.. special1ŽT, P, x, y . Begin If P s qŽ1, n y 2., Pick a vertex z of T y x. Find I Ž z . a directed hamiltonian inpath of T y y with origin z. Return Ž y, I Ž z ... If P s Ž1, n y 3, 1., Set Aqs X l Ž NqŽ x . _ y4. and Ays X l Ny Ž x .. If Ay is not empty, pick ¨ g Y. Find I Yy y , IAq and IAy hamiltonian directed inpaths of Y y y, Aq and Ay. Return Ž y, I Yy ¨ , IAq, x, IAy, ¨ .. Else Ay is empty. If < Aq< G 2, pick z g Aq. Find I Y and I XyŽ y, z . hamiltonian directed inpaths of Y and X y Ž y, z .. Return Ž y, I Y , I XyŽ y, z . , x, z ..
272
FREDERIC HAVET ´ ´
Else Aq is the arc z ª y. Let P⬘ s smallpathŽ Y, ****P . and ¨ the vertex of Y y P⬘. Return Ž y, ¨ , z, x, P⬘.. If P s qŽ1, n y 4, 2. Pick a vertex ¨ of Y. Find I Yy ¨ and I Xy y directed hamiltonian inpath of Y y ¨ and X y y. Return Ž y, I Yy ¨ , I Xy y , ¨ , x .. If P s qŽ1, n y 4, 1, 1., Set Aqs X l Ž NqŽ x . _ y4. and Ays X l Ny Ž x .. If Ay is not empty, Pick two vertices ¨ and w of Y such that ¨ ª w. Find I Yy Ž ¨ , w . , IAq and IAy hamiltonian directed inpaths of Y y Ž ¨ , w ., Aq and Ay. Return Ž y, I Yy Ž ¨ , w . , IAq, x, IAy, w, ¨ .. Else Ay is empty. If < Y < G 4, Set P⬘ s yŽ< Y < y 4, 1, 1. Žor qŽ1, 1. if < Y < s 4.. Let Q [ smallpathŽ P⬘, Y .. Pick a vertex ¨ of Y y Q and find I Xy y a directed hamiltonian inpath of X y y. Return Ž y, ¨ , I Xy y , x, Q .. Else V Ž Y . s u, ¨ , w4 with u ª ¨ . Pick z g X y y and find I Xy Ž y, z . a directed hamiltonian inpath of X y Ž y, z .. Return Ž y, w, I Xy Ž y, z . , x, u, ¨ , z .. End We run the routine special2 when b1Ž P . s 1, dqŽ x . s dqŽ y . s 1, < X < G b 2 Ž P . q 1, ŽT ; P . is not an exception, and P is qŽ1, n y 2. or qŽ1, 1, n y 3.. special2ŽT, x, y . Begin Let z be the outneighbour of y. If P s qŽ1, n y 2., Pick an outneighbour w of z distinct from x. Grow Ž w, z . into a directed hamiltonian inpath I of T y Ž x, Y ..
FINDING AN ORIENTED HAMILTONIAN PATH
273
ŽThis is possible by applying the algorithm of Hell and Rosenfeld and guaranteeing that z is not the origin of I.. Return Ž x, y, I .. If P s qŽ1, 1, n y 3., Pick an inneighbour w of z distinct from y. Grow Ž w, z . into a directed hamiltonian outpath O of T y Ž x, Y .. Return Ž x, y, O .. End We execute the routine special3, when P s qŽ1, n y 2. and y is an ingenerator of T y x. We just have to find a directed hamiltonian inpath I of T y x with origin y and return Ž x, I .. 3.3. Complexity of the Algorithm The routine hamilt runs the same elementary subroutines as smallpath; these take time O Ž n2 .. Moreover, for each recursive call of path, it must check whether ŽT, P . is an exception. Since there are at most n calls Žbecause the size of the path decreases at each call. and one can recognize exceptions in time O Ž n., the algorithm spends in all O Ž n2 . time on the recognition of exceptions. The subroutines extension and tombexcep either perform O Ž n. operations before a recursive call to path Žwith a smaller path. or else find a directed hamiltonian path of a prescribed subtournament and return the path P in T. Using the algorithm of Hell and Rosenfeld w4x, this can be achieved in O Ž n log n.. The subroutines special1 and special2 for 1 F i F 6 find a directed hamiltonian path of prescribed subtournaments and return P. This can be achieved in O Ž n log n.. In order to achieve subroutines special3 and extension2 Žonly when ŽT y x; *P . s F4 ., we must find a directed hamiltonian inpath of a tournament S with prescribed origin ¨ . This can be done in time O Ž n2 . in the following way: First find the strong component C of ¨ in S. This can be done in time O Ž n2 . by a modified depth-first search algorithm. Then find a directed hamiltonian cycle of C and pick the directed hamiltonian inpath I with origin ¨ contained in C. One can find a directed hamiltonian cycle in O Ž n2 ., as shown by Manoussakis w5x. Finally, find a directed hamiltonian inpath I⬘ of T y C and return Ž I, I⬘.. Thus, path and hamilt run in time O Ž n2 .. Remark 2. This algorithm to find a hamiltonian path in a tournament is very difficult to implement because of the exceptions and the special subroutines that we need accordingly. But the algorithm can be much
274
FREDERIC HAVET ´ ´
simplified and shortened if we restrict ourselves to paths to a given class. For example, if we wish to find paths with blocks of length less than k. Since there are no exceptions of order k q 8 in which all blocks are of length less than k, we do not need to check whether ŽT, P . is an exception. Moreover, since we run special routines for paths with long blocks, we do not need these either. Remark 3. In the same way as that described above, one can construct an algorithm for finding hamiltonian oriented paths Žif it exists. in tournaments of every order. Indeed, Havet and Thomasse ´ w3x described all of the 52 exceptions to Theorem of order at most 8. So taking these into account, the subroutines pathexcep, tombexcep, and special yield an algorithm which is valid even for small tournaments. Moreover, we do need the subroutine path9-10-11 anymore. 4. APPLICATION: PATH WITH GIVEN ORIGIN Using path, it is easy, following the proofs of Corollaries 2.2 and 2.3 of w3x, to construct algorithms for finding a path P with its origin a prescribed vertex x in a 3-strong tournament and for finding a path P or its dual yP with its origin a prescribed vertex x in a 2-strong tournament. We will now present a more general algorithm that finds a path of order at most n starting from a given vertex in a tournament of order n, provided that such a path exists Žand returns an error message otherwise.. This algorithm is divided into two dual routines according to whether P is an outpath or not. We present here the routine need when P is an outpath. originqŽT, P, x . Begin If sqŽ x . F b1Ž P ., write ‘‘ x is not an origin of P in T.’’ If ŽT y x; *P . is an exception, If there is an outneighbour y of x that is an origin of *P in T, return Ž x, pathexcepŽT y x, *P, y ... Else write ‘‘ x is not an origin of P in T.’’ Else ŽT y x; *P . is not an exception. If x has a unique neighbour y, return Ž x, originŽT y x, *P, y ... Else dqŽ x . G 2. If b1Ž P . G 2, find a outgenerator u of NqŽ x ., an outneighbour ¨ of x distinct from u. Return Ž x, pathqŽT y x, *P, u, ¨ ..
FINDING AN ORIENTED HAMILTONIAN PATH
275
Else b1Ž P . s 1. Ž qŽ x .. G b 2 Ž P . q 1, find a ingenerator u of NqŽ x ., If sy Ty x N an outneighbour ¨ of x distinct from u. Return Ž x, path-ŽT y x, *P, u, ¨ .. Else write ‘‘ x is not an origin of P in T.’’ End This algorithm clearly runs in time O Ž n2 ..
REFERENCES 1. E. Bampis, P. Hell, Y. Manoussakis, and M. Rosenfeld, Finding an antidirected hamiltonian path starting with a forward arc from a given vertex of a tournament, in ‘‘Combinatorics and Computer Science, Brest, 1995,’’ Lecture Notes in Computer Science, Vol. 1120, pp. 67᎐73, Springer-Verlag, Berlin, 1996. 2. F. Havet, ‘‘Chemins, cycles et arbres dans les tournois,’’ These ` de doctorat, Universite´ Lyon 1, Jan, 1999. 3. F. Havet and S. Thomasse, ´ Oriented hamiltonian paths in tournaments: A proof of Rosenfeld’s conjecture, J. Combin. Theory Ser. B 78 Ž2000., 243᎐273, doi:10.1006r jctb.1999.1942. 4. P. Hell and M. Rosenfeld, The complexity of finding generalized paths in tournaments, J. Algorithms 4 Ž1983., 303᎐309. 5. Y. Manoussakis, A linear-time algorithm for finding Hamiltonian cycles in tournaments, Discrete Appl. Math. 184 Ž1992., 199᎐201. 6. A. Thomason, Paths and cycles in tournaments, Trans. Amer. Math. Soc. 296 Ž1986., 167᎐180.