Graph coloring is a fundamental mathematical problem with various applications in computer science. Usually, we want to color the nodes of a graph with a minimum number of colors such that no two adjacent nodes have the same color.
In many real world applications, however, the number of available colors is strictly limited. For example, we are given a fixed set of frequencies, and we need to assign a frequency (color) to each wireless transmitter (node in a graph), such that wireless transmitters that interfere with each other (that are connected by an edge in the graph) do not use the same frequency. In cases where the set of colors is fixed, we may need to accept a certain number of conflicts, i.e., neighboring nodes which have the same color.
In practice, we often have coloring problems that additionally require strict service guarantees, e.g. priority service for premium customers, or unobstructed communication channels for maintenance and emergency personnel. Such applications can be modeled by partitioning the set of colors into (i) proper colors for guaranteed conflict-free service and (ii) relaxed colors which allow conflicts. In general, we can have colors, with of these colors being relaxed and of them being proper; we refer to this setting as the Two-Class -Coloring problem.
In this paper, we introduce and motivate the Two-Class -Coloring problem, that is, the problem of coloring a given graph with a fixed number of colors of which colors are relaxed to allow conflicts. We establish relations between the Two-Class -Coloring problem and several well-studied problems, such as Maximum Independent Set and . For our main contributions, we show that:
the family of Two-Class -Coloring problems is NP-complete, except for the special case when ,
Two-Class -Coloring, i.e., with one relaxed color, cannot be approximated to any constant factor within polynomial time ( APX),
Two-Class -Coloring with multiple relaxed colors is APX-complete, i.e., Two-Class -Coloring can be approximated to some constant (but not to an arbitrary constant) in polynomial time.
2 Related Work
Graph coloring is one of the most fundamental and well-studied problems of computer science. A general survey of fundamental graph coloring results is available in [coloringBook1] or [coloringBook2]. Even though it has been studied intensively since the early 1970s, graph coloring still receives significant attention today, with results ranging from distributed algorithms [furtherAreas1] to modified variants [coloringBook1]
or heuristic solutions for such problems[furtherAreas2]. However, the vast majority of these studies only consider proper colorings of graphs, i.e. when monochromatic edges are not allowed at all.
The most well-studied relaxed coloring problem is Defective Coloring, introduced in [DefectiveIntro]. A defective coloring is a (possibly relaxed) coloring of a graph such that each node of has at most conflicts. Given a graph and a fixed number of colors , the goal of the problem is to find a -coloring with the minimal possible value. Defective coloring is also known to be NP-complete [DefectiveHard], and has been studied extensively on specific classes of graphs [Defective1, Defective2, Defective3].
In the case when all color classes allow conflicts, a solution minimizing the number of conflicts is equivalently a solution maximizing the number of edges that go between different color classes. Thus the Two-Class -Coloring problem is essentially a reformulation of the problem. The problem is also a thoroughly studied problem, which is known to be both NP-complete and APX-complete [NPCompleteProblemsBook, ApproxHard, APXcomplete]. Further theoretical work mostly investigates the best possible constant-factor approximation for the problem [MaxkCut1, MaxkCut2, MaxkCut3]. Many of these studies focus primarily on the weighted version of the problem, and obtain their results for the unweighted graphs as a special case of this.
Another related question is the Maximum -Colorable Subgraph problem: given a graph, the task here is to select the largest subset of the vertices such that the subgraph induced by still admits a proper -coloring [ColorSubgraph1, ColorSubgraph2]. Note that the term “Maximum -Colorable Subgraph problem” is quite ambiguous in the literature, as it is often also used to refer to the problem of finding a -colorable (not necessarily induced) subgraph with maximally many edges, which is essentially only another reformulation of .
Our work is also closely connected to the Maximum Independent Set () problem, which is known to be NP-complete [NPCompleteProblemsBook], and also not approximable to any constant [ApproxHard].
3 Two-Class -Coloring
We have seen that several relaxations of the traditional graph coloring problem have been considered in the literature. In this work, we introduce the problem of Two-Class -Coloring, which follows a utilitarian approach in the sense that we minimize the global number of conflicts. To begin with, let us introduce some notation.
As usual, a graph consists of a set of vertices (with ) and a set of undirected edges . The degree of a node is denoted by .
For such a graph, a -coloring is a mapping of its vertices to a set of colors. Traditionally, any set of nodes that is assigned the same color is required to form an independent set in the graph.
The assignment of the same color to two adjacent vertices is called a conflict. Similarly, the edge connecting these two vertices is called a conflict edge (for being a witness of the conflict). All other edges are called covered edges. Graph Coloring does not allow conflicts at all. In our problems, however, the colors are sorted into two groups, and we only require the colors in one of the groups to form independent sets. A color is said to be a proper color if the vertices mapped to this color are required to form an independent set (i.e., have no conflicts). Otherwise, the color is called a relaxed color, which might have (or might not have) conflicts. Given these definitions, we can now define the colorings that we are interested in: In the Two-Class -Coloring problem (with ), a feasible solution is a -coloring of the input graph such that we can divide the colors into a group of relaxed colors and a group of proper colors. The natural goal in such a problem is to color the graph with as few conflicts as possible. However, when discussing the connection to related problems, it is beneficial to look at this problem in the dual perspective of having as many covered edges as possible. Note that maximizing the number of covered edges in a coloring indeed produces a solution that also minimizes the number of conflicts. Thus, we study the following problem in the paper.
The Two-Class -Coloring problem is defined as follows:
Decision problem: Given a graph and numbers , and , is there a feasible solution of which covers at least edges?
Optimization problem: Given a graph and numbers and , what is the maximal number of edges in that can be covered by a feasible solution of ?
Let us finish with some further remarks on notations. Generally, given an optimization problem , we denote the value of the optimal solution on graph by . For an arbitrary feasible solution of the problem, the value of is denoted by .
While we study all the above problems on simple graphs only, we also use multigraphs as a tool in one of our proofs. A multigraph is a graph that allows parallel edges between nodes, i.e. where is a multiset of elements from .
Example: Two-Class -Coloring is Not Equivalent to
Let us briefly compare and the Maximum Independent Set () problem on the example graph of Figure 1. Both problems can be formulated as a coloring problem with one relaxed (white) and one proper (black) color, so the set of feasible solutions for the two problems are identical. However, while aims to maximize the number of black vertices, maximizes the number of edges covered by the black vertices instead. Figure 1 shows that these problems may have different optimal solutions: the optimum of has only 5 black nodes and covers 13 edges (left), while the Maximum Independent Set contains 10 nodes and covers 11 edges (right).
4 Complexity Results (NP-Completeness)
In this section, we show that is NP-complete for with , and also for with . To begin with, observe that deciding is in NP: A solution to covering at least edges can be verified in polynomial time by traversing the set of covered edges.
Now, for the case , recall that deciding the traditional graph coloring problem is NP-complete for colors: [[NPCompleteProblemsBook]] It is NP-complete to decide whether an input graph admits a -coloring for a given number of proper colors . To show that is NP-complete for , we may thus show that a polynomial-time algorithm for solving could be used to compute a solution for in polynomial time. To that end, note that setting directly yields a decision procedure for . For , it is NP-complete to decide whether an input graph admits a solution to covering at least edges.
The case for must be treated separately, as for colors (deciding bipartiteness of a graph) can be solved in linear time, e.g. using a breadth-first search. Hence, can be decided in linear time for . For , note that if there exists a proper 2-coloring of the input graph , then it covers all edges and is hence a solution to for any . If there exists no proper 2-coloring of but a solution to covering at least edges, would have to induce at least one conflict. However, in there are no relaxed colors that would allow for any conflicts. Consequently, such a solution may not exist and can be decided for any in linear time.
Perhaps surprisingly, we will show that is also NP-complete for and . In other words, relaxing at least one color creates a gap in the computational complexity (assuming P NP).
To show that is also NP-hard to decide for and some given minimum number of covered edges , note that is equivalent to the well-known problem which is known to be NP-complete [NPCompleteProblemsBook]. For , we propose a reduction to the Maximum Independent Set problem. To begin with, let us recall that: [[NPCompleteProblemsBook]] It is NP-complete to decide whether an input graph contains an independent set of some given size . We propose the following reduction: Given an input graph , we determine whether there exists an independent set of size as follows:
add a clique of size to the graph and connect each clique-vertex with each graph vertex to obtain the modified graph , as shown in Figure 2
decide whether there is a solution for on covering at least edges,
output the same answer for whether an independent set of size exists in .
It is NP-hard to decide .
We will show that is NP-hard by arguing that the reduction given above correctly decides the Maximum Independent Set problem on any given input graph in polynomial time, if we assume that can be decided in polynomial time. To begin with, note that the proposed reduction requires only polynomial time.
As for the correctness, we assume the two colors are black (proper color, i.e. an independent set) and white (relaxed color) and argue that an optimal solution to the problem covering at least edges exists if and only if there exists an independent set of size in (that may be colored black to establish the required conflict bound ).
If there exists an independent set of size in , then we can simply color this independent set in black and cover at least edges from each of the vertices in to each of the vertices in . Hence, there exists a solution to covering at least edges.
For the inverse direction, we first argue that the added clique can be assumed to be colored entirely white in an optimal solution. Assume for contradiction that it is strictly optimal to color at least one node in black. If the clique contains one black node, no other vertex of the graph can be colored black as black is a proper color and each clique vertex is fully connected in the graph . Hence, such a coloring may cover at most edges. However, this can only be optimal for a maximum independent set of size in ; otherwise, we could simply color an independent set of size two in black and cover at least edges. For a maximum independent set of size , must be a clique itself and thus, any node covers edges as well. Hence, without loss of generality, we may assume that there exists an optimal solution of on where the added clique is colored entirely white.
It remains to show the following: If there exists a solution to the problem covering at least edges in , there must exist an independent set of size in . As argued above, there must exist at least one optimal solution in which is colored entirely white. We show that assigns at least vertices in the color black; in other words, showing that there exists an independent set of size .
Assume (for contradiction) that any maximum independent set on had size at most . Furthermore, note that as is a simple graph on vertices. Hence, the solution for could cover at most edges – a contradiction. ∎
Ultimately, we combine Section 4, Section 4 and the known NP-completeness results of the problem [NPCompleteProblemsBook] to obtain: For and , it is NP-complete to decide whether an input graph admits a solution to covering at least edges. The reductions presented in Section 4 demonstrate that the decision problems are NP-complete for and . Similarly, it can be shown that the naturally corresponding optimization problems are NP-hard. Thus, subsequently, we study the approximability of these optimization problems.
5 Approximability Results
In this section, we discuss the approximability of the optimal solution in problems. Our results show that the problems essentially behave like for , while they behave like Maximum Independent Set for . An illustration of the resulting approximation complexity classes can be found in Figure 3.
We assume some familiarity with the polynomial-time approximation complexity classes APX and PTAS. Intuitively, PTAS contains all problems that can be approximated to any constant factor, while APX contains all problems that can be approximated to some constant factor. Problems outside of APX can only be approximated to factors that depend on .
We apply two kinds of reductions in this section. Both reductions reduce a (generally more well-known) problem to another problem . Given a problem on an input graph , our reduction first transforms into an instance of problem (in our case, another input graph ). Then, assuming that an oracle provides us with a solution of problem for the input graph , we show how to derive a solution for problem on graph . Throughout this section, we leave it to the reader to verify that both transformations are computable in polynomial time. A reduction is called a continuous reduction if there exists a constant such that for any input graph and any possible solution obtained on , we have
Continuous reductions are known to preserve APX-membership; hence, if APX is known, then a continuous reduction from to proves that is not in APX either.
An L-reduction (linear reduction), on the other hand, preserves membership in PTAS, and also preserves APX-completeness. We say that a reduction is an L-reduction if there are constants , such that the following two conditions hold:
For any graph , we have
For any graph and possible solution on , we have
Note that these are simplified forms of the definitions, using the fact that we only study maximization problems in the paper. For a more detailed discussion of classes and tools in approximation complexity, we refer the reader to [ApproxGuide].
5.1 Approximations for
We show that the problems are intuitively more similar to the Maximum Independent Set () problem than to . To that end, we first discuss separately and show that there exists a continuous reduction from to the problem. Since it is known that APX, this implies APX.
In fact, the reduction from to follows in a rather straightforward way from a further analysis of the NP-completeness reduction presented in Section 4. Recall that we transformed the input graph on nodes into a graph on nodes by adding a clique of size . Given an algorithm to find an approximate solution to problem in in polynomial time, we derive an approximation for the problem on the graph by selecting the nodes in that have been colored with the proper color. Once again, we assume the two colors are black (proper color) and white (relaxed color). The independent set of black nodes is denoted by .
We distinguish two cases. First, assume that the algorithm returns a coloring on where . Recall that such a coloring can cover at most edges, as this is the highest possible degree in . For the approximation, we then choose some arbitrary .
Otherwise, at least two nodes are colored black. Recall that this implies that all black nodes are chosen from the original input graph , as any node of the clique is connected to all other nodes in . The independent set covers at most edges within (that is, of ), and exactly edges between and . Note that . In total, this amounts to at most edges.
Since this bound equally holds for the case with above, we can establish
On the other hand, by choosing a maximum independent set in (and covering edges to the clique with each of its nodes), it follows that
Combining these two observations and interpreting the set of black nodes as the approximate solution for the problem on , we get
so the condition of continuous reduction is indeed satisfied for . Hence, the existence of a -approximation for the problem would allow us to derive a -approximation for the problem. Knowing that APX, we conclude that APX.
We now present a continuous reduction from to . Together with our previous result, this shows that can also not be approximated to any constant factor. There exists a continuous reduction from to for any constant .
Given a solution of the problem on graph , we show how to transform into a solution for the problem on the same graph , while only losing a constant approximation factor. Note that is assumed to be a constant.
Generally, can be regarded as a partitioning of the nodes into independent sets , and a relaxed color set . Without loss of generality, we can assume that the sets are sorted in descending order by the number of their outgoing edges , i.e., the number of edges that have exactly one endpoint in .
In order to turn this into a solution for the problem on the same graph , let us select the independent set as the proper color class of , and let the relaxed color class consist of all the remaining nodes, i.e. . As is an independent set, the partitioning (, ) is indeed a feasible solution of . Note that the value of this solution is by definition .
In the original solution , since we only have one relaxed color, all covered edges have at least one of their endpoints in the sets , and thus
because we assumed that is the independent set with the maximum number of outgoing edges . This shows that
Since the set of feasible colorings in is a subset of those in
follows straightforwardly. Thus we have
showing that this is indeed a continuous reduction for . ∎
Since we have already seen that APX, this implies the following theorem. For any constant , the problem APX.
5.2 Approximations for with
For this case, recall that is essentially a reformulation of the problem. Since is known to be APX-complete [APXcomplete], the same naturally holds for . Let us consider some other .
We begin by showing that is also contained in APX. It is known that using the probabilistic method and derandomization, one can obtain a simple deterministic algorithm that finds a partitioning (, ) which cuts at least edges [ProbMethod]. This already ensures that the algorithm in question returns a -approximation for the problem.
Furthermore, this technique also allows us to approximate the optimum solution of each (with ) to a factor of . Given a problem on , we can simply run this method to obtain a partitioning (, ) with at least edges cut, and assign the first two relaxed colors to these partitions (not using the remaining colors at all). As we have in any case, this is already a -approximation algorithm for the problem, showing that can always be approximated to a constant factor. For , we have APX. In order to show that is also complete in APX, we present an L-reduction to transform a solution of into a solution of , i.e. . The APX-completeness of has also been shown through a reduction to in [APXcomplete]. We essentially show that the same graph transformation can be applied in our case as in the reduction of [APXcomplete], regardless of the difference between and , i.e. the extra restriction that some of the classes must be proper colors. For this, we first describe the reduction of [APXcomplete]. There exists an L-reduction from to (based on the transformation idea described in [APXcomplete]).
We describe the reduction in two steps. We first present a reduction to the problem on multigraphs (i.e. graphs allowing parallel edges). We then discuss how to transform such a multigraph into a simple graph without parallel edges.
Given a problem on an input graph with nodes and edges, let us create a multigraph as follows. We add a clique of further nodes to , with each edge between the nodes of having a multiplicity of . Furthermore, we connect each node to each node , with an edge of multiplicity . The resulting multigraph consist of nodes and edges (with multiplicity).
Note that this already satisfies the first condition of the L-reduction. As we discussed earlier, an optimum solution of on will certainly cover at least edges. On the other hand, has only edges. Thus, we have
which implies the first condition of the L-reduction for some .
We now show that the second condition also holds for . Note that if we color the nodes of with two relaxed colors in an arbitrary way, and use each of the remaining (proper or relaxed) colors to color one node of , then we immediately obtain a coloring with at most uncovered edges.
Consider a solution to the problem, that is, a -coloring of the nodes of . If such a coloring was to assign the same color to any two nodes of , then it would lose at least edges, and thus the right side of the second condition would be at least , implying that the condition holds regardless of our choice of . Thus, it remains to show the condition for the case when colors the nodes of with different colors.
Note that if any is assigned one of the colors used in , it may be recolored to one of the remaining 2 colors (not used in ). Thereby, the value of a solution will increase by at least , while introducing at most new conflicts. Hence, after recoloring all such vertices in , we can assume to obtain a solution where is colored with different colors, and only the remaining 2 colors are used in .
Given a -coloring of , we can then simply define the solution of as the restriction of to the nodes of . Since both and the optimal coloring covers all edges of outside of , and they both use only 2 colors in , their difference is in fact determined by how many edges they cover in . Hence, we have
and thus the second condition indeed holds with .
As a second step, we transform the multigraph into a simple graph with the same properties. For this, we define an auxiliary graph on nodes. Let us denote the nodes of by , , … , and let be the graph obtained by taking a clique on these nodes, and then deleting the edges (), () and () from this clique. There are two crucial properties of the resulting graph : (i) it is -colorable without any conflicts, (ii) every valid -coloring of assigns different colors to nodes and .
We then use these copies of the graph to replace the parallel edges of . For each edge in which is not contained in , we can replace by a separate instance of , with the nodes and taking the roles of nodes and . Since we only insert new nodes and new edges for each original edge of , the number of nodes and edges in the resulting graph will still remain polynomial in . In the graph obtained, each will behave like an edge in the following sense: If nodes and have different color, then it is possible to color without a conflict; but if and have the same color, then there will be at least one conflict in . Thus, if there were originally parallel edges between and , then assigning the same color to and implies that there will certainly be at least conflicts within the copies of between the two nodes.
For the purpose of the reduction, the obtained graph behaves exactly like the multigraph . Since the number of edges in is in , the first condition still holds. In any solution , if a copy of has more than one conflict, we can always recolor the nodes , , , …, such that there are only 0 or 1 conflicts in the end, depending on whether and have the same color or not. Hence, we can assume that each represents exactly as many conflicts as the parallel edge it has replaced. Thus, the reduction described for the multigraph case also works for without modification. ∎
The transformation described so far is a valid reduction to , i.e. when all the available colors are relaxed. We now show that it also remains a valid reduction for . There exists an L-reduction from to for any .
For the first part of the reduction (to the multigraph ), we can argue as before that all nodes of obtain a different color in . We then use the same technique to ensure that the nodes of will only get the remaining two colors. This technique still increases the number of covered edges in each step, but might lead to an invalid coloring in the end if one (or both) of the two colors used in are among the proper colors. However, if one of the proper colors used in has a conflict, then we can simply swap this proper color with a relaxed color that is currently used only on a single node in . After at most 2 such swaps, we can make sure that both colors used to color are relaxed colors. We can consider the resulting coloring as the original solution , and apply the same reduction as before.
As for the transformation to a simple graph, whenever two neighboring nodes and have different colors, it is always possible to color the whole copy of graph between them without any conflicts at all, so it does not matter whether the colors used on the specific nodes of are proper or relaxed colors. If and have the same color , then there is at least one relaxed color . We can then color the copy of by using on nodes and , and each of the remaining colors on one of the remaining nodes; in this coloring, the only conflict will be on the edge . Thus it is still always possible to color each copy of with exactly 0 or 1 conflicts (depending on whether and have the same color), regardless of the colors of and being proper or relaxed. ∎
Altogether, this shows the following. For any , the problem is APX-complete.
6 Conclusion – and a Generalization
In the paper, we analyzed the problem of Two-Class -Coloring, which aims to maximize the number of covered edges when coloring a graph with relaxed and proper colors. We have seen that is similar but not identical to the Maximum Independent Set problem. We have shown that the problem is NP-complete for any (except when ). Furthermore, we also proved that the problems with are APX-complete, and that cannot be approximated to any constant factor in polynomial time.
Throughout this paper, we have established the close relation between the and the problem. Note that the cost function used for the optimization is the same for both problems, while they only differ in their set of feasible solutions.
In practice, however, one may think of other reasonable cost functions. For instance, Defective Coloring exclusively focuses on the node with the highest number of conflicts, and does not evaluate the coloring on the rest of the graph.
Considering application areas, e.g. modeling interference in frequency allocation problems, both approaches might be reasonable. A provider would generally want to keep the total number of conflicts in the graph small, as this corresponds to the overall service quality. On the other hand, a provider would probably also try to minimize the maximal number of conflicts at a single node in order to avoid upsetting any particular costumer.
In fact, an interesting generalization allows us to model both settings (and the trade-off between them) at the same time. Given a graph and a -coloring of , let us denote the number of conflicts at node (i.e., the number of conflict edges incident to ) by . Then, given a real parameter , we define the Generalized Conflict Coloring problem, where the cost of a coloring is defined as
The goal of the Generalized Conflict Coloring problem is to find a coloring on colors that minimizes this cost. This generalized cost function can be combined with any restrictions on the set of feasible colorings, for example, the family of problems.
In the following, we motivate that this problem is a natural generalization of various known coloring problems. In the case when , the aim of the problem is to minimize , which is simply two times the number of monochromatic edges (conflicts) in the graph. Hence the cost of a coloring is exactly , and thus the problem is identical to Two-Class -Coloring (i.e., to ).
On the other hand, as goes to infinity, the sum in the cost will be dominated only by the highest value in the graph, and thus a coloring will be better than a coloring exactly if the maximal is smaller in . This is precisely what is minimized in Defective Coloring; hence, Defective Coloring is also obtained as a subcase of Generalized Conflict Coloring in the limit for .
Finally, if , the difference between the distinct values will diminish for all , since all are approaching 1 for small enough. Thus, in the limit we obtain
In other words, the cost of a coloring becomes the number of nodes for which . Minimizing this corresponds to finding a coloring which leaves the highest possible number of nodes without a conflict.
Furthermore, intermediate values of allow us to study the trade-off between these problems. For instance, if is selected, then we obtain a setting between and Defective Coloring, where we have to optimize both for a small number of total conflicts and a reasonably balanced distribution of these conflicts among nodes. Altogether, we conclude that the further study of this Generalized Conflict Coloring problem is not only interesting from a theoretical point of view, but also motivated by practical applications.