A 2 O(k) n algorithm for k -cycle in minor-closed graph families
AA 2 O ( k ) n algorithm for k -cycle in minor-closed graph families Raphael Yuster ∗ Abstract
Let C be a proper minor-closed family of graphs. We present a randomized algorithm thatgiven a graph G ∈ C with n vertices, finds a simple cycle of size k in G (if exists) in 2 O ( k ) n time. The algorithm applies to both directed and undirected graphs. In previous linear timealgorithms for this problem, the runtime dependence on k is super-exponential. The algorithmcan be derandomized yielding a 2 O ( k ) n log n time algorithm. Keywords: k -cycle; minor-closed graph family; parameterized algorithm; linear time algorithm All graphs in this paper are finite and simple. Standard graph-theoretic terminology follows [4].Let G be an undirected graph. A graph H is a minor of G if it can be obtained from G by removaland contraction of edges. A family C of graphs is said to be minor-closed if a minor of a graphof the family is also a member of the family. The seminal graph minor theorem of Robertson andSeymour [19] asserts that every minor-closed family of graphs can be characterized by a finite setof forbidden minors.An undirected graph G is d -degenerate if there is a total order π of V ( G ) such that for each v ∈ V ( G ), the number of neighbors of v appearing in π after v is at most d . The ordering π iscalled a d -degenerate ordering . Clearly, if G is d -degenerate then m ≤ dn where n = | V ( G ) | and m = | E ( G ) | . The smallest d for which G is d -degenerate is the degeneracy of G , denoted by d ( G ).It is well-known (and also an easy consequence of the graph minor theorem) that if C is a properminor-closed family of graphs, i.e., a minor-closed family which is not the family of all graphs, thenall graphs in C are of bounded degeneracy. So, there exists a constant d = d C such that every G ∈ C satisfies d ( G ) ≤ d . In particular, all graphs in C are sparse, as they have only O ( n ) edges. Asan example, consider the family of planar graphs . It is minor-closed and the degeneracy of everyplanar graph is at most 5 (as each planar graph has a vertex whose degree is at most 5).Relying on the fact that proper minor-closed graph families have bounded degeneracy, Alonet al. [2] used the color coding method to devise a randomized linear (in n ) algorithm for finding ∗ Department of Mathematics, University of Haifa, Haifa 31905, Israel. Email: [email protected] a r X i v : . [ c s . D S ] A ug imple cycles of size k in directed or undirected graphs that belong to a proper minor-closed familyof graphs. The running time of their randomized algorithm is k O ( k ) n and it can be derandomizedresulting in an k O ( k ) n log n deterministic algorithm. An important ingredient in the proof of [2] isto color the vertices of the graph such that a simple cycle of size k will, with small probability,be colored by consecutive distinct colors. The chance of that occurring is already at most 2 /k k − ,which already implies that the algorithm’s dependence on k is k O ( k ) . To the best of our knowledge,no faster algorithm is known. Here we present a faster linear time parameterized algorithm as thedependence on k is only exponential. We note that the exponent base is only linear in d = d C , asin [2]. Theorem 1.1.
Let C be proper minor closed family of graphs. There is a randomized algorithmthat given an n -vertex directed or undirected graph G ∈ C , finds a simple directed or undirectedcycle of size k in G , if such a cycle exists, in O ( k ) n time. The algorithm can be derandomizedresulting in running time O ( k ) n log n . Following a review of related work, in Section 2 we give a high level overview of our algorithm.Following that, in Section 3 we set up some definitions and lemmas that are used in the randomizedalgorithm presented in Section 4. Derandomization is discussed in Section 4.
We have already mentioned the k O ( k ) n randomized algorithm of [2] and its deterministic version(also appearing in [2]) that incurs an additional log n factor. If linear time is not sought, thenrandomized color coding can find cycles of size k in any graph with n vertices and m edges in2 O ( k ) mn time, so for proper minor-closed graph families the runtime is 2 O ( k ) n . For the specialcase of planar graphs, Eppstein [12] devised a deterministic algorithm that runs in k O ( k ) n time.In fact, Eppstein’s algorithm applies to finding any pattern with k vertices (namely, subgraphisomorphism of planar graphs), not just cycles. Dorn [8] improved the dependence on k for thesubgraph isomorphism problem in planar graphs to 2 O ( k ) n . For undirected planar graphs as wellas undirected apex-minor free graphs (apex graphs are graphs that can be made planar by a singlevertex removal), a recent algorithm of Fomin et al. [14] can find a cycle of size k in 2 O ( √ k log k ) · n O (1) .So here the dependence on k is sub-exponential but the dependence on n is not linear. Their methodrelies on topological properties of planar and apex-minor free graphs (in particular, that they havelocally bounded treewidth) and this property does not hold for general minor-closed families [7, 13].Pilipczuk and Siebertz [18] solve undirected subgraph isomorphism in proper minor-closed graphfamilies in k O ( k ) n O (1) using only n O (1) space. Throughout this paper, if a graph is directed, then the concepts of minor and degeneracy refer to its underlyingundirected structure. k -path has faster algorithms. In fact, colorcoding can solve the k -path problem in general graphs using a 2 O ( k ) m randomized algorithm,and improvements in the exponent, and even deterministic algorithms running in 2 O ( k ) m timeare known. Notable and representative results that use advanced combinatorial and algebraictechniques in order to improve the constant in the exponent are [3, 5, 15, 20]. Dorn et al. [11] solveundirected k -path in planar graphs in 2 O ( √ k ) n O (1) time. Their method can also be used to answerthe question “is there a simple cycle of size at least k ” in the same time. Building on the theoryof bidimensionality of Demaine et al. [6] and on the Robertson-Seymour graph minor theory, Dornet al. [10] solve undirected k -path in proper minor-closed families in 2 O ( √ k ) n O (1) time. Althoughbidimensionality applies only to undirected graphs, Dorn et al. [9] overcome some of the obstaclesencountered in the directed setting and achieve an almost sub-exponential algorithm for directed k -path in planar graphs and apex minor-free graphs, solving it in time O ((1 + (cid:15) ) k n f ( (cid:15) ) for any (cid:15) > We first describe the algorithm from [2] (hereafter “old” algorithm) and then outline the newalgorithm and how it overcomes the obstacles encountered when trying to improve the runtime ofthe old algorithm. This outline also serves as a roadmap and motivation for the definitions andsteps in Section 3 and 4 that formalize the notions discussed in the present section. k O ( k ) n algorithm of [2] Throughout this section we fix a proper minor closed family C and let d = d C to be the degeneracybound of C . Since the input graph G ∈ C is d -degenerate, we can find in O ( dn ) = O ( n ) time a d -degenerate ordering of its vertices (see Lemma 3.1). By this we mean a total order π of V ( G ) suchthat for each vertex v , the number of neighbors of v appearing after v in π is at most d . Havingfound and fixed such an ordering π , we can label the edges of G with the integers { , . . . , d } suchthat for each vertex v , the edges incident with v that connect v to vertices appearing after v in π have distinct labels. We call such a labeling a d -degenerate labeling (see Definition 3.2).Now color the vertices of G with k colors, say the colors { , . . . , k − } . A (simple) k -cycle in G is well-colored if its vertices are consecutively colored with the colors { , . . . , k − } . Observe thatwith probability k − O ( k ) , a simple cycle k -cycle C present in G will be well-colored. Our goal istherefore to detect a well-colored cycle. Let G (cid:48) be the spanning subgraph of G obtained by keepingonly edges connecting consecutively colored vertices. This is done modulo k , so we also keep edgesconnecting a vertex colored 0 and a vertex colored k −
1. Notice that if C is well-colored, then C is also a cycle in G (cid:48) . This cleanup step of removing “uninteresting” edges also appears in the newalgorithm (the cleanup step of Section 4). 3uppose C = ( v , . . . , v k − ) where v i has color i for i = 0 , . . . , k −
1. It could be that v islocated before v k − in π , or after v k − in π . Furthermore, the edge connecting v k − and v has oneof d possible labels assigned by our d -degenerate labeling. We guess the label of this edge (thereare d choices) and we guess whether v k − is before v or after v in π (there are two choices). Wethus have a chance of 1 / (2 d ) of correctly guessing the label and order. Suppose that we indeedguessed correctly and assume without loss of generality that the label is 1 and that v k − is before v . We remove from G (cid:48) all edges connecting a vertex colored k − unless it isof the form xy where x is before y in π , x has color k − y has color 0 and the label of the edges is1. Denoting the resulting graph by G (cid:48)(cid:48) , we observe that C is still a cycle in G (cid:48)(cid:48) since the cycle edgeconnecting v k − and v has not been removed. An important observation is that the subgraph of G (cid:48)(cid:48) induced by the vertices colored k − k − k − G ∗ is still in C , as C is minor closed. The crucial argument now is that thereexists a well-colored cycle of size k − G ∗ if and only if there exists a well-colored cycle of size k in G (cid:48)(cid:48) because the only way an edge whose endpoints are colored k − G ∗ is througha contraction of a star as above. We can now continue inductively with G ∗ where we again computea d -degnerate ordering, a d -degenerate labeling, and guess the order and label of the “last” cycleedge. The recursion bottoms when k = 3 where we use a known O ( nd ) algorithm to find a C ina d -degenerate graph. The probability of success, namely that a k -cycle in G survives all the waythrough the recursive applications is k − O ( k ) · (1 / (2 d )) k − = k − O ( k ) hence the k O ( k ) factor in the oldalgorithm’s runtime. O ( k ) n algorithm The first obstacle when trying to improve the k O ( k ) n runtime of the old algorithm is already in theinitial coloring step, when we require the sought cycle to be well-colored, as this only occurs withprobability k − Θ( k ) . One may try to weaken the well-colored requirement as follows. Just color thevertices with, say, the h colors { , . . . , h − } ( h being some small constant independent of k ; wewill see later why we must sometimes have h as large as 6) and hope that the coloring of the k -cycleis periodic . That is, the colors are consecutively colored modulo h . Of course, for this to hold wemust assume that h divides k , so for the time being, assume for simplicity this is indeed the case,namely k = hq for some integer q (see Definition 3.3 of an ( h, r )-cyclic coloring which assumes themore general case when k = hq + r where r = k (mod h ) is the remainder). The probability of acycle to be periodically colored is now at least h − k = 2 − O ( k ) .Now, instead of contracting just the “last” edge connecting v k − and v as we have done in the4ld algorithm (recall - after guessing whether v k − is before or after v in the total order and afterguessing the label of the edge connecting them) we can now contract all edges connecting verticescolored h − k/h = q . But here we arrive at a new obstacle. There are q pairs of vertices on our cycle C = ( v , . . . , v k − ) having colors h − h . These are v jh − v jh for j = 1 , . . . , q (here v = v k ). But for each of these q pairs, we need to guess whether v jh − is beforeor after v jh in the total order, and we need to guess the label of the edge connecting v jh − and v jh .Let us consider label-guessing first. We would like all of the q labels of the q pairs to be thesame (say, all of them to have the label 1), as recall that when we do the second cleanup step(analogous to going from G (cid:48) to G (cid:48)(cid:48) in the old algorithm) we want to keep only edges with the samelabel connecting vertices colored h − − O ( k ) probability as follows. Recall that when we construct a d -degenerate labeling, all we needis to assign, for each vertex v , distinct labels to edges connecting v to (the at most d ) vertices afterit in the total order. So, instead of just assigning the distict labels arbitrarily, assign the distinctlabels at random (for example, choose a random permutation of the neighbors of v appearing after v in the total order and assign labels in the order dictated by the permuation). Hence, for anygiven edge, the probability that its label is 1 is at least 1 /d and the events of having label 1 areindependent for disjoint edges. So, the probability that all the q edges of our q pairs have the label1 is at least d − q = 2 − O ( k ) . This is the “degenerate labeling step” of Section 4.Let us next consider order-guessing. For each vertex colored 0 or h − v jh − v jh , one of them is a winner,one of them is a loser, and the winner is before the loser in the total order (see Definition 3.4 ofwinner-loser partition). Of course, the probability that this happens is (1 / q = 2 − O ( k ) .Once we do the cleanup (analogous to going from G (cid:48) to G (cid:48)(cid:48) in the old algorithm - called now the“winner-loser cleanup step” in Section 4) and the contraction of the vertex-disjoint stars as in theold algorithm (this is the “contraction step” in Section 4), we would like to claim, just as in the oldalgorithm, that the new graph G ∗ has a cycle of length k − q = ( h − q if and only if the graph G (cid:48)(cid:48) before the contraction has a periodically-colored C k . This certainly holds if h ≥ h = 3. Indeed, if h = 3 then in G ∗ there are cycles with periodic coloring of h − { , } , of length 2 q . But such cycles might not necessarily correspond to cycles of length 3 q before the contraction. Indeed prior to contraction, in G (cid:48)(cid:48) vertices colored 0 may be adjacent tovertices colored 1 (as these are consecutive colors), hence such cycles might be original cycles oflength 2 q or just cycles where only part of the pairs are contracted, not all q of them. If h ≥ G (cid:48)(cid:48) there are no edges connecting color 0 to color h − h = 3 we cannot perform the contraction step.So, one might be content with just starting with some constant h ≥
4, but recall that after eachcontraction step, we arrive at a graph where color h no longer appears, and h -periodic cycles become5 h − h ≥
4, already after h − h = 3, so now we have a new obstacle to handle as we cannot do contraction. Tosolve this problem we do the color refinement step of Section 4. To explain this, let t be the currentcycle length we are looking at (this is t from Definition 3.5 and Table 1). In the beginning it was k = t , after the first contraction round it was t = k − q = k − k/h = k ( h − /h , then t = k ( h − /h and so on until we arrive at the present t and the case of 3-period colorings. So each vertex in ourpresent graph has colors in { , , } and we are interested in detecting 3-periodic colored cycles ofsize t , so in particular t = 0 mod 3 at this point. Assume for simplicity that t = 0 mod 6 (the case t = 3 (mod 6) is similarly handled in the color refinement step of Section 4). Each vertex of color j ∈ { , , } will keep its color with probability 1 / j + 3 with probability1 /
2. So now the possible colors are { , , , , , } . Observe that a 3-periodic colored cycle of size t now has a chance of at least (1 / t = 2 − O ( k ) of becoming 6-periodic, so after this recoloring weneed to detect 6-periodic colored cycles, namely the case h = 6 (so at a price of probailiby (1 / t we are again at a stage where we can do contractions).The description above also explains why we must assume in our algorithm that h ∈ { , , , } and the value of h cycles through these numbers as follows: if, say, we start with h = 4 (this is anarbitrary decision) then the next will follow from contraction leading to h = 3, then we have to docolor refienment leading to h = 6, then contraction leading to h = 5, then contraction leading to h = 4 and so on. This explains the motivation of Definition 3.5 (a 4-3-6-5 sequence).The outline above gives a high level description of the various definitions and steps appearingin Sections 3 and 4, but assumes the idealized case where the current cycle size t we are looking atdivides the current h we are looking at. This occurs, for example if k = 2 r and we start with h = 4as we will never have any divisibility issues to deal with. For example, if initially ( h, k ) = (4 , h = 3 and t = 24, namely case (3 , , , , , , , , , , , , ,
3) and once we arrive at this point, as in the old algorithm, the recursion bottoms and we usea known O ( nd ) algorithm to find a C in a d -degenerate graph. If, however divisibility issues ariseduring this sequence, there are some technical issues to handle which motivate the more generalnotion of type in Definition 3.5 and Table 1.Finally observe that all success probabilities that we assume throughout the algorithm are atleast 2 − O ( k ) and that the recursion depth is only O (log k ) (this is Lemma 3.6). Throughout the rest of this paper we fix a proper minor closed family C and fix d = d C to be thedegeneracy bound of C . Recall from the introduction that a d -degenerate graph has a d -degenerate6rdering, namely a total order of its vertex set where for each vertex v , at most d of the neighborsof v appear after v in the ordering. A simple linear time algorithm that constructs a d -degenerateordering π of a d -degenerate graph is well-known (see, e.g., [16]). Together with the fact that | E ( G ) | ≤ dn for G ∈ C we obtain the following lemma. Lemma 3.1.
Let G ∈ C have n vertices. A d -degenerate ordering of G can be obtained in O ( dn ) = O ( n ) time. It will be useful to label the edges of a graph G ∈ C with at most d integer labels as in thefollowing definition. Definition 3.2 (degenerate labeling) . Let G ∈ C and suppose that π is a d -degenerate ordering of G . A labeling of E ( G ) with [ d ] = { , . . . , d } is a d -degenerate labeling if for each v ∈ V ( G ) , theedges incident with v connecting it to vertices after v in π have distinct labels. Observe that given a d -degenerate ordering π we can easily construct a d -degenerate labelingin linear time. However, as explained in Section 2, it will be useful to assign the labels of the edgesconnecting v to its neighbors appearing after it in π at random (see the “degenerate labeling step”in Section 4).In what follows, we always assume that our colorings are vertex colorings and the colors aretaken from Z q = { , . . . , q − } for some q ≥
2. For integers a, b with b ≥
2, whenever we use theoperator a (mod b ), its result is the unique integer 0 ≤ r ≤ b − b | ( a − r ).As explained in Section 2, given a vertex coloring, it will be important to look for simple cycleswhose colorings are almost periodic, in the sense that apart from some small (or even empty) setof consecutive cycle vertices, the remaining vertices are colored periodically. We therefore requirethe following definition. Definition 3.3 (( h, r )-cyclic coloring) . Let h > r ≥ be integers where h ≥ . Suppose C =( v , . . . , v k − ) is a simple cycle where k (mod h ) = r and that the cycle vertices are colored with Z h + r . The coloring of C is called ( h, r )-cyclic if c ( v i ) = i (mod h ) for ≤ i < k − r and c ( v k − i ) = h + r − i for ≤ i ≤ r . So, in an ( h, r )-cyclic coloring of a simple cycle, the prefix of k − r vertices of the cycle isperiodically colored with 0 , . . . , h −
1, and the remaining suffix of r vertices is colored with thecolors h, h + 1 , . . . , h + r −
1. For example, in a (5 , h, h divides k ), the entirecoloring of the cycle is periodic.As explained in Section 2, it will be useful to guess, for a pair of consecutive colors j − j ,the order in π of a pair u, v of adjacent vertices that have these colors. Unlike [2], we must allowsome vertices colored by j − π before some other vertices colored by j , but also allow7ome vertices colored by j to appear in π before some other vertices colored by j −
1. To facilitatethis, the following definition is required.
Definition 3.4 (winner-loser partition) . Let G be a graph with a coloring c : V ( G ) → Z q andsuppose that j − and j are two consecutive integers in Z q . A partition of c − ( j − ∪ c − ( j ) intotwo parts ( W, L ) is called a winner-loser partition . The vertices in W are winners and the verticesin L are losers . A crucial definition that is used in our algorithm is a certain decreasing integer sequence. Ateach iteration of the algorithm, we will search for simple cycles whose size is the current elementof the sequence and which have an ( h, r )-cyclic coloring associated with the current element in thesequence.
Definition 3.5 (4-3-6-5 sequence) . For every k ≥ , we define a decreasing sequence startingwith k and ending with . Each element of the sequence is of one of
13 types where the set ofpossible types is { (4 , , (4 , , (4 , , (4 , , (3 , , (3 , , (6 , , (6 , , (6 , , (6 , , (6 , , (5 , , (5 , } .The first element k is of type (4 , k (mod 4)) . Suppose the current element is t ≥ . Then thenext element depends on t and on its type, as defined in Table 1. We call this sequence a . The 4-3-6-5 sequence starting with k is denoted by S ( k ) , it’s j ’th element is S ( k, j ) so S ( k,
1) = k , and its number of elements is N ( k ) so S ( k, N ( k )) = 3 . current element current type next element next typestart k (4 , k (mod 4)) t (4 , t − , t (4 , t − , t (4 ,
1) (3 t + 1) / , t (4 ,
0) 3 t/ , t > , t (6 , t (mod 6)) t > , t (6 , t (mod 6)) t (6 , t − , t (6 , t − , t (6 , t − , t (6 ,
1) (5 t + 1) / , t (6 ,
0) 5 t/ , t (5 ,
1) (4 t + 1) / , t (5 ,
0) 4 t/ , ,
1) 3 (3 , S (307), the 4-3-6-5 sequence starting at k = 307, together withthe type of each element: 307 (4 ,
3) 306 (4 ,
2) 305 (4 ,
1) 229 (3 ,
1) 229 (6 ,
1) 191 (5 ,
1) 153 (4 , ,
1) 115 (6 ,
1) 96 (5 ,
1) 77 (4 ,
1) 58 (3 ,
1) 58 (6 ,
4) 57 (6 ,
3) 56 (6 ,
2) 55 (6 ,
1) 46 (5 , ,
1) 28 (3 ,
1) 28 (6 ,
4) 27 (6 ,
3) 26 (6 ,
2) 25 (6 ,
1) 21 (5 ,
1) 17 (4 ,
1) 13 (3 ,
1) 13 (6 , ,
1) 9 (4 ,
1) 7 (3 ,
1) 7 (6 ,
1) 6 (5 ,
1) 5 (4 ,
1) 4 (3 ,
1) 3 (3 ,
0) . Observe that in this case wehave that N (307) = 35 and, for example, S (307 ,
8) = 115.Several easy observations following directly from the definition of a 4-3-6-5 sequence are that thelast element (namely, 3) is always of type (3 , t of type ( h, r ) satisfies t (mod h ) = r ,and types (4 , , (4 ,
2) are only possible in the beginning of the sequence.Notice that we can partition all but the (at most) first two elements of a 4-3-6-5 sequenceinto consecutive segments . Every element of type (4 ,
0) or (4 ,
1) is the first element of a seg-ment. So, for example, for the sequence S (307) above, the segments listed in consecutive or-der are { , , , } , { , , , } , { , , , , , , } , { , , , , , , } , { , , , } , { , , , } , { , , } . Lemma 3.6.
Each segment has at most elements and all but the last segment have at least fourelements. Furthermore, each segment has at most one element of type (4 , · ) , at most one elementof type (5 , · ) , at most one element of type (3 , · ) and at most four elements of type (6 , · ) . If t is thefirst element of some segment, then the first element of the next segment is at most ( t + 1) / . Inparticular, the number of segments is at most (cid:98) log k (cid:99) , the first element of the r ’th segment is atmost (cid:100) k/ r − (cid:101) and N ( k ) ≤ k .Proof. The claims regarding the sizes of segments and the types present in each segment followdirectly from Table 1. Suppose now that t is the first element of some segment. Then the typeof t is either (4 ,
1) or (4 , , { t, t/ , t/ , t/ } and the next element,starting the next segment, is also of type (4 ,
0) and is t/
2. Otherwise, the size of the segmentmust be 6, the elements must be { t, t/ , t/ , t/ − , t/ − , (5 / t/ − } , and the nextelement, starting the next segment, is of type (4 ,
1) and is (4 / / t/ − < t/
2. Supposenext that t is of type (4 , { t, (3 t + 1) / , (3 t + 1) / , (5 t + 3) / } and the next element, starting the next segment, is of type(4 ,
1) and is ( t + 1) /
2. Otherwise, the size of the segment is 7 and the elements of the segmentare { t, (3 t + 1) / , (3 t + 1) / , (3 t − / , (3 t − / , (3 t − / , t/ − / } and the next element,starting the next segment, is of type (4 ,
1) and is ( t − / < t/
2. It then follows that the firstelement of the r ’th segment is at least (cid:100) k/ r − (cid:101) , that the number of segments is at most (cid:98) log k (cid:99) and (with room to spare) that N ( k ) ≤ k .Ending this section, we require a definition that associates a sequence of minors of G ∈ C withthe elements of the 4-3-6-5 sequence S ( k ). The goal is to facilitate the detection of simple k cyclesusing contractions of that cycle and ( h, r )-cyclic colorings of the contracted cycles where ( h, r )corresponds to the types of the elements of S ( k ).9 efinition 3.7 ( S ( k ) minor sequence) . Let G ∈ C , let k ≥ be an integer and suppose that N ( k ) = s . A sequence of vertex-colored graphs G , . . . , G s is called an S ( k ) minor sequence of G ifthe following holds:1. G = G and for all ≤ i < s , G i +1 is a minor of G i .2. For all ≤ i ≤ s , if S ( k, i ) is of type ( h i , r i ) then the vertex coloring of G i is c i : V ( G i ) → Z h i + r i .3. For all ≤ i < s , if G i +1 has a simple cycle of size S ( k, i + 1) whose coloring is ( h i +1 , r i +1 ) -cyclic, then G i has a simple cycle of size S ( k, i ) whose coloring is ( h i , r i ) -cyclic. Observe that for an S ( k ) minor sequence of G , if it holds that G s contains a triangle whosecoloring is (3 , , ,
2) then, in particular, G has asimple cycle of size k (the converse, of course, does not follow from the definition). Our main result in this section is that there is a randomized algorithm such that:1. Given G ∈ C and integer k ≥
4, always constructs efficiently an S ( k ) minor sequence of G .2. With small probability (depending only on k and d = d C ), if G has a simple cycle of size k then the last element of the sequence, G N ( k ) , has a triangle that is colored (3 , d -degenerate graph can be deterministically foundin O ( n ) time, immediately gives the randomized algorithm claimed in Theorem 1.1.The first lemma in this section describes the randomized algorithm satisfying item 1 above.The lemma following that, proves the claim in item 2 above. Lemma 4.1.
Let G ∈ C be a graph with n vertices and let k ≥ be an integer. There exists arandomized algorithm that constructs in O (log k ) n worst case time an S ( k ) minor sequence of G .This construction has the feature (proved separately in Lemma 4.2) that if G has a simple cycle ofsize k then with probability at least (252 d ) − k − O (log k ) , the last element of the sequence, G N ( k ) , hasa triangle that is colored (3 , -cyclic.Proof. We construct the required S ( k ) minor sequence sequentially, starting with G = G andending at G N ( k ) . Although our construction is a randomized one, it will always be an S ( k ) minorsequence and its worst-case running time is O (log k ) n as it will be clear how to generate G i +1 andits coloring c i +1 from G i and its coloring c i in O ( n ) time. Initial step . As each graph G i in the sequence that we construct should, in particular, havea vertex coloring c i : V ( G i ) → Z h i + r i where S ( k, i ) is of type ( h i , r i ), we must first define c , the10ertex coloring of G = G . Let r = k (mod 4) and observe that S ( k,
1) = k is of type (4 , r ).Randomly color each vertex of G with a color from Z r .Assume that we have already constructed G , . . . , G i such that all three properties in Definition3.7 hold. We show how to construct G i +1 . Note that G i is vertex colored c i : V ( G i ) → Z h i + r i where S ( k, i ) is of type ( h i , r i ). For notational convenience, let t = S ( k, i ). The construction of G i +1 and c i +1 consists of several steps, performed sequentially. Cleaning step . Remove from G i all edges that cannot appear in an ( h i , r i )-coloring of a simplecycle of size t . Suppose v ∈ V ( G i ) has color j ∈ Z h i + r i . More formally:In the directed case we proceed as follows. If 1 ≤ j ≤ h i − h i ≤ j ≤ h i + r i − v of the form ( v, u ) if c i ( u ) = j + 1 or in-edges of theform ( u, v ) if c i ( u ) = j −
1. If j = 0 we only keep ( v, u ) if c i ( u ) = 1 and only keep ( u, v ) if c i ( u ) ∈ { h i − , h i + r i − } . If j = h i − v, u ) if c i ( u ) ∈ { , h i } and only keep( u, v ) if c i ( u ) = h i −
2. If j = h i + r i − v, u ) if c i ( u ) = 0 and only keep ( u, v ) if c i ( u ) = h i + r i − ≤ j ≤ h i − h i ≤ j ≤ h i + r i − vu where c i ( u ) ∈ { j + 1 , j − } . If j = 0 we only keep vu where c i ( u ) ∈{ , h i − , h i + r i − } . If j = h i − vu if c i ( u ) ∈ { , h i − , h i } . If j = h i + r i − vu if c i ( u ) ∈ { , h i + r i − } .Notice that the above procedure is well-defined even if r i = 0 (there is no color h i in that case).Also, as we only remove edges, the obtained graph after cleaning, denoted by G (cid:48) i , is a minor of G i .Furthermore, if G i has a simple cycle of size t whose coloring is ( h i , r i )-cyclic, then this cycle alsoexists in G (cid:48) i as all of its edges are retained. Finally, the cleaning step can clearly be performed in O ( | E ( G i ) | ) ≤ O ( n ) time. Degenerate labeling step . Construct a d -degenerate ordering π of G (cid:48) i in O ( n ) time usingLemma 3.1. For each v ∈ V assign to all neighbors of v (in the directed case, a neighbor mayan in-neighbor or an out-neighbor) that appear in π after v , distinct integers in [ d ] to obtain a d -degenerate labeling (cid:96) of G (cid:48) i . The assignment is performed at random (and the random choices madefor distinct v are independent). Observe that for a particular neighbor u of v with π ( v ) < π ( u ), theprobability that (cid:96) ( v, u ) = 1 is at least 1 /d , where (cid:96) ( v, u ) denotes the label of the edge connecting v and u . Winner-loser step . This step is done unless t > h i , r i ) ∈ { (3 , , (3 , } . If r i ≥ j = h i + r i − r i ≤ j = h i −
1. One exception: if t = 4 and ( h i , r i ) = (3 , j = 3. We call j − buffer color . Consider the set U = c − i ( j − ∪ c − i ( j ) of verticesof G (cid:48) i whose color is either j − j . For each v ∈ U flip a fair coin to determine if it is a winneror a loser and obtain a winner-loser partition ( W, L ) of U . This step is done in O ( n ) time. Table 2designates the vertices on ( h, r )-cyclic simple cycles of size t that are colored with the buffer color. Winner-loser cleanup step . This step is done unless t > h i , r i ) ∈ { (3 , , (3 , } .11urrent type is ( h, r ) structure of ( h, r )-cyclic coloring(4 ,
3) 0123 · · · (cid:13) ,
2) 0123 · · · (cid:13) ,
1) 01 2 (cid:13) · · ·
01 2 (cid:13) ,
0) 01 2 (cid:13) · · ·
01 2 (cid:13) ,
4) 012345 · · · (cid:13) ,
3) 012345 · · · (cid:13) ,
2) 012345 · · · (cid:13) ,
1) 0123 4 (cid:13) · · · (cid:13) ,
0) 0123 4 (cid:13) · · · (cid:13) ,
1) 012 3 (cid:13) · · ·
012 3 (cid:13) ,
0) 012 3 (cid:13) · · ·
012 3 (cid:13) , t = 4 01 2 (cid:13) h, r )-cyclic coloring of a size t simple cycle where ( h, r ) is a relevant type for thewinner-loser step. Cycle vertices colored with the buffer color are circled.Remove from G (cid:48) i all edges connecting two vertices is W ∪ L except for edges connecting a winner v and a loser u , such that π ( v ) < π ( u ) and (cid:96) ( v, u ) = 1. Denote the resulting graph by G (cid:48)(cid:48) i andobserve that G (cid:48)(cid:48) i is a minor of G i . This step is done in O ( n ) time. Contraction step . This step is done unless t > h i , r i ) ∈ { (3 , , (3 , } . Consider thesubgraph G (cid:48)(cid:48) i [ W ∪ L ] induced by the vertices of W ∪ L . Then by the winner-loser cleanup step,this subgraph is a forest of rooted stars. Indeed, in this subgraph, each winner is incident with atmost one edge (all edges of this subgraph have label 1), all winners form an independent set andall losers form an independent set. In fact, in each such star which is not a singleton, the root isa loser and all leaves are winners. Singleton stars may be formed by a single isolated winner or asingle isolated loser in G (cid:48)(cid:48) i [ W ∪ L ]. Now, contract each star in G (cid:48)(cid:48) i [ W ∪ L ] to a single vertex givingthe unified vertex the buffer color j − j also receive color j − G i +1 which is a minor of G i and hence G i +1 ∈ C .Notice that in G i +1 no vertex has color j anymore. Observe that in the case where r i = 1 thecoloring of G i +1 contains a gap. There are no vertices colored h i − j but there are still verticescolored h i . For example, consider the case ( h i , r i ) = (4 , j = 3 and the buffer color is 2.Then vertices colored 2 and 3 spanned vertex-disjoint stars and were contracted to unified verticeshaving color 2. But there are still vertices with color 4 = h i in G i +1 . To close this gap, just renamecolor h i to color h i −
1. Hence, the new coloring is c i +1 : V ( G i +1 ) → Z h i + r i − . It is immediate tocheck Table 1 that h i +1 + r i +1 = h i + r i −
1. Indeed, from Table 1 we see that the only cases wherethis does not hold are if t > h i , r i ) ∈ { (3 , , (3 , } .Having defined G i +1 and c i +1 we have to also prove that the third condition of Definition 3.7is satisfied. Suppose that G i +1 has a simple cycle of size S ( k, i + 1) whose coloring is ( h i +1 , r i +1 )-12yclic. Let this cycle be C = ( v , v , . . . , v p − ) where p = S ( k, i + 1). We must prove that G i hasa simple cycle of size t = S ( k, i ) whose coloring is ( h i , r i )-cyclic. In fact, we prove that already G (cid:48)(cid:48) i has the required cycle and recall that G (cid:48)(cid:48) i is a subgraph of G i .We will prove this in the undirected setting (the proof for the directed setting is identical, justthe notation changes from uv to ( u, v )). There are four cases to consider. First assume that ( h i , r i )is such that r i ≥
2. Then we have that ( h i +1 , r i +1 ) = ( h i , r i − p = t −
1, and j − h i + r i − v p − in c i +1 is therefore c i +1 ( v p − ) = h i +1 + r i +1 − j − c i +1 ( v ) = 0. Butobserve that v p − is adjacent to v in C and that in G (cid:48)(cid:48) i no edge colored 0 is adjacent to a vertexcolored j −
1. So it must be that the star in G (cid:48)(cid:48) i [ W ∪ L ] that was contracted to v p − containedtwo adjacent vertices, call them x, y such that c i ( x ) = j − c i ( y ) = j , and v p − x, xy, yv are alledges of G (cid:48)(cid:48) i . Notice also that x and y are not equal to any other vertex on the cycle, as the starsin G (cid:48)(cid:48) i [ W ∪ L ] are pairwise disjoint. Hence, the cycle C (cid:48) = ( v , v , . . . , v p − , x, y ) is a simple cycle ofsize p + 1 = t in G (cid:48)(cid:48) i and is also ( h i , r i )-cyclic colored by the coloring c i .Assume next that ( h i , r i ) is such that r i = 0 (so this is possible if h i ∈ { , , } ). Then wehave that ( h i +1 , r i +1 ) = ( h i − , p = ( h i − t/h i , and j − h i − h i +1 −
1. The colorof all the vertices v w of C where w (mod h i +1 ) = j − c i +1 ( v w ) = j −
1. Notice that there are p/h i +1 such vertices v w . Each such vertex v w is adjacent in C to a vertex whose color is 0 in thecoloring c i +1 . But in G (cid:48)(cid:48) i no edge colored 0 is adjacent to a vertex colored j −
1. So it must bethat the star in G (cid:48)(cid:48) i [ W ∪ L ] that was contracted to v w contained two adjacent vertices, call them x w , y w such that c i ( x w ) = j − c i ( y w ) = j , and v w − x w , x w y w , y w v w +1 are all edges of G (cid:48)(cid:48) i (in thecase of w = p − v w +1 = v ). Notice also that x w and y w for any plausible w are notequal to any other vertex on the cycle, as the stars in G (cid:48)(cid:48) i [ W ∪ L ] are pairwise disjoint. Hence,the cycle C (cid:48) = ( v , · · · , v h i − , x h i − , y h i − , v h i − , v h i , · · · , v p − x p − , y p − ) is a simple cycle of size p + p/h i +1 = t in G (cid:48)(cid:48) i and is also ( h i , c i .Assume next that ( h i , r i ) is such that r i = 1 and h i ∈ { , , } . Then we have that ( h i +1 , r i +1 ) =( h i − , p = (( h i − t + 1) /h i , and j − h i − h i +1 −
1. The color of all the vertices v w of C where w (mod h i +1 ) = j − c i +1 ( v w ) = j −
1. Notice that there are ( p − /h i +1 such vertices v w . Each such vertex v w is either adjacent in C to a vertex whose color is 0 inthe coloring c i +1 or, for the next to last vertex v p − (which is also of the form v w since p − h i +1 ) = j − C to v p − whose color in c i +1 is h i +1 = h i −
1, but recallthat v p − was just renamed to this color to close a color gap and originally c i ( v p − ) = h i . Butin G (cid:48)(cid:48) i no edge colored 0 is adjacent to a vertex colored j − h i is adjacentto a vertex colored j −
1. So it must be that the star in G (cid:48)(cid:48) i [ W ∪ L ] that was contracted to v w contained two adjacent vertices, call them x w , y w such that c i ( x w ) = j − c i ( y w ) = j , and v w − x w , x w y w , y w v w +1 are all edges of G (cid:48)(cid:48) i . Notice also that x w and y w for any plausible w are notequal to any other vertex on the cycle, as the stars in G (cid:48)(cid:48) i [ W ∪ L ] are pairwise disjoint. Hence, thecycle C (cid:48) = ( v , · · · , v h i − , x h i − , y h i − , v h i − , v h i , · · · , v p − x p − , y p − , v p − ) is a simple cycle of size13 v v v v v v v v v v x y x y x y Figure 1: A simple cycle C = ( v , . . . , v ) of size p = 10 in G i +1 which is (3 , c i +1 are indicated below the vertices. It corresponds to a simple cycle of size t = 13 in G (cid:48)(cid:48) i . Vertices colored j − G i +1 are results of contracted stars in G (cid:48)(cid:48) i [ W ∪ L ]. Each suchstar contains two vertices x w , y w (in this case w ∈ { , , } ) such that c i ( x w ) = 2, c i ( y w ) = 3 and v w − x w , x w y w , y w v w +1 are all edges of G (cid:48)(cid:48) i . Vertex v has been recolored from 4 in c i to 3 in c i +1 toclose a color gap. The colors of c i are indicated inside the circles. The cycle in G (cid:48)(cid:48) i is (4 , p + ( p − /h i +1 = t in G (cid:48)(cid:48) i and is also ( h i , c i . For an illustrativeexample of this case see Figure 1.Finally consider the case ( h i , r i ) = (3 ,
1) and t = 4. Observe that this case is identical to thecase (4 ,
0) since for t = 4, a (3 , , h i , r i ) = (4 ,
0) above.
Algorithm 1
Computing an S ( k ) minor sequence procedure ProduceMinorSequence ( G, k ) G = G and c : V ( G ) → Z r where r = k (mod 4) constructed by the initial step. for i = 1 , . . . , N ( k ) − do t ← S ( k, i ) Perform cleaning step on G i to obtain G (cid:48) i Perform degenerate labeling step on G (cid:48) i to obtain a d -degenerate ordering and labeling if t > h i , r i ) ∈ { (3 , , (3 , } then G i +1 = G i and perform color refinement step to obtain c i +1 else Perform winner-loser step on G (cid:48) i and c i to define a winner-loser partition ( W, L ) Perform winner-loser cleanup step on G (cid:48) i and W ∪ L to obtain G (cid:48)(cid:48) i . Perform contraction step in G (cid:48)(cid:48) i [ W ∪ L ] to obtain G i +1 and c i +1 . Color refinement step . This step is done only if t > h i , r i ) ∈ { (3 , , (3 , } . Inthe case of type (3 ,
0) we have that c i : V ( G i ) → { , , } and in the case of type (3 ,
1) we havethat c i : V ( G i ) → { , , , } . There are four cases to consider, where in each case we do a colorrefinement :First case: ( h i , r i ) = (3 ,
0) and t (mod 6) = 0. Each vertex of color j ∈ { , , } will keep its colorwith probability 1 / j + 3 with probability 1 / h i , r i ) = (3 ,
0) and t (mod 6) = 3. Each vertex of color j ∈ { , , } will keep itscolor with probability 1 /
3, change its color to j + 3 with probability 1 /
3, and change its color to j + 6 with probability 1 / h i , r i ) = (3 ,
1) and t (mod 6) = 1. Each vertex of color j ∈ { , , } will keep its colorwith probability 1 / j + 3 with probability 1 /
2. Vertices of color 3 willalways change their color to 6.Fourth case: ( h i , r i ) = (3 ,
1) and t (mod 6) = 4. Each vertex of color j ∈ { , , } will keep itscolor with probability 1 /
3, change its color to j + 3 with probability 1 / j + 6 with probability 1 /
3. Vertices of color 3 will always change their color to 9.This defines the coloring c i +1 . The graph G i +1 will be the same as G i . It is immediate to verifythat the number of colors used in c i +1 is 6 + ( t (mod 6)), so the first two conditions in Definition3.7 hold. It remains to prove the third condition. Suppose that G i +1 (namely, G i ) has a simplecycle of size S ( k, i + 1) = S ( k, i ) = t whose coloring under c i +1 is ( h i +1 , r i +1 )-cyclic. Let thiscycle be C = ( v , v , . . . , v t − ). We must prove that the coloring of C under c i is ( h i , r i )-cyclic.Again, there are four cases to consider as in the previous paragraph. If ( h i , r i ) = (3 ,
0) and t (mod 6) = 0 then ( h i +1 , r i +1 ) = (6 , c i +1 ( v w ) = w (mod 6) for w = 0 , . . . , t −
1. But by thedefinition of the color refinement that we have done in this case, we have that c i ( v w ) = w (mod 3)so C under c i is (3 , h i , r i ) = (3 ,
0) and t (mod 6) = 3 then ( h i +1 , r i +1 ) = (6 , c i +1 ( v w ) = w (mod 6) for w = 0 , . . . , t − c i +1 ( v t − ) = 6, c i +1 ( v t − ) = 7, c i +1 ( v t − ) = 8. Butby the definition of the color refinement that we have done in this case, we have that c i ( v w ) = w (mod 3) for w = 0 , . . . , t − C under c i is (3 , h i , r i ) = (3 ,
1) and t (mod 6) = 1 then( h i +1 , r i +1 ) = (6 , c i +1 ( v w ) = w (mod 6) for w = 0 , . . . , t − c i +1 ( v t − ) = 6. But by thedefinition of the color refinement that we have done in this case, we have that c i ( v w ) = w (mod 3)for w = 0 , . . . , t − c i ( v t − ) = 3, so C under c i is (3 , h i , r i ) = (3 , t (mod 6) = 4 then ( h i +1 , r i +1 ) = (6 , c i +1 ( v w ) = w (mod 6) for w = 0 , . . . , t − c i +1 ( v t − ) = 6, c i +1 ( v t − ) = 7, c i +1 ( v t − ) = 8, c i +1 ( v t − ) = 9. But by the definition of the colorrefinement that we have done in this case, we have that c i ( v w ) = w (mod 3) for w = 0 , . . . , t − c i ( v t − ) = 3, so C under c i is (3 , , G N ( k ) then not only can we infer that G has a simple cycleof size k , we can also retrace it explicitly. Indeed, the only thing needed for retracing is to markeach edge of a contracted star in G (cid:48)(cid:48) i [ W ∪ L ] with the winner-loser pair that gave rise to that edge. Lemma 4.2.
Let G ∈ C , and suppose G has a simple cycle of size k ≥ . Then with probability atleast (252 d ) − k − O (log k ) the algorithm of Lemma 4.1 that constructs an S ( k ) minor sequence of G hasthe property that the last graph in the sequence, G N ( k ) , has a triangle that is colored (3 , -cyclic.Proof. Let C = ( v , . . . , v k − ) denote the simple cycle of size k assumed to exist in G . Consider15he coloring induced on C by the coloring c : V ( G ) → Z r constructed in the initial step ofthe algorithm. We lower-bound the probability that C is (4 , r )-cyclic. By definition, this holds if c ( v j ) = j (mod 4) for 0 ≤ j < k − r and c ( v k − j ) = 4 + r − j for 1 ≤ j ≤ r where recall that r = k (mod 4) so r ≤
3. Hence, the probability that C is (4 , r )-cyclic under the coloring c is at least1 / (4 + r ) k ≥ − k . If this occurred, we say that C survived in G .Now suppose that C survived in G i , meaning in particular that G i has a simple cycle C i =( u , . . . , u t − ) where t = S ( k, i ) and whose coloring under c i is ( h i , r i )-cyclic where the type of S ( k, i ) is ( h i , r i ). Given that, we would like to lower bound the probability that C survives also in G i +1 .There are several cases to consider. Suppose first that t > h i , r i ) ∈ { (3 , , (3 , } . Inthis case, we want C i to be ( h i +1 , r i +1 )-cyclic after the color refinement step that constructed c i +1 (recall that in this case G i +1 = G i ). Notice that in the color refinement step, vertices changetheir color to another color with probability at least 1 /
3. For example, in the case ( h i , r i ) = (3 , t (mod 6) = 3 vertices colored j ∈ { , , } change their color to one of { j, j + 3 , j + 6 } eachwith probability 1 /
3. More accurately, we go over the four cases of the color refinement step. If( h i , r i ) = (3 ,
0) and t (mod 6) = 0 then the probability that C i under c i +1 is ( h i +1 , r i +1 ) = (6 , / t . If ( h i , r i ) = (3 ,
0) and t (mod 6) = 3 then the probability that C i under c i +1 is( h i +1 , r i +1 ) = (6 , / t . If ( h i , r i ) = (3 ,
1) and t (mod 6) = 1 then the probabilitythat C i under c i +1 is ( h i +1 , r i +1 ) = (6 , / t − . If ( h i , r i ) = (3 ,
1) and t (mod 6) = 4then the probability that C i under c i +1 is ( h i +1 , r i +1 ) = (6 , / t − . In any case, withprobability at least (1 / t , given that C survived in G i , C also survived in G i +1 .Suppose next that we are not in a case “ t > h i , r i ) ∈ { (3 , , (3 , } ”. What is theprobability that C survived after the winner-loser cleanup step? This, in turn depends on therandom choices made in the degenerate labeling step and the winner-loser step. Again, there areseveral sub-cases to consider.First assume that ( h i , r i ) is such that r i ≥
2. So the unique vertex on C i whose color under c i is j is vertex u t − and the unique vertex on C i whose color under c i is j − u t − . For C to survive we must correctly guess which of u t − and u t − is a winner and which is a loser, andhope that the random d -degenerate labeling assigned label 1 to the edge connecting them. Suppose π ( u t − ) < π ( u t − ). So for survival we should guess that u t − is a winner, u t − is a loser, and (cid:96) ( u t − , u t − ) = 1. This occurs with probability at least (1 / · (1 / · (1 /d ) = 1 / (4 d ). Similarly,if π ( u t − ) < π ( u t − ) the probability for survival is at least 1 / (4 d ). Indeed, once we have guessedcorrectly, the contraction of the star in G (cid:48)(cid:48) i [ L ∪ W ] containing both u t − , u t − to a unified vertex x would create in G i +1 a cycle C i +1 = ( u , . . . , u t − , x ) which is colored ( h i , r i −
1) = ( h i +1 , r i +1 )-cyclicunder c i +1 , so C survived in G i +1 .Assume next that ( h i , r i ) is such that r i = 0 (so this is possible if h i ∈ { , , } but also the case t = 4 and ( h i , r i ) = (3 ,
1) since this case is equivalent to (4 , w of the form w h i ) = h i −
1, the vertices u w are colored with j under c i and the vertices u w − are colored with j − c i . In order for C to survive, we would like to correctly guess, for each such pair u w − , u w the winner, the loser, and that the random label between them is 1. As in the previous paragraph,this occurs with probability at least 1 / (4 d ) for each such pair, so the probability that C survived in G i +1 is at least (1 / d ) t/h i . Indeed, once we have guessed correctly, the contraction of the stars in G (cid:48)(cid:48) i [ L ∪ W ] containing both u w − , u w for each of the t/h i plausible w creates a unified vertex x w foreach of them and hence there is a cycle C i +1 = ( u , · · · , u h i − , x h i − , u h i , · · · , u t − h i , · · · , u t − , x t − )which is colored ( h i − ,
0) = ( h i +1 , r i +1 )-cyclic under c i +1 .Finally, the case that ( h i , r i ) is such that r i = 1 and h i ∈ { , , } is proved in exactly the sameway as the previous one. Just observe that the number of plausible w in this case is ( t − /h i sothe probability that C survived in G i +1 is at least (1 / d ) ( t − /h i .Let us now multiply all of the lower bounds of the probabilities of survival in each iteration,to obtain a lower bound for the survival probability of C in the final graph G N ( k ) , meaning that G N ( k ) has a triangle that is colored (3 , p i denote the probability of survival in G i .Then, summarizing what we have just proved:(i) p ≥ − k .(ii) If t = S ( k, i ) > ,
0) or (3 ,
1) then p i ≥ (1 / t .(iii) Otherwise, if t = S ( k, i ) is of type ( h i , r i ) with r i ≥ p i ≥ / (4 d ).(iv) Otherwise, p i ≥ (1 / d ) t/h i .The cases of types (4 ,
3) and (4 ,
2) are only possible at the beginning. Namely, if k (mod 4) = 3then S ( k,
1) is of type (4 ,
3) and S ( k,
2) is of type (4 , k (mod 4) = 2 then S ( k,
1) is of type(4 , p i ’s until the first time wereach the head of a segment (recall Lemma 3.6) is either p in the case where k (mod 4) ∈ { , } ,or p / (4 d ) in the case k (mod 4) = 2 or p / (16 d ) in the case k (mod 4) = 3. We next computethe product of the p i ’s corresponding to the elements of some segment whose first element is t . Inevery segment there is at most one element of type (3 ,
0) or (3 , p i ’s of the segment is at least (1 / t . There is at most one elementwhose type is in { (6 , , (6 , } , at most one element whose type is in { (5 , , (5 , } , and at mostone element whose type is in { (4 , , (4 , } . Hence, their contribution to the product is at least(1 / d ) t/ (1 / d ) t/ (1 / d ) t/ (we could have further optimized the exponent since, e.g., the elementof type (6 ,
1) or (6 ,
0) is already at most (cid:100) t/ (cid:101) < t but we do not worry about optimizing the baseof the exponent here). Finally, there are at most three elements of type in { (6 , , (6 , , } sotheir contribution to the product is at least (1 / d ) . Overall, the product of the p i ’s of a segment17hose first element is t is at least (cid:18) (cid:19) t (cid:18) d (cid:19) t/ t/ t/ = 164 d (cid:34) (cid:18) d (cid:19) / (cid:35) t But recall from Lemma 3.6 that the first element of the r ’th segment is at most (cid:100) k/ r − (cid:101) and thatthere are at most (cid:98) log k (cid:99) segments. It follows that the probability that C survived until the lastelement G N ( k ) is at least p d (cid:98) log k (cid:99) (cid:89) r =1 d (cid:34) (cid:18) d (cid:19) / (cid:35) (cid:100) k/ r − (cid:101) ≥ − k d (cid:18) d (cid:19) log k (cid:34) (cid:18) d (cid:19) / (cid:35) log k (cid:34) (cid:18) d (cid:19) / (cid:35) k = 116 d (cid:18) d (cid:19) log k (cid:34) (cid:18) d (cid:19) / (cid:35) log k (cid:34) (cid:18) d (cid:19) / (cid:35) k = (cid:34) (cid:18) d (cid:19) / (cid:35) k + O (log k ) In fact, we can do a bit better since it is immediate from the proof of the lemma that eachintroduction of a term 1 / (4 d ) in the probability expression corresponds to an edge contraction ofthe cycle C . As the overall number of contractions from a cycle of size k until a cycle of size 3 isreached at the final iteration is less than k , the probability above can be improved to at most (cid:20) (cid:18) d (cid:19)(cid:21) k + O (log k ) = (cid:18) d (cid:19) k + O (log k ) . It is not difficult to see that the number of “random bits” that we use throughout the algorithm is O ( k ) and that the whole algorithm is encoded with a binary string of length n . Hence it is fairlystandard to use the derandomization method of “almost k -wise independent random variables” forour purposes. In what follows we make this argument precise.Consider the sequence S ( k ) and recall that S ( k, i ) is the i ’th element in the sequence and thatits type is ( h i , r i ). In order to derandomize our algorithm, we first need to define certain vector-valued random variables M , . . . , M N ( k ) − , one for each but the last element of the sequence S ( k ),and M corresponding to the initial step. The length of each vector M i is n (note: we do not know18 priori how many vertices would be in each G i but we do know that there are never more than n ).We now define our sample space, namely the possible entries of each coordinate of each vector.For M , each coordinate can be an element of Z r where r = k (mod 4). For M i , consider thetype ( h i , r i ) of t = S ( k, i ). If ( h i , r i ) ∈ { (3 , , (3 , } and t >
4, then each coordinate can be one of { , , } . Otherwise, each coordinate is an element of { , } × [ d ].An instantiation of the random variables M , . . . , M N ( k ) − exactly defines the behavior of ourrandomized algorithm, as follows. First, let us fix a labeling of the n vertices with distinct integersfrom [ n ]. We will use this labeling throughout in all graphs G i , since if a star is contracted atsome point then the unified vertex can be labeled, say, by the smallest label of a vertex in the star.Hence for every vertex v , and for every graph G i throughout the algorithm, the entry M i [ v ] is welldefined (it is just the coordinate of M i which equals the label of v in G i ).For the initial step, recall that we randomly color the vertices of G with a coloring c : V ( G ) → Z r . So, each vertex v is colored by the color M [ v ].Now suppose we are at iteration i where we have the graph G i and its coloring c i . We proceedas in Lemma 4.1. If t = S ( k, i ) > h i , r i ) ∈ { (3 , , (3 , } then we have to perform thecolor refinement step. Recall that in this step, every vertex changes its color to one of two or threepossible other colors. For example, in the case of type (3 ,
0) and t (mod 6) = 0 a vertex colored j ∈ { , , } either keeps its color or changes its color to j + 3. So, looking at M i [ v ], if M i [ v ] = 0 wedo not change the color, if M i [ v ] = 1 we change the color to j + 3 and if M i [ v ] = 2 we can decideeither way. Otherwise, recall from Lemma 4.1 that we choose for certain vertices (those coloredwith the buffer color or those color with the next color after the buffer color) whether it is a winneror a loser. Also, for every winner, we choose one of its at most d incident edges connecting it tovertices appearing after it in π the label 1. So, for each such vertex v for which we need to decidewinner/loser, we examine M i [ v ] = ( x, y ) ∈ { , } × [ d ]. If x = 0 it is a winner, if x = 1 it is a loser.If it is a winner we label the y ’th edge connecting it to a vertex appearing after v in π with thelabel 1 (the ordering of the neighbors appearing after v in π is set to be the order of the labels ofthese vertices). Notice that it can be that y is larger than the number of vertices appearing after v in π , in which case we don’t label any edge incident with v with the label 1. We have completelydefined the execution path of the algorithm as a result of the values of M , . . . , M N ( k ) − . Statedotherwise, given M , . . . , M N ( k ) − , the algorithm of Lemma 4.1 is completely deterministic.We would like to explicitly find a small set T of instantiations of the M , . . . , M N ( k ) − such thatwe are guaranteed that a simple cycle C of size k survives throughout all the iterations, as in theproof of Lemma 4.2. What do we then require from our set T ? As for M , we require that everyset of k vertices (i.e. coordinates of M ) will receive any possible coloring in Z r . As for M i when( h i , r i ) ∈ { (3 , , (3 , } and t = S ( k, i ) >
4, we would like every set of t coordinates of M i to obtainall 3 t possible values of { , , } . As for the remaining M i we would like every set of t coordinatesof M i (note: this is more than needed, if r i ≥ r i ∈ { , } there are at most 2 t/h i verticeson the surviving cycle that should be declared winners or losers) to obtain every possible value of { , } × [ d ] (there are (2 d ) t such options).It would be more convenient to view the M i as binary vectors. So, in M , only three bits areenough to describe the entry M [ v ] ∈ Z r since 4 + r ≤
7. So the length of M is 3 n bits. For M i corresponding to types ( h i , r i ) ∈ { (3 , , (3 , } with t ≥
4, it suffices to use two bits for eachentry as the entries are in { , , } . For the remaining M i , they contain entries from { , } × [ d ] so1 + (cid:100) log d (cid:101) bits suffice for each coordinate.So we would like our set T to have instantiations such that for every 3 k bits from M , every 2 t bits from M i corresponding to types { (3 , , (3 , } and t >
4, and every t (1 + (cid:100) log d (cid:101) ) bits fromthe remaining M i , all possible choices are present. What is the total sum of the number of bitsthat we are considering? By Lemma 3.6, t decreases by a half after each segment, so overall we areexamining at most O ( k log d ) = O ( k ) bit locations. Viewing the M , . . . , M N ( k ) − as a consecutivesequence of binary vectors, its length is O (log kn ), so what we are looking for in T is a set of binaryvectors of the same length N = O (log kn ) each, such that for every choice of (cid:96) = O ( k ) bit locations,and for any choice of the 2 (cid:96) values in these locations, there will be a vector in T which, whenprojected to these locations, yields these values. In other words, we need a sequence X , . . . , X N of random Boolean variables that are (2 − (cid:96) , (cid:96) )-independent. For this purpose, it suffices to use thewell-known construction of Alon et. al. [1] (see also Naor and Naor [17]). In this constructionthe size of T is only 2 O ( (cid:96) ) log N and the time it takes to construct them is only 2 O ( (cid:96) ) N log N . Inour case, the size of T is therefore 2 O ( k ) log n and the time to construct it is 2 O ( k ) n log n . Wehave therefore shown how to derandomize our algorithm and obtain a worst-case running time of2 O ( k ) n log n , as required. Acknowledgmet
I thank the reviewers for their comments leading to an improved exposition of the paper.
References [1] N. Alon, O. Goldreich, J. H˚astad, and R. Peralta. Simple constructions of almost k -wiseindependent random variables. Random Structures & Algorithms , 3(3):289–304, 1992.[2] N. Alon, R. Yuster, and U. Zwick. Color Coding.
Journal of the ACM , 42(4):844–856, 1995.[3] A. Bj¨orklund, T. Husfeldt, P. Kaski, and M. Koivisto. Narrow sieves for parameterized pathsand packings.
Journal of Computer and System Sciences , 87:119–139, 2017.[4] B. Bollob´as.
Extremal Graph Theory . Academic Press, 1978.205] J. Chen, J. Kneis, S. Lu, D. M¨olle, S. Richter, P. Rossmanith, S. Sze, and F. Zhang. Random-ized divide-and-conquer: Improved path, matching, and packing algorithms.
SIAM Journalon Computing , 38(6):2526–2547, 2009.[6] E. D. Demaine, F. V. Fomin, M. Hajiaghayi, and D. M. Thilikos. Subexponential parameterizedalgorithms on bounded-genus graphs and H -minor-free graphs. Journal of the ACM , 52(6):866–893, 2005.[7] E. D. Demaine and M. Hajiaghayi. Diameter and treewidth in minor-closed graph families,revisited.
Algorithmica , 40(3):211–215, 2004.[8] F. Dorn. Planar subgraph isomorphism revisited. In
Proceedings of the 27th InternationalSymposium on Theoretical Aspects of Computer Science, (STACS) , pages 263–274, 2010.[9] F. Dorn, F. V. Fomin, D. Lokshtanov, V. Raman, and S. Saurabh. Beyond bidimensionality:Parameterized subexponential algorithms on directed graphs.
Information and Computation ,233:60–70, 2013.[10] F. Dorn, F. V. Fomin, and D. M. Thilikos. Catalan structures and dynamic programming in H -minor-free graphs. Journal of Computer and System Sciences , 78(5):1606–1622, 2012.[11] F. Dorn, E. Penninkx, H. L. Bodlaender, and F. V. Fomin. Efficient exact algorithms on planargraphs: Exploiting sphere cut decompositions.
Algorithmica , 58(3):790–810, 2010.[12] D. Eppstein. Subgraph isomorphism in planar graphs and related problems.
Journal of GraphAlgorithms and Applications , 3(3):1–27, 1999.[13] D. Eppstein. Diameter and treewidth in minor-closed graph families.
Algorithmica , 27(3-4):275–291, 2000.[14] F. V. Fomin, D. Lokshtanov, D. Marx, Marcin Pilipczuk, Micha(cid:32)l Pilipczuk, and S. Saurabh.Subexponential parameterized algorithms for planar and apex-minor-free graphs via lowtreewidth pattern covering. In
Proceedings of the 57th Annual Symposium on Foundationsof Computer Science (FOCS) , pages 515–524. IEEE, 2016.[15] F. V. Fomin, D. Lokshtanov, F. Panolan, and S. Saurabh. Efficient computation of represen-tative families with applications in parameterized and exact algorithms.
Journal of the ACM ,63(4):1–60, 2016.[16] D. W. Matula and L. L. Beck. Smallest-last ordering and clustering and graph coloring algo-rithms.
Journal of the ACM , 30(3):417–427, 1983.2117] J. Naor and M. Naor. Small-bias probability spaces: Efficient constructions and applications.
SIAM Journal on Computing , 22(4):838–856, 1993.[18] M. Pilipczuk and S. Siebertz. Polynomial bounds for centered colorings on proper minor-closedgraph classes. In
Proceedings of the Thirtieth Annual ACM-SIAM Symposium on DiscreteAlgorithms (SODA) , pages 1501–1520. SIAM, 2019.[19] N. Robertson and P. Seymour. Graph minors XX. Wagner’s conjecture.
Journal of Combina-torial Theory, Series B , 92(2):325–357, 2004.[20] M. Zehavi. Mixing color coding-related techniques. In