On the Tractability of Coloring^{1}^{1}1This paper is the full version of the article “On the Tractability of Coloring”caldam2018 (), published in the CALDAM 2018 conference, with the same set of authors.
Abstract
In an undirected graph, a proper coloring is an assignment of a set of colors to each vertex such that any two adjacent vertices have at most common colors. The coloring problem is to compute the minimum number of colors required for a proper coloring. This is a generalization of the classic graph coloring problem.
We show a parameterized algorithm for the coloring problem with the size of the feedback vertex set as a parameter. Our algorithm does not use treewidth machinery, thus answering a question of Majumdar, Neogi, Raman and Tale [CALDAM 2017]. We also give a faster and simpler exact algorithm for coloring. From the hardness perspective, we show that the coloring problem is NPcomplete for any fixed values , whenever , thereby settling a conjecture of MéndezDíaz and Zabala [1999] and again asked by Majumdar, Neogi, Raman and Tale. The NPcompleteness result improves the partial NPcompleteness shown in the preliminary version of this paper published in CALDAM 2018.
definition[theorem]Definition \newproofproofProof
1 Introduction
In an undirected graph , , a proper vertex coloring is to color the vertices of the graph such that adjacent vertices get different colors. The classic graph coloring problem asks to compute the minimum number of colors required to properly color the graph. The minimum number of colors required is called the chromatic number of the graph, denoted by . This is a well known NPhard problem and has been studied in multiple directions.
Many variants and generalizations of the graph coloring problem have been studied in the past. In this paper we address a generalization of the graph coloring problem called coloring problem. For a proper coloring, we need to assign a set of colors to each vertex such that the adjacent vertices share at most colors. The coloring problem asks to compute the minimum number of colors required to properly color the graph. The minimum number of colors required is called the chromatic number, denoted by . Note that coloring is the same as the classic graph coloring problem.
We also define below the coloring problem, the decision version of the coloring problem.
Coloring Problem
Instance: An undirected graph .
Question: Does have a proper coloring using at most colors?
The coloring problem was first studied by MéndezDíaz and Zabala in IMDiaz1999 (). For arbitrary and , the coloring problem is NPhard because coloring is NPhard. Apart from studying the basic properties, they also gave an integer linear programming formulation of the problem. Stahl stahl1976 () and independently Bollobás and Thomason Bollobas1979 () introduced the coloring problem under the names of tuple coloring and set coloring respectively. The tuple coloring problem has been studied in detail klostermeyer2002 (); sparl2007 (), and Irving Irving1983 () showed that this problem is NPhard as well. Some of the applications for the coloring problem include construction of pseudorandom number generators, randomness extractors, secure password management schemes, aircraft scheduling, biprocessor tasks and frequency assignment to radio stations marx2004 (); calvin2014 (). Brigham and Dutton brigham1982 () studied another variant of the problem, where colors have to be assigned to each vertex such that the adjacent vertices share exactly colors.
Bonomo, Durán, Koch and ValenciaPabon Bonomo2014 () studied the connection between the coloring problem on cliques and the theory of error correcting codes. In coding theory, a constant weight code represents a set of codewords of length with exactly ones in each codeword, with Hamming distance at least . They observed a direct connection between , the largest possible size of a constant weight code, and the colorability of cliques and used the existing results from coding theory (such as the Johnson bound johnson1962 ()) to infer results on the colorability of cliques. Finding bounds on is a wellstudied problem in coding theory, and lots of questions on are still open. This indicates the difficulty of the coloring problem even on graphs as simple as cliques.
Since the coloring problem is NPhard in general, it is natural to study the tractability for special classes of graphs. Polynomial time algorithms are only known for a few of such classes namely bipartite graphs, cycles, cacti and graphs with bounded vertex cover or treewidth Bonomo2014 (); Diptapriyo2017 (). From the NPhardness perspective, it is interesting to ask if the coloring problem is NPhard for specific values of . Except for the cases , where the problem is trivial, and , where the problem is NPhard Irving1983 (), the NPhardness remains open for all other values of .
Recently, Majumdar, Neogi, Raman and Tale Diptapriyo2017 () studied the coloring problem and gave exact and parameterized algorithms for the problem. They showed that the problem is fixed parameter tractable (FPT) when parameterized by treewidth. As the treewidth is at most , where is a feedback vertex set (FVS) of the graph, their algorithm also implies that coloring is FPT when parameterized by the size of FVS. As an open question, they asked to devise an FPT algorithm parameterized by the size of FVS, without going through treewidth.
Our results are:

