Parameterized Saga of First-Fit and Last-Fit Coloring
Abstract
The classic greedy coloring algorithm considers the vertices of an input graph in a given order and assigns the first available color to each vertex in . In the Grundy Coloring problem, the task is to find an ordering of the vertices that will force the greedy algorithm to use as many colors as possible. In the Partial Grundy Coloring, the task is also to color the graph using as many colors as possible. This time, however, we may select both the ordering in which the vertices are considered and which color to assign the vertex. The only constraint is that the color assigned to a vertex is a color previously used for another vertex if such a color is available.
Whether Grundy Coloring and Partial Grundy Coloring admit fixed-parameter tractable (FPT) algorithms, algorithms with running time , where is the number of colors, was posed as an open problem by Zaker and by Effantin et al., respectively.
Recently, Aboulker et al. (STACS 2020 and Algorithmica 2022) resolved the question for Grundy Coloring in the negative by showing that the problem is W[1]-hard. For Partial Grundy Coloring, they obtain an FPT algorithm on graphs that do not contain as a subgraph (a.k.a. -free graphs). Aboulker et al. re-iterate the question of whether there exists an FPT algorithm for Partial Grundy Coloring on general graphs and also asks whether Grundy Coloring admits an FPT algorithm on -free graphs. We give FPT algorithms for Partial Grundy Coloring on general graphs and for Grundy Coloring on -free graphs, resolving both the questions in the affirmative. We believe that our new structural theorems for partial Grundy coloring and “representative-family” like sets for -free graphs that we use in obtaining our results may have wider algorithmic applications.
Keywords and phrases:
Grundy Coloring, Partial Grundy Coloring, FPT Algorithm, -free graphsFunding:
Akanksha Agrawal: Supported by the New Faculty Seed Grant, IIT Madras(No. NFSC008972).
Copyright and License:
![[Uncaptioned image]](x1.png)
Shaily Verma; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Fixed parameter tractabilityEditors:
Olaf Beyersdorff, Michał Pilipczuk, Elaine Pimentel, and Nguyễn Kim ThắngSeries and Publisher:

1 Introduction
A proper coloring of a graph is an assignment of colors to its vertices such that none of the edges have endpoints of the same color. In -Coloring, we are given a graph , and the objective is to test whether admits a proper coloring using at most colors. The -Coloring problem is one of the classical NP-hard problems, and it is NP-complete for every fixed . The problem is notoriously hard even to approximate. Indeed, approximating -Coloring within , for any , is hard [18]. Also, under a variant of Unique Games Conjecture, there is no constant factor approximation for -Coloring [14].
The -Coloring problem has varied applications ranging from scheduling, register allocations, pattern matching, and beyond [8, 9, 29]. Owing to this, several heuristics-based algorithms have been developed for the problem. One of the most natural greedy strategies considers the vertices of an input graph in an arbitrary order and assigns to each vertex the first available color in the palette (the color palette for us is ). In literature, this is called the first-fit rule. Notice that there is nothing special about using the “first” available color; one may instead opt for any of the previously used colors, if available, before using a new color; let us call this greedy rule the any-available rule. It leads to yet another greedy strategy to properly color a graph, and one can easily prove that this greedy strategy is equivalent to the “last-(available) fit” rule.
For any greedy strategy, one may wonder: How bad can the strategy perform for the given instance? The above leads us to the well-studied fundamental combinatorial problems, Grundy Coloring and Partial Grundy Coloring, that arise from the aforementioned greedy strategies for proper coloring. In the Grundy Coloring problem, we are given a graph on vertices and an integer , and the goal is to check if there is an ordering of the vertices on which the first-fit greedy algorithm for proper coloring uses at least colors. Similarly, we can define the Partial Grundy Coloring problem, where the objective is to check if, for the given graph on vertices and integer , there is an ordering of the vertices on which the any-available greedy algorithm uses at least colors. In this paper, we consider these two problems in the realm of parameterized complexity.
The Grundy Coloring problem has a rich history dating back to 1939 [21]. Goyal and Vishwanathan [20] proved that Grundy Coloring is NP-hard. Since then, there has been a flurry of results on the computational and combinatorial aspects of the problem both on general graphs and on restricted graph classes, see, for instance [6, 7, 16, 23, 26, 10, 36, 33, 37, 39, 35, 3, 27, 24, 38] (this list is only illustrative, not comprehensive). The problem Partial Grundy Coloring was introduced by Erdös et al. [16] and was first shown to be NP-hard by Shi et al. [34]. The problem has gained quite some attention thereafter; see, for instance [1, 32, 25, 36, 12, 15, 5, 4].
These problems have also been extensively studied from the parameterized complexity perspective. Unlike -Coloring, both these problems admit XP algorithms [38, 15], i.e., an algorithm running in time bounded by . The above naturally raises the question of whether they are fixed-parameter tractable (FPT), i.e., admit an algorithm running in time . In fact, these problems have also been explicitly stated as open problems [1, 7, 23, 33].
Havet and Sampaio [23] studied Grundy Coloring with an alternate parameter and showed that the problem of testing whether there is a Grundy coloring with at least colors is FPT parameterized by . Bonnet et al. [7] initiated a systematic study of designing parameterized and exact exponential time algorithms for Grundy Coloring and obtained FPT algorithms for the problem for several structured graph classes. They gave an exact algorithm for Grundy Coloring running in time and also showed that the problem is FPT on chordal graphs, claw-free graphs and graphs excluding a fixed minor. In the same paper, they stated the tractability status of Grundy Coloring on general graphs parameterized by the treewidth or the number of colors as central open questions. Belmonte et al. [6] resolved the first question by proving that Grundy Coloring is W[1]-hard parameterized by treewidth, but surprisingly, it becomes FPT parameterized by pathwidth. Later, Aboulker et al. [1] proved that Grundy Coloring does not admit an FPT algorithm (parameterized by the number of colors) and obtained an FPT algorithm for Partial Grundy Coloring on -free graphs (which includes graphs of bounded degeneracy, graphs excluding some fixed graph as minor/topological minors, graphs of bounded expansion and nowhere dense graphs). A graph is -free if it does not have a subgraph isomorphic to the complete bipartite graph with and vertices, respectively, on the two sides. They concluded their work with the following natural open questions:
- Question 1:
-
Does Partial Grundy Coloring admit an FPT algorithm?
- Question 2:
-
Does Grundy Coloring admit an FPT algorithm on -free graphs?
In this paper, we resolve the questions and in the affirmative by a new structural result and a new notion of representative families for -free graphs, respectively. In the next section, we give an intuitive overview of both results, highlighting our difficulties and our approaches to overcome them.
1.1 Our Results, Methods and Overview
Our first result is the following.
Theorem 1.
Partial Grundy Coloring is solvable in time .
Our algorithm starts with the known “witness reformulation” of Partial Grundy Coloring. It is known that is a yes-instance of Partial Grundy Coloring if and only if there is a vertex subset of size at most such that, is a yes-instance of the problem. In the above, the set is known as a small witness set. Our algorithm is about finding such a set of size at most . Observe that this witness reformulation immediately implies that Partial Grundy Coloring admits an algorithm with running time time. To build our intuition, we first give a simple algorithm for the problem on graphs of bounded degeneracy (or even, nowhere dense graphs). This algorithm has two main steps: (a) classical color-coding of Alon-Yuster-Zwick [2], and (b) independence covering lemma of Lokshtanov et al. [28].
Let be a yes instance of Partial Grundy Coloring, where is a -degenerate graph on vertices, and be a small witness set of size at most . As must be a yes-instance of the problem, there exists an ordering of the vertices such that when we apply any-available greedy rule, it uses at least colors. Let be this proper coloring of . The tuple is called a -partial Grundy witness for . Now we apply the color-coding step of the algorithm. That is, we color the vertices of using colors independently and uniformly at random, and let be the color classes of this coloring. The probability that for each , , is . Notice that since is a -degenerate graph, we have that , for each , is -degenerate. Now we exploit this fact and apply the independence covering lemma of Lokshtanov et al. [28]. That is given as input , in time it produces a family of independent sets of , of size . Furthermore, given any independent set of of size at most , there exists an independent set , such that ( covers ). In particular, we know that there is a set that covers . So, the algorithm just enumerates each tuple of and checks whether is a -partial Grundy coloring of . If is a yes instance, our algorithm is successful with probability . Moreover, we can convert the described randomized algorithm to a deterministic one by using the standard derandomization technique of “universal sets” [31, 17]. Some remarks are in order; it can be shown that each of , and hence we can call the independence covering lemma on , resulting in an improved running time of . Aboulker et al. [1] proved that Partial Grundy Coloring on -free graphs is FPT, which includes -degenerate graphs. Aboulker et al. did not explicitly mention the running time, but their running time is at least . Our new algorithm improves over this. For general instances, we do not have a bound on the degeneracy of the input graph. However, we can achieve this by using our new structural result.
Theorem 2 (Structural result).
There is a polynomial-time algorithm that given a graph and a positive integer , does one of the following:
-
(i)
Correctly concludes that is a yes-instance of Partial Grundy Coloring, or
-
(ii)
Outputs at most induced bicliques in such that the following holds. For any , the degree of in is at most , where is the union of the edges in the above bicliques.
The structural result (Theorem 2) is one of our main technical contributions. Next, we show how to design an algorithm for Partial Grundy Coloring using Theorem 2. We follow the same steps as for the one described for the degenerate case. That is, we have color classes s and they contain the respective s (the part of the small witness set ). Now, to design a family of independent sets in , we do as follows. Let be a bipartition of , for each . Observe that any independent set (in particular of ) intersects or , but not both, for any . Thus, we first guess whether intersects , or none. Let this be given by a function , that is, if , then , if , then , else . Taking advantage of this property, for each guess of which of or is not contained in , we delete the corresponding set (which is one of or , for each ) from . We call the resulting graph . This implies that for any , in we delete all edges of (where is the union of edges in the bicliques). Hence, the maximum degree of is at most , and therefore it has degeneracy at most . Now using the independence covering step of the algorithm for degenerate graphs, we can finish the algorithm. The proof of Theorem 2 is obtained by carefully analyzing the reason for the failure of a greedy algorithm.
Our next result is an affirmative answer to Question .
Theorem 3.
For any fixed , there is an FPT algorithm that given a graph and a positive integer , decides if there is Grundy coloring of using at least colors.
For our algorithm, we use a reinterpretation of the problem which is based on the existence of a small witness. Gyárfás et al. [22], and Zaker [38] independently showed that a given instance of Grundy Coloring is a yes-instance if and only if there is a vertex subset of size at most , such that is also a yes-instance of the problem. The existence of this small induced subgraph directly yield an XP algorithm for the problem [38]. Using characterizations of [22, 38] and basic Grundy coloring properties, we can reduce Grundy Coloring to finding a homomorphic image, satisfying some independence constraints, of some specific labeled trees (see Fig. 1, where different parts of it will be discussed, shortly). Let the pair denote a rooted tree together with a labeling function . Given and a graph , a function is a labeled homomorphism if: i) for each , we have , and ii) for , if , then . In particular, we will reduce the problem to the following.
Constrained Label Tree Homomorhism (CLTH) Parameter: Input: A host graph and , where is a tree. Question: Does there exists a labeled homomorphism such that for any , is an independent set in ?
Now our goal is to identify (and thus the witness set ). The first step of our algorithm will be to use the color-coding technique of Alon-Yuster-Zwick [2] to ensure that the labeling requirement of the graph homomorphism is satisfied. To this end, we randomly color the vertices of using colors, where we would like the random coloring to ensure that for each , all the vertices in are assigned the color . Let be the color classes in a coloring that achieves the above property. Our objective will be to find such that vertices of that are labeled are assigned to vertices in .
Our next challenge is to find a homomorphism that additionally satisfies the independence condition. That is, vertices of the same label in are assigned to an independent set in . Note that the number of potential s that satisfy our requirements can be very huge; however, we will be able to carefully exploit -freeness to design a dynamic programming-based algorithm to identify one such (and thus the set ). Our approach here is inspired by dynamic programming in the design of FPT algorithms based on computations of “representative sets” [30, 19]. However, this inspiration ends here, as to apply known methods we need to have an underlying family of sets that form a matroid. Unfortunately, we do not have any matroid structure to apply the known technique. Here, we exploit the fact that we have a specific labeled tree and a -free graph. Next we define the specific trees that we will be interested in (see Fig. 1, (ii)).
Definition 4.
For each , we (recursively) define a pair , called a -Grundy tree, where is a tree and is a labelling of , as follows :
-
1.
is a tree with exactly one vertex (which is also its root), and .
-
2.
Consider any , we (recursively) obtain as follows. For each , let be the -Grundy tree with root . We assume that for distinct , and have no vertex in common, which we can ensure by renaming the vertices.111For the sake of notational simplicity we will not explicitly write the renaming of vertices used to ensure pairwise vertex disjointness of the trees. This convention will be followed in the relevant section. We set and . We set , and for each and , we set .
For , is the label of in , and the elements in are labels of .
Observe that the label of a vertex is the depth of the subtree rooted at (the depth of a leaf is ). In particular, the leaves are assigned the label , and when they are deleted, we get vertices with the label as leaves, and so on. This allows us to do a bottom-up dynamic programming over . Roughly speaking, for each , we solve the special labelled tree homomorphism from , where the root of is mapped to a fixed vertex as follows: instead of having all potential choices for (or ), we find enough representatives, that will allow us to replace by something that we have stored. It is a priori not clear that such representative sets of small size exist and furthermore, even if they exist, how to find them. The existence and computation of small representative sets in this setting is our main technical contribution for Grundy Coloring.
We heavily exploit the -freeness in our “representative set” computation. Very roughly stating, while we have computed required representatives for , and wish to build such a representatives for , by exploiting -freeness, we either find a small hitting set or a large sub-family of pair-wise disjoint sets. In the former case, we can split the family and focus on the subfamily containing a particular vertex from the hitting set and obtain a “representative” for it (and then take the union over such families). In the latter case, we show that we are very close to satisfying the required property, except for the sets containing vertices from an appropriately constructed small set of vertices. The construction of this small set is crucially based on the -freeness of the input graph. Once we have the set , we can focus on sets containing a vertex from it and compute “representatives” for them.
2 Preliminaries
Generic Notations.
We denote the set of natural numbers by . For , denotes the set . For a function and , .
For standard graph notations not explicitly stated here, we refer to the textbook of Diestel [13]. For a graph , we denote its vertex and edge set by and , respectively. Also, if the context is clear, we will use and to denote the numbers and , respectively. The neighborhood of a vertex in a graph is the set of vertices that are adjacent to in , and we denote it by . The degree of a vertex is the size of its neighborhood in , and we denote it by . For a set of vertices , we define . When the graph is clear from the context, we drop the subscript from the above notations. For , the induced subgraph of on , denoted by , is the graph with vertex set and edge set . Also, is denoted by . For , we use to denote for ease of notation. For an edge subset , is the graph with vertex set and edge set . A bipartite graph is called a biclique if every vertex in is adjacent to every vertex in . We assume that and are both non-empty sets. For , a graph is -degenerate if each of its subgraphs has a vertex of degree at most . For terminologies related to parameterized complexity, see the textbook of Cygan et al. [11].
3 FPT Algorithm for Partial Grundy Coloring
Consider a graph and an integer . For a (not necessarily proper) coloring , for simplicity, we sometimes write as the ordered tuple . Recall that a proper coloring of a graph is a coloring of its vertices so that for none of its edges, the two endpoints of it are of the same color. Also, a -partial Grundy coloring of is a proper coloring , such that for each , there is a vertex with: and for every , there is with .
We will begin with some definitions and results that will be useful in obtaining our main structural result (Theorem 2) and our FPT-algorithm (Theorem 1).
Observe that given a -partial Grundy coloring of an induced subgraph of a graph , we can extend this coloring to a partial Grundy coloring of the whole graph using at least colors by greedily coloring the uncolored vertices of . The following observation will be particularly useful when we work with a small “witness”.
Observation 5.
Given a graph , an induced subgraph of , and a partial Grundy coloring of using colors, we can find a partial Grundy coloring of using at least colors in linear time.
Proof.
Let be a partial Grundy coloring of with exactly colors. We construct a partial Grundy coloring of using at least colors as follows. For each vertex , set . Let be an arbitrarily fixed order of vertices in . Let , and for each , . We iteratively create a partial Grundy coloring of using at least colors (in increasing values of ) as follows. Note that is already a partial Grundy coloring of that uses at least colors. Consider , and assume that we have already computed a partial Grundy coloring of that uses colors. For each , let . For each , we set . If the vertex has a neighbor in each of the sets , i.e., if for each , , then set . Otherwise, let be the smallest number such that , and set . Notice that by construction, is a partial Grundy coloring of using at least colors. From the above discussions, is a partial Grundy coloring of using at least colors.
Definition 6.
Consider a graph and an integer . A sequence of pairwise disjoint independent sets of is a -partial Grundy witness if the following holds. For any , there is such that for all , . The vertex is called a dominator in .
Observation 7.
Given a graph and an integer , let be a -partial Grundy witness. Suppose are pairwise disjoint independent sets in such that , for all . Then is also a -partial Grundy witness of .
A -partial Grundy witness is small if for each , . Next, we prove the existence of a small -partial Grundy witness. This result is the same as the one obtained by Effantin et al. [15]; however, it is stated slightly differently for convenience.
Observation 8 ().
222The proofs of the result marked with can be found in the full version of the paper on arXiv. Let be a graph and be an integer, where has a -partial Grundy witness . Then, there exists a -partial Grundy witness such that for each , and .
3.1 Degree Reduction: Proof of Theorem 2
The objective of this section is to prove Theorem 2. The proof of this theorem is based on the following lemma for bipartite graphs.
Lemma 9.
There is a polynomial-time algorithm that, given a bipartite graph and a positive integer , does one of the following.
-
(i)
Correctly concludes that the partial Grundy coloring of is at least .
-
(ii)
Outputs at most bicliques in such that for any , degree of in is at most , where is the union of the edges in the above bicliques.
We first give a proof of Theorem 2 based on the above lemma.
Proof of Theorem 2.
Consider a graph and a positive integer . First, we run the first-fit greedy algorithm for proper coloring of the graph for an arbitrarily fixed ordering of . For each , let be the vertices colored and be the largest integer such that . Note that is a proper coloring of . Also, for any and any vertex in , has a neighbor in for all . If , then is a partial Grundy coloring of using at least colors, and thus we can correctly report it.
Next, we assume that . Note that all the edges in are between the color classes . Now for every distinct , where , we apply Lemma 9 on , where is the set of edges in between the color classes and . Our algorithm will declare that has a partial Grundy coloring using at least colors if we get the output given in statement in any of the applications of Lemma 9. Otherwise, for every distinct , where , let be the bicliques, we get as output by the algorithm in Lemma 9 on . Note that . Now our algorithm will output the bicliques . As for all , the number of bicliques we output is at most , that is, at most . Since any vertex in a color class has neighbors in other color classes, for and we applied Lemma 9 for every pair of color classes, the degree of in is at most for any , where is the union of the edges in the above bicliques. This completes the proof of the theorem.
We now focus on the proof of Lemma 9. Toward this, we give a polynomial time procedure that, given a bipartite graph and a positive integer , either concludes that the input graph has partial Grundy coloring using at least colors or it outputs at most bicliques in such that for any , , where is the union of the edges in the above bicliques. That is, removal of the edges of these bicliques bounds the degree of each vertex in by . We get the proof of Lemma 9 by applying this algorithm once for and then for .
Overview of our algorithm.
Let be an ordering of the vertices in in non-increasing order of their degree in . The algorithm constructs specific color classes in this order so that is an -partial Grundy witness, where . Furthermore, we will construct sets , , which will be used to construct the bicliques. Notice that if we obtain , then we will be able to conclude that has a partial Grundy coloring using at least colors. Let and in our construction will be the dominator in (and our construction needs to ensure this property; see Definition 6). Consider the construction of . Let be the smallest index in for which there is a vertex such that is not adjacent to . Then, we set , and designate as the dominator in color class . Notice that all the vertices in are adjacent to all the vertices in , and hence they together form a biclique (with bipartition and ). This property will be extended in building each s and the required bicliques.
For the construction of , we consider unprocessed vertices (i.e., the vertices that do not belong to the previously constructed sets, i.e., to ) as follows. We would now like to choose an unprocessed vertex , so that we can make the dominator of , and additionally, for each , we can include a neighbor of the dominator from to the set . Note for us to do the above, we need to ensure that the vertices that we add to is an independent set in , and all the vertices that we want to include in the set are outside . That is, among the unprocessed vertices, we choose the first vertex with the following property: for each , we have a neighbor of the previously constructed dominator in such that and ; we set . We would like to mention that all the dominators we construct are from the bipartition and hence . This will imply that is an independent set.
Moreover, by the choice of as the smallest vertex with the desired property, it follows that for any vertex that appears before in the order and , the vertex is adjacent to all the vertices in , where is the dominator in , for some . Then we add to . Note that in the above process, we still maintain the biclique property, by explicitly ensuing that and forms a biclique.
Description of the algorithm.
We give a pseudocode of our algorithm in Algorithm 1. First, the algorithm intializes the sets and to be the empty set, for all (see Algorithm 1). Let be an ordering of the vertex set in the non-increasing order of their degrees. Now, we want to construct the color classes , iteratively, such that is a -partial Grundy witness. At line 3, we intialize with , , and fix the index . Here, will be the color class with dominator vertex . Now consider an iteration of the while loop. The algorithm checks if the set is non-empty and executes the while loop. At this point we have constructed sets such that is a -partial Grundy witness such that each is a dominator vertex in . Let be the first unprocessed vertex in and by Lines 5 and 6. Now, we check if we can construct the current color class with vertex as a dominator vertex, and for that, we need to add a neighbor (which is not added to any before) for each already discovered dominator such that is non-adjacent to . Now, if there exists some such that each neighbor of is a neighbor of , then we will not be able to construct with vertex in it. In that case, we choose such a value and add to (See Line 8). Here, notice that is adjacent to all the vertices . We will maintain this property for all the vertices added to , i.e., union forms a biclique. Now consider the case that the condition in the if statement in Line 7 is false. Then, we choose a vertex for each , by line 11 and set the vertex as the dominator for , that is, , at Line 13. Notice that is an independent set because there is no edge between and a vertex in , and is a subset of , the right part of the bipartition of . We repeat the iteration until one of the while loop conditions at line 4 fails. Next, if , we conclude that has a partial Grundy coloring using colors by line 18, because is a -partial Grundy witness, where . Otherwise, by line 20, let be the graph induced on and be the graph induced on , for each . Recall that is a biclique. It is easy to see that is a biclique, because is a bipartite graph. At line 21, the algorithm outputs the set of graphs and .
The number of iterations of the while loop is at most and each step in the algorithm takes polynomial time, the total running time of the algorithm is polynomial in the input size. Next, we prove the correctness of the algorithm.
Lemma 10.
Algorithm 1 is correct.
Proof.
Let be the value of at the end of the algorithm. To prove the correctness of the algorithm, first, we prove the following claim.
Claim 11.
The following statements are true.
-
(i)
For each , is an independent set and .
-
(ii)
For each and , .
-
(iii)
For each and , is adjacent to all the vertices in and .
Proof.
We prove the statements by induction on . The base case is when . Clearly, and hence statement (i) is true. Statement (ii) is vacuously true. Next, we prove statement (iii). Notice that in any iteration of the while loop, in Step 8, we may add a vertex to . If this happens, then we know that , where is a subset of . That is, all the vertices in are adjacent to . This implies that is adjacent to all the vertices in . Since is the vertex with the maximum degree, we have that .
Next, for the induction step, we assume that the induction hypothesis is true for , and we will prove that the hypothesis is true for . Consider the iteration of the while loop when and Steps 11-14 is executed. Let be the vertex mentioned in Step 5 during that iteration. The vertices belongs to (the right side of the bipartition of ) and hence is an independent set. Also, notice that each does not belong to (See Step 11). Hence, is an independent set and . Thus, we proved statement (i). Again, notice that for all (See Step 11). Thus, statement (ii) follows. Next, we prove statement (iii), which is similar to the proof of it in the base case. Notice that in any iteration of the while loop (after the iteration ), in Step 8, we may add a vertex to . If this happens, then we know that , where is a subset of . That is, all the vertices in are adjacent to . This implies that is adjacent to all the vertices in . Since , considered in iteration , (See Step 5). This completes the proof of the claim.
Now suppose . Then, by Statements (i) and (ii) in Claim 11, we get that is a partial Grundy coloring of the graph induced on . Thus, if the algorithm executes Step 18, then it is correct because of Claim 5.
Now suppose . Then the algorithm executes Step 21 and outputs the sets and . Statement (iii) in Claim 11 implies that each is a biclique in , where . Also, note that is a biclique in as it is induced on the set , for each . Let be the union of the edges in the bicliques and . Next, we prove that for any , . Let . It is easy to see that and , for all (See Steps 11-13). Hence, . Let be an arbitrary vertex in . Note that if , the degree of in is zero (by the definition of ). Next, suppose that . Since (this is the condition for while loop to exit) and for all , belongs to for some . By statement (iii) in Claim 11, is adjacent to all the vertices in and . Recall that the biclique is the graph with bipartition and . Moreover and . This implies that the number of neighbors of that does not belong to is at most , which is upper bounded by . Therefore, the degree of in is at most . See Figure 2 for an illustration. This concludes the proof.
3.2 FPT Algorithm for Partial Grundy Coloring
In this section, we design an FPT algorithm for Partial Grundy Coloring when the input has a structure dictated the second item of Lemma 9. Then, we explain how to get an FPT algorithm for Partial Grundy Coloring on general graphs using and Theorem 2. Moreover, our algorithm will provide a faster algorithm for Partial Grundy Coloring on -degenerate graphs, improving the result in [1]. Toward the first task, we define the following problem.
Structural Partial Grundy Coloring (SPGC ) Input: Positive integers , a graph , and bicliques in such that is -degenerate, where is the union of the edges in the above bicliques. Question: Decide if there is a partial Grundy coloring for using at least colors.
First, we design a randomized polynomial time algorithm for SPGC with a success probability at least . We increase the probability of success to a constant by running multiple times. Finally, we explain the derandomization of our algorithm. Then we prove Theorem 1 using this algorithm and our structural result (Theorem 2). To design the algorithm , we use the following result of Lokshtanov et al. [28].
Proposition 12 (Lemma 1.1. [28]).
There is a linear-time randomized algorithm that, given a -degenerate graph and an integer , outputs an independent set such that for any independent set in with , the probability that is at least .
The algorithm has the following steps.
-
1.
Color all vertices in uniformly and independently at random with colors from the set . Let the obtained coloring be , and , for each .
-
2.
For each , let . For each and , uniformly at randomly assign or . That is, with probability , and with probability , . Let .
-
3.
Now for each , we apply the algorithm in Proposition 12 for to obtain an independent set .
-
4.
If is a -partial Grundy witness of , then output Yes, else, output No.
Since the algorithm in Proposition 12 runs in linear time, the algorithm can be implemented to run in linear time because is a partition of . Clearly, if the algorithm outputs Yes, then has a -Partial Grundy witness and hence has a partial Grundy coloring using at least colors. We can prove that if has a -Partial Grundy witness the algorithm outputs Yes with probability .
Also, by running , times and outputting Yes if at least one of the runs outputs a Yes, and outputs No, otherwise, we can boost the success probability to , and thus obtain the following result.
Theorem 13.
There is a randomized algorithm for SPGC running in time . In particular, if is a no-instance then with probability the algorithm outputs No; and if is a yes-instance then with probability the algorithm outputs Yes.
Theorem 14.
There is a randomized algorithm for Partial Grundy Coloring running in time . In particular, if is a no-instance then with probability the algorithm outputs No; and if is a yes-instance then with probability the algorithm outputs Yes.
Proof Sketch.
First we run the algorithm mentioned in Theorem 2. If it concludes that has a partial Grundy coloring with at least colors, then we output Yes. Otherwise, we get at most induced bicliques in such that the following holds. For any , the degree of in is at most , where is the union of the edges in the above bicliques. That is the degeneracy of is at most . Then, we apply Theorem 13, and ouputs accordingly.
The derandomization of our algorithm can be found in the full version.
4 FPT Algorithm for Grundy Coloring on -free Graphs
This section aims to prove Theorem 3. Consider fixed , where . Recall that a graph is -free if it does not contain a subgraph isomorphic to . We call the special case of Grundy Coloring where the input graph is -free, -Free Grundy Coloring. Let be an instance of -Free Grundy Coloring. We begin by intuitively explaining the flow of our algorithm.
Consider a Grundy coloring of , where , and for each , . Furthermore, for , let . Let us focus on the first color classes, and for , arbitrarily fix a vertex . (Note that has a neighbor in , for each .) We next intuitively describe construction, for each , a set initialized to as follows. Basically, for each , add an arbitrarily chosen neighbor of it in color class , for every . We do the above process exhaustively; whenever we add a vertex to a set , we add an arbitrarily chosen neighbor of it from each color class to , where . Then, let ; we will call such a set a -Grundy set for and we will show that such a set of size at most exists (for yes instances). For , let and . Note that is a -Grundy coloring of . Also, we will show that has a Grundy coloring using at least colors if and only if some subgraph of has a Grundy coloring using exactly colors. We remark that the above result and the existence of are the same as the results of Gyárfás et al. [22] and Zaker [38], although, for the sake of convenience, we state it here slightly differently. If we can identify all the vertices in (or some other -Grundy set), then we will be done. The first step of our algorithm will be to use the technique of color coding to randomly color the vertices of using colors so that, for each , is colored ; such a coloring will be a nice coloring and it will be denoted by .
The next step of our algorithm is inspired by the design of FPT algorithms based on computations of “representative sets” [30, 19]. To this end, we will interpret in a “tree-like” fashion. With this interpretation, in a bottom-up fashion, for each and , we will compute a family , so that, if , then there will be so that is also a -Grundy set for . We will now formalize the above steps.
Grundy Tree & Grundy Witness.
Observation 15 ().
For , for the -Grundy tree , .
Observation 16 ().
Consider and the -Grundy tree . We have and for each , .
Next, we define the notion of -Grundy witness in a graph .
Definition 17.
Consider and a graph . A -Grundy witness for is a function , where is the -Grundy tree, such that: 1) for each , is an independent set in , 2) for each , if then , and 3) for each , we have .
Recall that for , for the -Grundy tree , is the tree obtained by adding a root vertex attached to the roots of (pairwise vertex disjoint) trees , where for each , is the -Grundy tree. We have the following observation.
Observation 18 ().
Consider , a graph and a -Grundy witness for . For each , is a -Grundy witness for .
The next observation is a partial Grundy counterpart of Observation 5.
Observation 19 ().
Consider a graph , any induced subgraph of it, and an integer . If has a Grundy coloring that uses exactly colors, then has a Grundy coloring that uses at least colors.
In the following two lemmas, we show that the existence of a -Grundy witness for a graph is equivalent to the graph admitting a Grundy coloring with at least colors.
Lemma 20.
For any and a graph , if has a -Grundy witness, then has a Grundy coloring with at least colors.
Proof.
Consider a graph and any . For a -Grundy witness of , let , and for each , let . Note that from item 2 of Definition 17, is a partition of , where none of the parts are empty. Let be the function such that for each and , we have .
For each and a -Grundy witness of , we will prove by induction (on ) that is Grundy coloring of using colors. The above statement, together with Observation 19, will give us the desired result.
The base case is , where has exactly one vertex, . For any -Grundy witness, of , note that is a Grundy coloring for using color. Now for the induction hypothesis suppose that for some , for each , the statement is true. Now we will prove the statement for , and to this end, we consider a -Grundy witness , where is the root of . Recall that is the tree obtained by adding a root vertex attached to the roots of (pairwise vertex disjoint) trees , where for each , is the -Grundy tree, and is rooted at . Let , and consider a vertex , where . We will argue that for each , . Note that there must exists and such that and , and we arbitrarily choose one such and . Let . From Observation 18, is a -Grundy witness for . Thus, from our induction hypothesis, is a Grundy coloring for . From the above we can conclude that for each , . Now consider the vertex and any . Note that and from item 3 of Definition 17, we can obtain that . From the above discussions, we can obtain that is Grundy coloring of using at least colors. This concludes the proof.
Lemma 21.
For any and a graph , if has a Grundy coloring with at least colors, then has a -Grundy witness.
Proof.
Consider a Grundy coloring of with colors, and for each , let . We construct a Grundy witness by processing labels of starting at and iteratively proceeding to smaller labels as follows while maintaining the below invariants.
Pre-condition: When we begin processing a label , for each with , we have fixed the vertex .
Post-condition: After processing label , we have fixed, for each with , and , the vertex ; and these are the only vertices in for which the vertex in assigned by is determined.
Note that the pre-condition is vacuously satisfied for . Recall that is the tree obtained by adding a root vertex attached to the roots of (pairwise vertex disjoint) trees , respectively, where for each , is a -Grundy tree. Pick any vertex , and set and for each , set , where is an arbitrarily chosen neighbor of from (which exists as is a Grundy coloring). After the above step, the post-condition is satisfied for .
Now we (iteratively, in decreasing order) consider . From the pre-condition for , we have fixed, for each with , the vertex . Consider with and let . Let be the subtree of rooted at , and let . Notice that is a -Grundy tree, where is the tree obtained from by adding edge between and the roots of , respectively, where is a -Grundy tree, for each . For each , let be an arbitrarily chosen vertex from , and we set . Notice that after the above step, the post-condition is satisfied for , and the pre-condition is satisfied for .
After we are done processing each , the post-condition for (and the pre-condition of implies that for each , we have determined the vertex ). Moreover, the construction of implies that all the three conditions in Definition 17 are satisfied. This concludes the proof.
We next summarize the result we obtain from the above two lemmas.
Lemma 22.
Consider any and a graph . The graph has a -Grundy witness if and only if has a Grundy coloring with at least colors.
Color Coding of .
We will next use the above lemma to simplify our job in the following sense. Let be a (fixed) -Grundy witness of (if it exists), where is a -Grundy tree. Let , and for each , let . Roughly speaking, our new objective will be to find the vertices in and say that admits a Grundy coloring with at least colors, using which we can conclude that admits a Grundy coloring with at least colors. We will use the technique of color coding introduced by Alon et al. [2], to color the vertices in “nicely” as follows. Color each vertex in uniformly at random using a color from , and let be this coloring. A nice coloring is the one where, for each , the coloring assigns the color to all the vertices in .
We will work with the assumption that is a nice coloring of , and for each , let . Our objective will be to look for a -Grundy witness , where is a -Grundy tree, such that for each and with , we have . To this end, we will store a “Grundy representative family” for each vertex in a bottom-up fashion, starting from . The definition of such a representative is inspired by the -representative families [30, 19], although here we need a “vectorial” form of representation. To this end, we introduce the following notations and definitions.
Grundy Representative Sets.
Recall we have the coloring of with color classes , for . A vertex subset is -independent if for each , is an independent set in . For , a family of vertex subsets is a -family if each set in has size at most and each if -independent. We will only be working with vectors all of whose entries are from without explicitly stating it. For a vector , denotes the number . For a vector and , we say that the size of is , written as , if for each , . For vertex subsets and , fits if is -independent. For two vectors and , and , we write if for each , we have . We next define the notion of -Grundy representation.
Definition 23.
Consider , a vector , and a -family of vertex subsets of . For a sub-family , we say that -Grundy represents , written as , if the following holds. For any set of size , if there is that fits , then there is that fits . In the above, is a -Grundy representative for .
Next, we obtain some properties regarding -Grundy representatives.
Observation 24 ().
Consider , a vector , and any two -families and . If and , then .
Consider and . For a family over , denotes the family . Similarly, denotes the family . A -family is a -family if for each , we have .
Observation 25 ().
Consider , a vector , a vertex and a -family . Let be the vector obtained from by increasing its th coordinate by . If and , then .
For a -family and a -family , we define a -family, . The following lemma will be helpful in obtaining a -representative for .
Lemma 26.
Consider a -family , a -family , and a vector , where . Let be a -family such that for every vector with , . Similarly, consider a -family such that for every vector with , . Then, .
Proof.
Consider any of size for which there is , such that fits . As , there must exist sets , , such that .
Let . Note that , fits and . By the premise of the lemma, there exist such that fits , as . The above implies that fits , where . Let , and note that , fits and . Again, as , there exists such that fits . The above discussions imply that, , , and thus , where fits . This concludes the proof.
Recall that is a -free graph, where . Consider any computable function . Let ; where we skip the subscript when the context is clear. Also, for , let ; again we skip the subscript , when the context is clear. We next state the main lemma, which lies at the crux of our algorithm.
Lemma 27 ().
Consider any computable function . There is an algorithm that takes as input , , a vector , and a -family of vertex subsets of a -free graph on vertices with a coloring , where . In time bounded by we can find with at most sets such that .
Some Useful Notations.
For and , let be the number of vertices with label in the -Grundy tree , i.e., .
Let . We will define a vector , for every . Intuitively speaking, the th entry of will denote the number of vertices with label appearing in after removing exactly one subtree rooted at a vertex with label . Formally, for each , we have , and for each , . For , we let be the vector of dimension where the th entry is , and all the other entries are .
For a tree rooted at and , we let be the subtree of rooted at , i.e., and .
For a set , we say that is a -Grundy set if there is a -Grundy witness for . Moreover, is minimal if no proper subset is a -Grundy set for . For a -Grundy set and a -Grundy witness for , for , we let and .
Recall that we have a graph and a coloring , where for , we have . For and , we define .
Description of the Algorithm.
The objective of our algorithm will be to compute, for each and , a family ; starting from (and then iteratively, for other values of in increasing order), satisfying the following constraints:
- Size Constraint.
-
.
- Correctness Constraint.
-
For any and , the following holds:
-
1.
Each is a -Grundy set in .
-
2.
Consider any minimal -Grundy set , such that (if it exists). Furthermore, let be a -Grundy witness for . For any with , where , there is such that is a -Grundy set in , i.e., .
-
1.
Base Case.
We are in our base case when ; note that . For each , set . Note that satisfies both the size and the correctness constraints.
Recursive Formula.
Consider and . We suppose that for each and , we have computed that satisfies both the size and the correctness constraints.
For each , we create a family , initialized to as follows. For each and , if is -independent and , then add to . Note that , where . Using Lemma 27, for each vector , we compute , where , and set . Note that and we can compute it in time bounded by .
Next we will iteratively “combine and reduce” the families , for , to obtain a family as follows. We set . Iteratively, (in increasing order), for each , we do the following:
-
1.
Set .
-
2.
Compute , for each , and set . Note that and it can be computed in time bounded by .
We add each to , which is a -Grundy set in (note that since the size of each set is bounded by , we can easily do it in the allowed amount of time). In the following lemma, we show that satisfies the correctness constraints.
Lemma 28.
satisfies the correctness constraint.
Proof.
Consider any and a minimal -Grundy set , such that (if it exists) and let be a -Grundy witness for . Next consider any with . We will argue that, there is such that is a -Grundy set in . For each , let be the child of in with and . Note that for each , . For each , let , and note that . Now we iteratively take the union of the above sets as follows. For each , let . Now for each , we construct a subset, of that contains , for each that does not belong to the subtrees rooted at any of the vertices . Formally, for , let . Furthermore, let be the size of . Notice that for each , all of the following holds:
-
1.
,
-
2.
,
-
3.
and ,
-
4.
, and thus, fits .
We will now iteratively define sets and functions , and we will ensure that, for each , we have: i) is a -Grundy witness for , ii) for each and , we have , iii) , and iv) for each , there is a minimal -Grundy set , where the unique vertex in is a neighbor of .
Recall that and . Also, we have , for some , and is a -Grundy set. Thus, there must exist such that is -independent. Moreover by the construction of , , for some . Let be the function such that for each , we have and . As is -independent and , we can obtain that is a -Grundy witness for . Note that if , then by the above arguments, we have constructed the desired sets and functions, which is just the set and the function .
We now consider the case when . Also, we assume that for some , for each , we have constructed and satisfying the desired condition. Now we prove the statement for . Note that is a -Grundy set and is a -Grundy witness for , where . Note that . Let . Note that and fits , and recall that . As , for every , there must exists , such that fits . By the construction of , we have and is -independent, and also . From the above discussions we can conclude that . Moreover, as , and is -independent, we can obtain that . As , for every and , there must exists such that is -independent.
As , there must exist and , such that . By the correctness for , contains for each , a minimal -Grundy set , where the unique vertex in is a neighbor of . Also by the construction of , contains a minimal -Grundy set in , where the unique vertex in is a neighbor of . From the above discussions, we can conclude that is a -Grundy set in .
Using the above algorithm, we can compute for each and , a family that satisfies the correctness and the size constraints, in time bounded by . Note that has a Grundy coloring using at least colors if and only if for some , . This implies a proof of Theorem 3.
References
- [1] Pierre Aboulker, Édouard Bonnet, Eun Jung Kim, and Florian Sikora. Grundy coloring and friends, half-graphs, bicliques. Algorithmica, pages 1–28, 2022. doi:10.1007/S00453-022-01001-2.
- [2] Noga Alon, Raphael Yuster, and Uri Zwick. Color-coding. J. ACM, 42(4):844–856, 1995. doi:10.1145/210332.210337.
- [3] Júlio César Silva Araújo and Cláudia Linhares Sales. Grundy number on p-classes. Electron. Notes Discret. Math., 35:21–27, 2009. doi:10.1016/J.ENDM.2009.11.005.
- [4] R. Balakrishnan and T Kavaskar. Interpolation theorem for partial grundy coloring. Discrete Mathematics, 313(8):949–950, 2013. doi:10.1016/J.DISC.2013.01.018.
- [5] Rangaswami Balakrishnan and T. Kavaskar. Color chain of a graph. Graphs Comb., 27(4):487–493, 2011. doi:10.1007/S00373-010-0989-7.
- [6] Rémy Belmonte, Eun Jung Kim, Michael Lampis, Valia Mitsou, and Yota Otachi. Grundy distinguishes treewidth from pathwidth. In 28th Annual European Symposium on Algorithms (ESA 2020). Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2020.
- [7] Édouard Bonnet, Florent Foucaud, Eun Jung Kim, and Florian Sikora. Complexity of grundy coloring and its variants. Discret. Appl. Math., 243:99–114, 2018. doi:10.1016/J.DAM.2017.12.022.
- [8] Gregory J. Chaitin, Marc A. Auslander, Ashok K. Chandra, John Cocke, Martin E. Hopkins, and Peter W. Markstein. Register allocation via coloring. Comput. Lang., 6(1):47–57, 1981. doi:10.1016/0096-0551(81)90048-5.
- [9] CWK Chen and David YY Yun. Unifying graph-matching problem with a practical solution. In Proceedings of International Conference on Systems, Signals, Control, Computers, volume 55, 1998.
- [10] C. A. Christen and S. M. Selkow. Some perfect coloring properties of graphs. Journal of Combinatorial Theory, Series B, 27(1):49–59, 1979. doi:10.1016/0095-8956(79)90067-4.
- [11] Marek Cygan, Fedor V Fomin, Łukasz Kowalik, Daniel Lokshtanov, Dániel Marx, Marcin Pilipczuk, Michał Pilipczuk, and Saket Saurabh. Parameterized algorithms, volume 5. Springer, 2015. doi:10.1007/978-3-319-21275-3.
- [12] Lyes Dekar, Brice Effantin, and Hamamache Kheddouci. An incremental distributed algorithm for a partial grundy coloring of graphs. In Ivan Stojmenovic, Ruppa K. Thulasiram, Laurence Tianruo Yang, Weijia Jia, Minyi Guo, and Rodrigo Fernandes de Mello, editors, Parallel and Distributed Processing and Applications, 5th International Symposium, ISPA 2007, Niagara Falls, Canada, August 29-31, 2007, Proceedings, volume 4742 of Lecture Notes in Computer Science, pages 170–181. Springer, 2007. doi:10.1007/978-3-540-74742-0_18.
- [13] Reinhard Diestel. Graph theory, volume 173. Springer-Verlag Heidelberg, 2017.
- [14] Irit Dinur, Elchanan Mossel, and Oded Regev. Conditional hardness for approximate coloring. SIAM J. Comput., 39(3):843–873, 2009. doi:10.1137/07068062X.
- [15] B. Effantin, N. Gastineau, and O. Togni. A characterization of b-chromatic and partial grundy numbers by induced subgraphs. Discrete Mathematics, 339(8):2157–2167, 2016. doi:10.1016/J.DISC.2016.03.011.
- [16] P. Erdös, S. T. Hedetniemi, R. C. Laskar, and G. C. E. Prins. On the equality of the partial grundy and upper ochromatic numbers of graphs. Discrete Mathematics, 272(1):53–64, 2003. doi:10.1016/S0012-365X(03)00184-5.
- [17] P Fahad. Dynamic Programming using Representative Families. PhD thesis, Homi Bhabha National Institute, 2015.
- [18] Uriel Feige and Joe Kilian. Zero knowledge and the chromatic number. J. Comput. Syst. Sci., 57(2):187–199, 1998. doi:10.1006/JCSS.1998.1587.
- [19] Fedor V. Fomin, Daniel Lokshtanov, Fahad Panolan, and Saket Saurabh. Efficient computation of representative families with applications in parameterized and exact algorithms. J. ACM, 63(4):29:1–29:60, 2016. doi:10.1145/2886094.
- [20] N. Goyal and S. Vishwanathan. Np-completeness of undirected grundy numbering and related problems. Unpublished manuscript, 1997.
- [21] P. M. Grundy. Mathematics and games. Eureka, 2:6–9, 1939.
- [22] András Gyárfás, Zoltán Király, and Jenö Lehel. On-line 3-chromatic graphs i. triangle-free graphs. SIAM J. Discret. Math., 12(3):385–411, 1999. doi:10.1137/S089548019631030X.
- [23] F. Havet and L. Sampaio. On the grundy and b-chromatic numbers of a graph. Algorithmica, 65(4):885–899, 2013. doi:10.1007/S00453-011-9604-4.
- [24] S. M. Hedetniemi, S. T. Hedetniemi, and T. Beyer. A linear algorithm for the grundy (coloring) number of a tree. Congressus Numerantium, 36:351–363, 1982.
- [25] Allen Ibiapina and Ana Silva. b-continuity and partial grundy coloring of graphs with large girth. Discrete Mathematics, 343(8):111920, 2020. doi:10.1016/J.DISC.2020.111920.
- [26] Hal A. Kierstead and Karin Rebecca Saoub. First-fit coloring of bounded tolerance graphs. Discret. Appl. Math., 159(7):605–611, 2011. doi:10.1016/J.DAM.2010.05.002.
- [27] Guy Kortsarz. A lower bound for approximating the grundy number. Discrete Mathematics & Theoretical Computer Science, 9, 2007.
- [28] Daniel Lokshtanov, Fahad Panolan, Saket Saurabh, Roohani Sharma, and Meirav Zehavi. Covering small independent sets and separators with applications to parameterized algorithms. ACM Transactions on Algorithms (TALG), 16(3):1–31, 2020. doi:10.1145/3379698.
- [29] Dániel Marx. Graph colouring problems and their applications in scheduling. Periodica Polytechnica Electrical Engineering (Archives), 48(1-2):11–16, 2004.
- [30] Dániel Marx. A parameterized view on matroid optimization problems. Theor. Comput. Sci., 410(44):4471–4479, 2009. doi:10.1016/J.TCS.2009.07.027.
- [31] Moni Naor, Leonard J Schulman, and Aravind Srinivasan. Splitters and near-optimal derandomization. In Proceedings of IEEE 36th Annual Foundations of Computer Science, pages 182–191. IEEE, 1995. doi:10.1109/SFCS.1995.492475.
- [32] B. S. Panda and Shaily Verma. On partial grundy coloring of bipartite graphs and chordal graphs. Discret. Appl. Math., 271:171–183, 2019. doi:10.1016/J.DAM.2019.08.005.
- [33] L. Sampaio. Algorithmic aspects of graph colourings heuristics. PhD thesis, University Nice Sophia Antipolis, 2012.
- [34] Z. Shi, W. Goddard, S. T. Hedetniemi, K. Kennedy, R. Laskar, and A. McRae. An algorithm for partial grundy number on trees. Discrete Mathematics, 304(1-3):108–116, 2005. doi:10.1016/J.DISC.2005.09.008.
- [35] Zixing Tang, Baoyindureng Wu, Lin Hu, and Manouchehr Zaker. More bounds for the grundy number of graphs. J. Comb. Optim., 33(2):580–589, 2017. doi:10.1007/S10878-015-9981-8.
- [36] Shaily Verma and B. S. Panda. Grundy coloring in some subclasses of bipartite graphs and their complements. Information Processing Letters, 163:105999, 2020. doi:10.1016/J.IPL.2020.105999.
- [37] M. Zaker. Grundy chromatic number of the complement of bipartite graphs. Australasian Journal of Combinatorics, 31:325–330, 2005. URL: http://ajc.maths.uq.edu.au/pdf/31/ajc_v31_p325.pdf.
- [38] M. Zaker. Results on the grundy chromatic number of graphs. Discrete mathematics, 306(23):3166–3173, 2006. doi:10.1016/J.DISC.2005.06.044.
- [39] Manouchehr Zaker. Inequalities for the grundy chromatic number of graphs. Discret. Appl. Math., 155(18):2567–2572, 2007. doi:10.1016/J.DAM.2007.07.002.