An time algorithm for the coloring problem that does not use treewidth machinery, Here is an FVS of the graph. This implies an FPT algorithm for the coloring problem parameterized by the size of FVS, and thus answers the question posed in Diptapriyo2017 ().

We show that the coloring problem is NPcomplete for any fixed values whenever . This answers questions posed in IMDiaz1999 () and Diptapriyo2017 () and settles the complexity of the coloring problem for all values of and . This result also improves the partial NPcompleteness shown in the preliminary version caldam2018 () of this paper.

We give a time exact algorithm for the coloring problem. This is a direct improvement to the algorithm given in Diptapriyo2017 () for the same problem.
2 Preliminaries
A parameterized problem is a language where is a fixed, finite alphabet. For example , here is called the parameter. A parameterized problem is called fixedparameter tractable (FPT) if there is an algorithm , a computable function , and a constant such that, given , the algorithm correctly decides whether in time bounded by .
We assume that the graph is simple and undirected. We use to denote , the number of vertices of the graph. We say that the vertices and are adjacent (neighbors) if . For , we let denote the set of neighbors of . For , the sub graph induced by is denoted by . We use to denote . We use the set of natural numbers for coloring the graph. We use the standard notations and to denote the set of all sized subsets of . In the rest of the paper, we use the term coloring of a set to denote a mapping . We say that is a proper coloring (or proper coloring) of if any pair of adjacent vertices in have no more than colors in common.
3 Coloring Parameterized by Size of FVS
In this section, we assume that are fixed values and focus on the decision problem of coloring. A Feedback Vertex Set (FVS) is a set of vertices , removal of which from the graph makes the remaining graph () acyclic. Many NPhard problems have been shown to be tractable for graphs with bounded FVS kratsch2010 ().
In Diptapriyo2017 (), Majumdar, Neogi, Raman and Tale gave an time^{2}^{2}2Even though Diptapriyo2017 () claims a running time of for their algorithm, there is an additional factor of that is omitted, presumably because is treated as a constant. algorithm for the coloring problem, where denotes the treewidth of the graph. Let be a smallest FVS of . It is known that , see for instance jansen2014 (). In this section, we present an algorithm for coloring that runs in time, where is the size of the FVS of the graph. Our algorithm does not use the treewidth machinery. Note that, FVS has a approximation algorithm fvsapprox (), but there is no known polynomial time algorithm that approximates treewidth within a constant factor inapproxtw (). Computing the size of the smallest FVS is also known to be FPT parameterized by , the size of the smallest FVS. There has been a series of results improving the running time, the fastest known algorithm fastfvs () runs in time.
A brief description of our algorithm follows. Let be an FVS of . We start with a coloring of the vertices of . Recall that is a forest. Each of the connected components of is a tree. For each of these components, we traverse the tree bottomup and use a dynamic programming technique to compute the list of colorings that each vertex can take. For each , we include in ’s list if there is a coloring for the subtree rooted at , consistent with the coloring of , such that receives color set . We repeat this for all proper colorings of .
Let denote the family of all sized subsets of . For any pair of sets , we say that is legal if , and illegal if . Given two sets , it is easy to check if is a legal pair. Formally, we have:
Proposition 1
Given , it takes time to check if is a legal pair.
Consider a partial coloring where only the vertices of the FVS are colored. For a vertex and a set , we say that is compatible if for all , the pair is legal.
The set is defined to be the set of compatible colorings of .
Proposition 2
Let be a coloring of the vertices in . Let and . Then the set of compatible colorings of can be computed in time .
For each , we check if is compatible. For this, we need to check for all neighbors of in , whether is legal. The total running time is . ∎
Given a graph and a coloring for some , we say that the coloring is an extension of , or extends if for all , we have .
Lemma 3
Given a proper coloring of the vertices in a feedback vertex set of the graph , we can determine if can be extended to a proper coloring of in time.
The graph is a forest because is a feedback vertex set. Therefore each connected component of is a tree. Below, we describe an algorithm that we can apply to each of these trees to yield a proper coloring extending for the trees. Combining the colorings, we get a proper coloring of , that is an extension of .
Let denote one of the trees in the forest. We will designate any one of the vertices (say ) of as root. Let denote the subtree rooted at a node .
Our plan is to maintain a table at each vertex , indexed with the elements of . The entry at each color set is denoted by . The entry indicates whether there is a proper coloring of , with assigned the set , consistent with the coloring of .
We will process in a post order fashion as follows:

When is a leaf in : In this case, we set if is compatible. Otherwise, we set .
For any leaf , the values corresponding to all can be computed in time by Proposition 2. Here denotes the number of neighbors of in .

When is an internal node in : Let be the children of in . Recall that we process in post order fashion. Before we process , the values for all the children of would already have been computed. The value is computed as follows:

If is not compatible, we set .

If is compatible, we do the following:

If for each child of , there exists at least one coloring such that and is a legal pair, then set .

Otherwise set .

For each and , the compatibility check takes time. If is compatible, we need to check all the children , and the table entries for all . Together with the check for being a legal pair, the computation takes time, where is the number of children of in the tree .
Adding all up, the computation of the table entries for takes time
(1) 
If for some , , then we know that there exists a proper coloring of that is consistent with the coloring of .
The time complexity is obtained by adding the expression in (1) over all the vertices . By using the bounds and , we get that the time complexity is upper bounded by
which is at most , by noting that is a constant. ∎ The correctness of the procedure explained in the above lemma can be proved using an induction on the vertices of according to its post order traversal. The inductive claim says that if and only if there is a proper coloring of , with assigned the set , consistent with the given coloring of .
Lemma 4
Given a proper coloring of the vertices in a feedback vertex set of the graph , we can determine if can be extended to a proper coloring of with space complexity .
Recall the algorithm explained in Lemma 3. At each vertex in , we need space to store values for all . ∎
Theorem 5
The coloring problem can be solved in time and space, where is a feedback vertex set of .
For each coloring assignment of , we first determine if is a proper coloring. This can be done in time. Then we determine whether there exists a proper coloring that extends in time by Lemma 3. Since there are at most many colorings of , we can determine whether there exists a proper coloring of in time.
We need space to store the coloring of . And by Lemma 4, we need space to determine if can be extended to a proper coloring of . The latter is the dominating term and determines the total space requirement of the algorithm. ∎
On generating a proper coloring. We observe that we can modify Theorem 5 to obtain an algorithm that generates a proper coloring of , if one exists. After executing the steps of the algorithm corresponding to Theorem 5, we traverse the tree in topdown fashion from the root, and find colorings for each vertex , consistent with its parent, subtree and coloring of . The latter two are already encoded in value. The asymptotic time and space complexity are the same as that in Theorem 5.
We would like to observe a difference in the space usage of our FPT algorithm to the FPT algorithm for coloring parameterized by treewidth in Diptapriyo2017 (). We note that the algorithm in Diptapriyo2017 () can also be modified similarly to obtain an algorithm that generates a proper coloring. However, such an algorithm would require to store all feasible colorings at each bag of the treedecomposition, resulting in a space usage at each bag. Since there are bags, total space required by the algorithm is , which is significantly larger than the space required by our algorithm.
Decision vs. search problem. We now note that . In the RHS, the first term trivially, and the second term since is a forest. Thus we have .
We note that we could run the algorithm for coloring and perform binary search between 1 and and determine , the smallest for which the graph has a proper coloring. The running time of this procedure would be at most times the running time of the algorithm presented in Theorem 5, that is .
Thus the FPT algorithm parameterized by the size of the FVS for the coloring problem implies an FPT algorithm parameterized by the size of the FVS for the coloring problem as well.
3.1 Counting all proper colorings
Here we show that we can modify the algorithm described in Lemma 3 to count the number of proper colorings of . Let a proper coloring of FVS be given. Instead of maintaining for a vertex in a rooted tree , we maintain another value .
At each vertex , maintains a count of the proper colorings of , consistent with the coloring of , where gets assigned the set . The correctness can be verified by a straightforward induction on the tree vertices in post order traversal. If is the root of , gives the count of proper colorings of , where is colored , consistent with the coloring of .
The total number of proper colorings of is therefore computed by taking into account (i) all proper colorings of , (ii) all the trees in , and (iii) all color sets at the root of . The full expression is as follows:
The above expression implies the following theorem. The asymptotic time complexity remains the same as Theorem 5, whereas the space complexity incurs a blowup of , because of the maximum value can take.
Theorem 6
There is an algorithm that computes the number of proper colorings of , in time and space, where is a feedback vertex set of .
4 Faster Exact Algorithm for coloring
The article Diptapriyo2017 () gave an time exact algorithm for the coloring problem. Their algorithm was based on running an exact algorithm for a set cover instance where the universe is the set of all the vertices and the family of sets is the set of all independent sets of vertices of . To show correctness and running time, they used a claim (unnumbered) that relates to the size of solution of the set cover instance, an time exact algorithm for the set cover problem Fomin2010 () and an upper bound of on the size of the family of sets . Hence, the time complexity of their algorithm is .
We first note that their algorithm also works when is replaced by , the set of all maximal independent sets of . This is because any independent set is contained in a maximal independent set . In any set covering of using elements of , each set can be replaced by an , thus obtaining a set cover of using elements of only . By using the upper bound of Moon and Moser moonmoser () on the number of maximal independent sets, the time complexity improves to .
We now present a simpler and faster algorithm to determine .
Lemma 7
For any graph , where is the smallest integer such that . Thus there is a polynomial time reduction from the coloring problem to the coloring problem.
The coloring problem asks to assign sets of colors to each vertex, with the requirement that neighboring vertices must have distinct sets assigned to them. We may view each of the sized subsets as a color, and the chromatic number is the number of distinct sized subsets required.
Thus is the smallest that will provide number of sized subsets. The polynomial time reduction is immediate. ∎
Combining the above lemma with the time algorithm of Koivisto Koivisto () to compute , we get the following theorem.
Theorem 8
There is an algorithm with time complexity that computes the chromatic number of a given graph.
Further, we can infer from Lemma 7 that for those graphs where we can compute (G) in polynomial time, () can also be found in polynomial time. For instance, can be computed in polynomial time as = .
5 NPcompleteness results
Since the coloring problem is a generalization of the coloring problem, it follows that coloring is NPhard in general. Notice that we have for all graphs . Thus the coloring problem is trivial. MéndezDíaz and Zabala IMDiaz1999 () conjectured that the coloring problem is NPhard whenever . In this section, we prove their conjecture by showing that the coloring problem is NPcomplete for all values of and , as long as . Given a coloring, we can easily verify that it is a proper coloring in polynomial time. Therefore, we will only be proving the NPhardness aspect of NPcompleteness.
5.1 Simple proofs for coloring and coloring
In this section, we provide simple proofs for the NPcompleteness of coloring and coloring. For the coloring problem, we have the following result by Irving.
Theorem 9 (coloring is NPcomplete Irving1983 ())
The coloring problem is NPcomplete for all .
The NPcompleteness of the coloring problem is claimed by IMDiaz1999 (). However, we are unable to follow and verify the proof. We provide an alternate NPhardness proof as a consequence of the correspondence in Lemma 7.
Theorem 10
The coloring problem is NPcomplete for all .
We use reductions from the coloring problem, for each value of . We show that the coloring problem is NPcomplete for all values of . From the correspondence in Lemma 7, it follows that for any given , a graph is colorable if and only if is colorable. Since the coloring problems are NPcomplete for all , it follows that coloring problems are NPcomplete for all , and hence we get that the coloring problems are NPcomplete for all . ∎
The following lemmas will help us in proving further NPcompleteness results.
Lemma 11 (Complement trick)
For integers , any graph is colorable if and only if it is colorable.
Let be a coloring of . Consider the coloring where each vertex is assigned the complement set . Notice that, every vertex is assigned colors, and any pair of adjacent vertices will share exactly colors in the coloring . Thus we have a coloring of .
Similarly, if we start from a coloring of , we can get to a coloring by taking the complement coloring. ∎
Theorem 9 and the above lemma together imply the NPcompleteness of coloring for all .
Theorem 12 (coloring is NPcomplete)
The coloring problem is NPcomplete for all .
5.2 NP completeness of coloring
In this section, we prove the NPcompleteness of coloring. The result is stated below:
Theorem 13 (coloring is NPcomplete)
The coloring problem is NPcomplete when . That is, for any fixed values such that , there exists a such that the coloring problem is NPcomplete.
The main ingredient of the above NPcompleteness result is the following theorem, which generalizes Theorem 9 (originally proved in Irving1983 ()).
Theorem 14
The coloring problem is NPcomplete for all .
Most of the remaining part of the section will be used to prove Theorem 14. We first show how to infer Theorem 13 from Theorem 14.
[Proof of Theorem 13] Let be such that . We will show that coloring is NPcomplete. Theorem 14 shows the NPcompleteness of coloring when .
To show the NPcompleteness of coloring when , let . Notice that . By Theorem 14, we have that coloring is NPcomplete. By Lemma 11 (complement trick), a graph is colorable if and only if it is colorable. Hence the coloring problem is NPcomplete as well. Substituting , we get that the coloring problem is NPcomplete. ∎
Now we shall start working towards proving Theorem 14. The Kneser graph forms an important component of the proof. {definition}[Kneser Graph] The Kneser graph is the graph whose vertices are , the sized subsets of , and vertices and are adjacent if and only if (when and are viewed as sets). Consider the Kneser graph . We may view the elements of the set as colors. In this case, the sets associated with the vertices themselves form a proper coloring of . We will call this coloring as the natural coloring, denoted by . This is because two vertices are adjacent if and only if they do not share any colors.
The following theorem states that when , the natural coloring is essentially the only proper coloring of the Kneser graph that uses colors.
Theorem 15
Let and . Any coloring of can be obtained from a natural coloring by a permutation of colors.
Before proving the above theorem, we state two known results that would be necessary in the proof.
Theorem 16 (ErdősKoRado Theorem ekr ())
Let . The largest independent set of the Kneser graph is of size .
Theorem 17 (Hilton and Milner hm ())
Let . Every independent set of the Kneser graph of size are the set of vertices that contain some color in their natural coloring.
We first require the following lemma.
Lemma 18
Let and . Any coloring of requires at least colors. If is a coloring of , then each color in must occur exactly times.
Let be the natural coloring and be an arbitrary coloring of . Each color occurs exactly times in . Below, we argue that this must happen in as well.
All the vertices containing a specific color form an independent set. If any color in occurs more than times, then we will have a contradiction to Theorem 16. Now notice that the total number of “color slots” is fixed at . Hence each color must occur times on average. If any color in occurs strictly less than times, then some other color has to occur more than times in order to compensate. Hence each color in must occur exactly times.
Similarly, a coloring of using less than colors also implies an independent set larger than , contradicting Theorem 16. ∎
Now we prove Theorem 15.
[Proof of Theorem 15] Let , and . WLOG let the colors used in be from the set . We will show that there is a permutation function such that every vertex with , has natural coloring .
By Lemma 18, each color in must occur exactly times in . For any color , the vertices with color in form an independent set of size . Now Theorem 17 states that every independent set of size is the set of vertices that contain some color in their natural coloring. Setting , we get the desired mapping between the colors in and .
To complete the proof, we need to show that the mapping is a permutation. Since both domain and codomain of is , it is enough to show that is injective. Assume for the sake of contradiction that there are two colors such that . Let be the set of vertices in that contain the color in the natural coloring . By our argument, note that is also the set of vertices in that contain the color in (and also the vertices that contain the color in ).
Remove the set of vertices from . What remains is a copy of the Kneser graph , which is colored by using colors. Since , by Lemma 18, the graph cannot be colored by colors. This contradicts the assumption that there are colors such that . Hence is injective and a permutation, completing the proof. ∎
We conclude this section with one more definition, that of a totally independent 3set in a Kneser graph. {definition}[Totally Independent 3Set] Consider the Kneser graph with . Any set of three vertices of form a totally independent 3set if they all share the set of same colors in their natural coloring, and differ only in the last color. Because of Theorem 15, notice that the above definition remains unchanged if we use any coloring instead of the natural coloring.
5.3 Proof of Theorem 14
In this section, we prove Theorem 14 which states that the coloring problem is NPcomplete for all .
As before, it is easy to see that the problem is in NP and we shall focus on showing that the problem is NPhard. We will show that there is a polynomial time reduction from 3CNFSAT to coloring. Given a 3CNF Boolean formula , we will construct a graph in polynomial time such that is colorable if and only if is satisfiable. The formula is a conjunction of clauses, with each clause consisting of exactly 3 literals. For a fixed value of and , we now describe the construction of the graph from .
Construction of from : Let be a 3CNF formula with variables and clauses. We first describe the vertices of the graph .

Two vertices and .

A set of vertices denoted as follows:

For each variable in , a set of vertices. Each set is defined as follows:

For each clause in , a set of three vertices denoted by and .

For each clause in , a set of vertices denoted by defined as follows:
Thus the total number of vertices in is . For fixed values of and , the number of vertices in is polynomial in the size of the formula .
Now we describe the edges of . While describing the edges, we use the shorthand notation for the edge .

For each , the vertices form a copy of the Kneser graph . When the vertices of are regarded as the sized subsets of , the vertices in correspond to the sized subsets of and sized subsets of union with . That is, vertices in correspond to the sized subsets of that either contain both and , or contain none of and .
The vertices and correspond to the sets and in some order. The vertices in correspond to the other sized subsets of , that contain either or but not both.

Let be the vertices such that represents the set and represents the set . Then , and are edges.

Let defined as follows^{3}^{3}3 We remark that when , the sets and are empty sets. However, the correctness of proof is maintained even in this case.. The set represents those set of vertices which have the set with the th element from while represents those set of vertices which have the set with the th element from . Note that .
Now join to all the vertices in using edges, and similarly join to all the vertices in . ^{4}^{4}4We can reduce the sizes of both and to . This can be done by forming the sized sets from in increasing order. However, we use the simpler (but larger) sets and in the proof.

For each , and are edges.

Suppose the th clause is , where each of , and are literals or for some . Then , and are edges, for each .

For each , the vertex set forms a copy of .

For each , we identify three vertices , and from , such that these three vertices form a totally independent 3set in .
Then , and are edges for each .

For each , all the vertices in are joined to all the vertices in , forming a complete bipartite graph.

Similarly, for each , the sets and form a complete bipartite graph.
The description of the graph is complete. A pictorial representation is given in Figure 1. We now claim that the graph so constructed is colorable if and only if is satisfiable.
Colorability implies satisfiability: Suppose that is colorable. We will construct a satisfying assignment for . Given a coloring of , we can assume that the vertices of the set are colored according to the natural coloring of the Kneser graph for any using Theorem 15. Using the vertices of , the correspondence between the colors in the natural coloring and the given coloring is determined, except for the colors and .
The vertex is adjacent to , which is colored and to the set whose vertices are colored with the colors . This leaves the colors available for coloring . Similarly for , because of adjacencies to and , the available colors are . Further, because is an edge, the colors are fixed for and