Defective Coloring on Classes of Perfect Graphs

In Defective Coloring we are given a graph $G$ and two integers $\chi_d$, $\Delta^*$ and are asked if we can $\chi_d$-color $G$ so that the maximum degree induced by any color class is at most $\Delta^*$. We show that this natural generalization of Coloring is much harder on several basic graph classes. In particular, we show that it is NP-hard on split graphs, even when one of the two parameters $\chi_d$, $\Delta^*$ is set to the smallest possible fixed value that does not trivialize the problem ($\chi_d = 2$ or $\Delta^* = 1$). Together with a simple treewidth-based DP algorithm this completely determines the complexity of the problem also on chordal graphs. We then consider the case of cographs and show that, somewhat surprisingly, Defective Coloring turns out to be one of the few natural problems which are NP-hard on this class. We complement this negative result by showing that Defective Coloring is in P for cographs if either $\chi_d$ or $\Delta^*$ is fixed; that it is in P for trivially perfect graphs; and that it admits a sub-exponential time algorithm for cographs when both $\chi_d$ and $\Delta^*$ are unbounded.


Introduction
In this paper we study the computational complexity of DEFECTIVE COLORING, which is also known in the literature as IMPROPER COLORING: given a graph and two parameters χ d , ∆ * we want to color the graph with χ d colors so that every color class induces a graph with maximum degree at most ∆ * . DEFECTIVE COLORING is a very natural generalization of GRAPH COLORING, which corresponds to the case ∆ * = 0. As a result, since the introduction of this problem more than thirty years ago (Cowen et al. (1986); Andrews and Jacobson (1985)) a great deal of research effort has been devoted to its study. Among the topics that have been investigated are its extremal properties (Frick and Henning (1994); Kim et al. (2014Kim et al. ( , 2016; Borodin et al. (2013); Achuthan et al. (2011); Goddard and Xu (2016)), especially on planar graphs and graphs on surfaces (Cowen et al. (1997); Archdeacon (1987); Choi and Esperet (2016); Havet and Sereni (2006)), as well as its asymptotic behavior on random graphs (Kang and McDiarmid (2010); ). Lately, the problem has attracted renewed interest due to its applicability to communication networks, with the coloring of the graph modeling the assignment of frequencies to nodes and ∆ * representing some amount of tolerable interference. This has led to the study of the problem on Unit Disk Graphs Havet et al. (2009) as well as various classes of grids Araújo et al. (2012); Bermond et al. (2010); Archetti et al. (2015). Weighted generalizations have also been considered Bang-Jensen and Halldórsson (2015); Gudmundsson et al. (2016). More background can be found in the survey by Frick (1993) or Kang's PhD thesis (Kang (2008)).
Our main interest in this paper is to study the computational complexity of DEFECTIVE COLORING through the lens of structural graph theory, that is, to investigate the classes of graphs for which the problem becomes tractable. Since DEFECTIVE COLORING generalizes GRAPH COLORING we immediately know that it is NP-hard already in a number of restricted graph classes and for small values of χ d , ∆ * . Nevertheless, the fundamental question we would like to pose is what is the additional complexity brought to this problem by the freedom to produce a slightly improper coloring. In other words, we ask what are the graph classes where even though GRAPH COLORING is easy, DEFECTIVE COLORING is still hard (and conversely, what are the classes where both are tractable). Though some results of this type are already known (for example Cowen et al. (1997) prove that the problem is hard even on planar graphs for χ d = 2), this question is not well-understood. Our focus on this paper is to study DEFECTIVE COLORING on subclasses of perfect graphs, which are perhaps the most widely studied class of graphs where GRAPH COLORING is in P. The status of the problem appears to be unknown here, and in fact its complexity on interval and even proper interval graphs is explicitly posed as an open question in Havet et al. (2009).
Our results revolve around two widely studied classes of perfect graphs: split graphs and cographs. For split graphs we show not only that DEFECTIVE COLORING is NP-hard, but that it remains NP-hard even if either χ d or ∆ * is a constant with the smallest possible non-trivial value (χ d ≥ 2 or ∆ * ≥ 1). To complement these negative results we provide a treewidth-based DP algorithm which runs in polynomial time if both χ d and ∆ * are constant, not only for split graphs, but also for chordal graphs. This generalizes a previous algorithm of Havet et al. (2009) on interval graphs.
We then go on to show that DEFECTIVE COLORING is also NP-hard when restricted to cographs. We note that this result is somewhat surprising since relatively few natural problems are known to be hard for cographs. We complement this negative result in several ways. First, we show that DEFECTIVE COL-ORING becomes polynomially solvable on trivially perfect graphs, which form a large natural subclass of cographs. Second, we show that, unlike the case of split graphs, DEFECTIVE COLORING is in P on cographs if either χ d or ∆ * is fixed. Both of these results are based on dynamic programming algorithms. Finally, by combining the previous two algorithms with known facts about the relation between χ d and ∆ * we obtain a sub-exponential time algorithm for DEFECTIVE COLORING on cographs. We note that the existence of such an algorithm for split graphs is ruled out by our reductions, under the Exponential Time Hypothesis. Table 1 summarizes our results. For the reader's convenience, it also depicts an inclusion diagram for the graph classes that we mention.

Preliminaries and Definitions
We use standard graph theory terminology, see e.g. Diestel (2012). In particular, for a graph G = (V, E) and u ∈ V we use N (u) to denote the set of neighbors of u, N [u] denotes N (u) ∪ {u}, and for S ⊆ V we use G[S] to denote the subgraph induced by the set S. We use ω(G) to denote the size of the maximum clique of G. A proper coloring of G with χ colors is a function c : V → {1, . . . , χ} such that for all i ∈ {1, . . . , χ} the graph G[c −1 (i)] is an independent set. We will focus on the following generalization of coloring: We call the problem of deciding if a graph admits a (χ d , ∆ * )-coloring, for given parameters χ d , ∆ * , DEFECTIVE COLORING. For a graph G and a coloring function c : V → N we say that the deficiency of a vertex u is |N (u) ∩ c −1 (c(u))|, that is, the number of its neighbors with the same color. The deficiency of a color class i is defined as the maximum deficiency of any vertex colored with i.
Proof: Partition V arbitrarily into χ d sets of size at most |V | /χ d and color each set with a different color.
Proof: For the sake of contradiction, assume that G has a clique of size χ d · (∆ * + 1) + 1, then any coloring of G with χ d colors must give the same color to strictly more than ∆ * + 1 vertices of the clique, which implies that these vertices have deficiency at least ∆ * + 1. 2 Let us now also give some quick reminders regarding the definitions of the graph classes we consider in this paper.
A graph G = (V, E) is a split graph if V = K ∪ S where K induces a clique and S induces an independent set. A graph G is chordal if it does not contain any induced cycles of length four or more. It is well known that all split graphs are chordal; furthermore it is known that the class of chordal graphs contains the class of interval graphs, and that chordal graphs are perfect. For more information on these standard containments see Brandstädt et al. (1999).
A graph is a cograph if it is either a single vertex, or the disjoint union of two cographs, or the complete join of two cographs Seinsche (1974). Note that the class of cographs is easily seen to be closed under complement. As a result, complete k-partite graphs are cographs (their complement is a union of cliques, which are themselves cographs); this fact will be used later. A graph is trivially perfect if in all induced subgraphs the maximum independent set is equal to the number of maximum cliques Golumbic (1978). Trivially perfect graphs are exactly the cographs which are chordal Yan et al. (1996), and hence are a subclass of cographs, which are a subclass of perfect graphs. We recall that GRAPH COLORING is polynomial-time solvable in all the mentioned graph classes, since it is polynomial-time solvable on perfect graphs Grötschel et al. (1988), though of course for all these classes simpler and more efficient combinatorial algorithms are known.
We will also use the notion of treewidth for the definition of which we refer the reader to Bodlaender and Koster (2008); Cygan et al. (2015).

NP-hardness on Cographs
In this section we establish that DEFECTIVE COLORING is already NP-hard on the very restricted class of cographs. To this end, we show a reduction from 4-PARTITION.
Definition 4 In 4-PARTITION we are given a set A of 4n elements, a size function s : A → N + which assigns a value to each element, and a target integer B. We are asked if there exists a partition of A into n sets of four elements (quadruples), such that for each set the sum of its elements is exactly B.
4-PARTITION has long been known to be strongly NP-hard, that is, NP-hard even if all values are polynomially bounded in n. In fact, the reduction given in Garey and Johnson (1979) establishes the following, slightly stronger statement.
Theorem 5 4-PARTITION is strongly NP-complete if A is given to us partitioned into four sets of equal size A 1 , A 2 , A 3 , A 4 and any valid solution is required to place exactly one element from each A i , i ∈ {1, . . . , 4} in each quadruple.
Theorem 6 DEFECTIVE COLORING is NP-complete even when restricted to complete k-partite graphs. Therefore, DEFECTIVE COLORING is NP-complete on cographs.
Proof: We start our reduction from an instance of 4-PARTITION where the set of elements A is partitioned into four equal-size sets as in Theorem 5. We first transform the instance by altering the sizes of all elements as follows: for each element x ∈ A i we set s (x) := s(x) + 5 i B + 5 5 n 2 B and we also set B := B +B · 4 i=1 5 i +4·5 5 n 2 B. After this transformation our instance is "ordered", in the sense that all elements of A i+1 have strictly larger size than all elements of A i . Furthermore, it is not hard to see that the answer to the problem did not change, as any quadruple that used one element from each A i and summed up to B now sums up to B . In addition, we observe that in the new instance the condition that exactly one element must be used from each set is imposed by the element sizes themselves: a quadruple that contains two or more elements of A 4 will have sum strictly more than B , while one containing no elements of A 4 will have sum strictly less than B . Similar reasoning can then be applied to A 3 , A 2 . We note that the element sizes now have the extra property that s (x) ∈ (B /4 − 5B /n 2 , B /4 + 5B /n 2 ). Indeed, the largest possible size is at most M = B+5 4 B+5 5 Bn 2 , while B /4 ≥ 5 5 Bn 2 , so M −B /4 ≤ 5 4 B+B ≤ 5B /n 2 . Similarly, the smallest value is at least L = 1 + 5B + 5 5 Bn 2 while B /4 ≤ 5 5 Bn 2 + 5 5 B so B /4 − L ≤ 5 5 B We now construct an instance of DEFECTIVE COLORING as follows. We set ∆ * = B and χ d = n. To construct the graph G, for each element x ∈ A 2 ∪ A 3 ∪ A 4 we create an independent set of s (x) new vertices which we will call V x . For each element x ∈ A 1 we construct two independent sets of s (x) new vertices each, which we will call V 1 x and V 2 x . Finally, we turn the graph into a complete 5n-partite graph, that is, we add all possible edges while retaining the property that all sets V x and V i x remain independent. Let us now argue for the correctness of the reduction. First, suppose that there exists a solution to our (modified) 4-PARTITION instance where each quadruple sums to B . Number the quadruples arbitrarily from 1 to n and consider the i-th quadruple ( is minimum among the sizes of the elements of the quadruple. We now use color i for all the vertices of the sets V x j i for j ∈ {2, 3, 4} as well as the sets V 1 We continue in this way using a different color for each quadruple and thus color the whole graph (since the quadruples use all the elements of A). We observe that for any color i the vertices with maximum deficiency are those from V 1 , and all these vertices have deficiency exactly Hence, this is a valid solution.
For the converse direction of the reduction, suppose we are given a (χ d , ∆ * )-coloring of the graph we constructed. We first need to argue that such a coloring must have a very special structure. In particular, we will claim that in such a coloring each independent set V x or V i x must be monochromatic. Towards this end we formulate a number of claims.
Claim 7 Every color i is used on at most 5B /4 + 25B /n 2 vertices.
Proof: We will assume that i is used at least 5B /4+25B /n 2 +1 times and obtain a contradiction. Since the size of the largest independent set V x is at most B /4 + 5B /n 2 we know that color i must appear in at least six different independent sets. Among the independent sets in which i appears let V x be the one in which it appears the minimum number of times. The deficiency of a vertex colored with i in this set is at least 5 Because of the previous claim, which states that no color appears too many times, we can also conclude that no color appears too few times.
Claim 8 Every color i is used on at least 5B /4 − 50B /n vertices.
Proof: First, note that |V | ≥ 5nB /4 − 25B /n because we have created 5n independent sets each of which has size more than B /4 − 5B /n 2 . By the previous claim any color j = i has |c −1 (j)| ≤ 5B /4 + 25B /n 2 . Therefore j =i |c −1 (j)| ≤ (n − 1)(5B /4 + 25B /n 2 ). We have |c −1 (i)| = Given the above bounds on the size of each color class we can now conclude that each color appears in exactly five independent sets V x .
Claim 9 For each color i the graph induced by c −1 (i) is complete 5-partite.
Proof: First, observe that by the previous claim, there must exist at least 5 sets V x or V i x that intersect c −1 (i), because |c −1 (i)| ≥ 5B /4−O(B /n) while the size of each such set is at most B /4+O(B /n 2 ); therefore, the size of any four sets is strictly smaller than |c −1 (i)| (assuming of course that n is sufficiently large). Suppose now that c −1 (i) intersects 6 different sets, and consider the independent set V x on which color i appears at least once but a minimum number of times. A vertex colored i in this set will have deficiency at least 5 6 ( 5B , which is strictly greater than B for sufficiently large n. Hence, color i appears in exactly 5 independent sets. 2 Claim 10 In any valid solution every maximal independent set of G is monochromatic.
Proof: Consider color i, which by the previous claim appears in exactly 5 independent sets. Suppose that one of these is not monochromatic, say colors i, j appear in V x . Without loss of generality let i be the minority color, that is, i appears in at most |V x |/2 vertices of V x . Then we obtain a contradiction as follows: the total number of times i is used in the graph is at most , where the first term uses the general upper bound on the size of all other independent sets where i appears, and the second term uses the same upper bound on |V which is strictly smaller than 5B 4 − 50B n , the minimum number of times that i must be used (for sufficiently large n). 2 We are now ready to complete the converse direction of the reduction. Consider the vertices of c −1 (i), for some color i. By the previous sequence of claims we know that they appear in and fully cover 5 independent sets V x or V i x . We claim that for each j ∈ {2, 3, 4} any color i is used in exactly one V x with x ∈ A j . This can be seen by considering the deficiency of the vertices of the smallest independent set where i appears. The deficiency of these vertices is equal to i , which are the sizes of the four larger independent sets. By the construction of the modified 4-PARTITION instance, any quadruple that contains two elements of A 4 will have sum strictly greater than B . Hence, these elements must be evenly partitioned among the color classes, and with similar reasoning the same follows for the elements of A 3 , A 2 .
We thus arrive at a situation where each color i appears in the independent sets V x 4 i , V x 3 i , V x 2 i as well as two of the "small" independent sets. Recall that all "small" independent sets were constructed in two copies of the same size V 1 x , V 2 x . We would now like to ensure that all color classes contain one small independent set of the form V 1 x 1 i . If we achieve this the argument will be complete: we construct the from the color class i, and the deficiency of the vertices of the remaining small independent set ensures that the sum of the elements of the quadruple is at most B . By constructing n such quadruples we conclude that they all have sum exactly B , since the sum of all elements of the 4-PARTITION instance is (without loss of generality) exactly nB .
To ensure that each color class contains an independent set V 1 x we first observe that we can always exchange the colors of independent sets V 1 x and V 2 x , since they are both of equal size (and monochromatic). Construct now an auxiliary graph with χ d vertices, one for each color class and a directed edge for each x is colored i and the set V 2 x is colored j we place a directed edge from i to j (note that this does not rule out the possibility of self-loops). In the auxiliary graph, each vertex that does not have a self-loop is incident on two directed edges. We would like all such vertices to end up having out-degree 1, because then each color class would contain an independent set of the form V 1 x . The main observation now is that in each weakly connected component that contains a vertex u with out-degree 0 there must also exist a vertex v of out-degree 2. Exchanging the colors of V 1 x and V 2 x corresponds to flipping the direction of an edge in the auxiliary graph. Hence, we can take a maximal directed path starting at v and flip all its edges, while maintaining a valid coloring of the original graph. This decreases the number of vertices with out-degree 0 and therefore repeating this process completes the proof. 2

Polynomial Time Algorithm on Trivially Perfect Graphs
In this section, we complement the NP-completeness proof from Section 3 by giving a polynomial time algorithm for DEFECTIVE COLORING on the class of trivially perfect graphs, which form a large subclass of cographs. We will heavily rely on the following equivalent characterization of trivially perfect graphs given by Golumbic (1978): Theorem 11 A graph is trivially perfect if and only if it is the comparability graph of a rooted tree.
In other words, for every trivially perfect graph G, there exists a rooted tree T such that making every vertex in the tree adjacent to all of its descendants yields a graph isomorphic to G. We refer to T as the underlying rooted tree of G. We recall that it is known how to obtain T from G in polynomial (in fact linear) time Yan et al. (1996).
We are now ready to describe our algorithm. The following observation is one of its basic building blocks.
Lemma 12 Let G = (V, E) be a trivially perfect graph, T its underlying rooted tree, and u ∈ V be an , or another ancestor of v. However, because T is a tree, if w is an ancestor of v, then w is either an ancestor or a descendant of u. 2 Theorem 13 DEFECTIVE COLORING can be solved in polynomial time on trivially perfect graphs.
Proof: Given a trivially perfect graph G = (V, E) with underlying rooted tree T = (V, E ) and two nonnegative integers χ d and ∆ * , we compute a coloring of G using at most χ d colors and with deficiency at most ∆ * as follows. First, we partition the vertices of T (and therefore of G) into sets V 1 , . . . , V , where denotes the height of T , such that V 1 contains the leaves of T and, for every 2 ≤ i ≤ , V i contains the leaves of T \ ( i−1 j=1 V j ). Observe that each set V i is an independent set in G. We now start our coloring by giving all vertices of V 1 color 1. Then, for every 2 ≤ i ≤ , we color the vertices of V i by giving each of them the lowest color available, i.e., we color each vertex u with the lowest j such that u has at most ∆ * descendants colored j. If for some vertex no color is available, that is, its subtree contains at least ∆ * + 1 vertices colored with each of the colors {1, . . . , χ d }, then we return that G does not admit a (χ d , ∆ * )-coloring.
This procedure can clearly be performed in polynomial time and, if it returns a solution, it uses at most χ d colors. Furthermore, whenever the procedure uses color i on a vertex u it is guaranteed that u has deficiency at most ∆ * among currently colored vertices. Since any neighbor of u that is currently colored with i must be a descendant of u, by Lemma 12 this guarantees that the deficiency of all vertices remains at most ∆ * at all times.
It now only remains to prove that the algorithm concludes that G cannot be colored with χ d colors and deficiency ∆ * only when no such coloring exists. For this we will rely on the following claim which states that any valid coloring can be "sorted".
Claim 14 If G admits a (χ d , ∆ * )-coloring, then there exists a (χ d , ∆ * )-coloring of G c such that, for every two vertices u, v ∈ V (G), if v is a descendant of u, then c(v) ≤ c(u).
Proof: Let us consider an arbitrary (χ d , ∆ * )-coloring c * : V (G) → {1, . . . , χ d } of G. We describe a process which, as long as there exist u, v ∈ V with u an ancestor of v and c * (u) < c * (v) transforms c * to another valid coloring which is closer to having the desired property. So, suppose that such a pair u, v exists, and furthermore, if many such pairs exist, suppose that we select a pair where u is as close to the root of T as possible. As a result, we can assume that no ancestor u of u has color c * (u), because otherwise we would have started with the pair u , v.
We will now consider two cases. Assume first that there exists a vertex x such that c * (x) = c * (v) and x is an ancestor of u. We claim that swapping the colors of u and v yields a new coloring of G with deficiency at most ∆ * . The only affected vertices are those colored c * (u) or c * (v). Regarding color c * (u), because by Lemma 12 N [v] ⊆ N [u] and color c * (u) was moved from u to v, the deficiency of every vertex colored c * (u) in V \ {u, v} is at most as high as it was before, and the deficiency of v is at most as high as the deficiency of u in c * . Regarding color c * (v) we observe that the deficiency of vertex x remains unchanged, since both u, v are its neighbors, and the same is true for all ancestors of x. Since the deficiency of x is at most ∆ * , by Lemma 12, the deficiency of every descendant of x colored with c * (v) is also at most ∆ * .
For the remaining case, suppose that no ancestor of u uses color c * (v). Recall that we have also assumed that no ancestor of u uses color c * (u). We therefore transform the coloring as follows: in the subtree rooted at u we exchange colors c * (u) and c * (v) (that is, we color all vertices currently colored with c * (u) with c * (v) and vice-versa). Because no ancestor of u uses either of these two colors, this exchange does not affect the deficiency of any vertex.
We can now repeat this procedure as follows: as long as there is a conflicting pair u, v, with u an ancestor of v and c * (u) < c * (v) we select such a pair with u as close to the root as possible and, if there are several such pairs, we select the one with maximum c * (v). We perform the transformation explained above on this pair and then repeat. It is not hard to see that every vertex will be used at most once as an ancestor in this transformation, because after the transformation it will have the highest color in its subtree. Hence we will eventually obtain the claimed property. 2 It follows from the previous claim that if a (χ d , ∆ * )-coloring exists, then a sorted (χ d , ∆ * )-coloring exists where ancestors always have colors at least as high as their descendants. We can now argue that our algorithm also produces a sorted coloring, with the extra property that whenever it sets c(u) = i we know that any sorted (χ d , ∆ * )-coloring of G must give color at least i to u. This can be shown by induction on i: it is clear for the vertices of V 1 to which the algorithm gives color 1; and if the algorithm assigns color i to u, then u has ∆ * + 1 descendants which (by inductive hypothesis) must have color at least i − 1 in any valid sorted coloring of G. 2

Algorithms on Cographs
In this section we present algorithms that can solve DEFECTIVE COLORING on cographs in polynomial time if either ∆ * or χ d is bounded; both algorithms rely on dynamic programming. After presenting them we show how their combination can be used to obtain a sub-exponential time algorithm for DEFECTIVE COLORING on cographs.

Algorithm for Small Deficiency
We now present an algorithm that solves DEFECTIVE COLORING in polynomial time on cographs if ∆ * is bounded. Before we proceed, let us sketch the main ideas behind the algorithm. Given a (χ d , ∆ * )coloring c of a graph G, we define the type of a color class i, as the pair of two integers (s i , d i ) where s i := min{|c −1 (i)|, ∆ * + 1} and d i is the maximum degree of G[c −1 (i)]. In other words, the type of a color class is characterized by its size (up to value ∆ * + 1) and the maximum deficiency of any of its vertices. We observe that there are at most (∆ * + 1) 2 possible types in a valid (χ d , ∆ * )-coloring, because s i only takes values in {1, . . . , ∆ * + 1} and d i in {0, . . . , ∆ * }.
We can now define the signature of a coloring c as a tuple which contains one element for every possible color type (s, d). This element is the number of color classes in c that have type (s, d), and hence is a number in {0, . . . , χ d }. We can conclude that there are at most (χ d + 1) (∆ * +1) 2 possible signatures that a valid (χ d , ∆ * )-coloring can have. Our algorithm will work via dynamic programming, using the fact that any cograph can be seen as a union or join of two of its induced subgraphs. We therefore analyze a given cograph into its constituent subgraphs in this way (obtaining a binary tree) and for each such graph we will construct a binary table which states for each possible signature if the current graph admits a (χ d , ∆ * )-coloring with this signature. The obstacle now is to describe a procedure which, given two such tables for graphs G 1 , G 2 is able to generate the table of admissible signatures for their union and their join. If we do this we can inductively compute such a table for all intermediate graphs used in the construction of the input graph G and eventually for G itself.
Theorem 15 There is an algorithm which, given a cograph G and integers Proof: We use the ideas sketched above. Specifically, we say that a coloring signature S is a function {1, . . . , ∆ * + 1} × {0, . . . , ∆ * } → {0, . . . , χ d } and a coloring c has signature S if for any (s, d) ∈ {1, . . . , ∆ * +1}×{0, . . . , ∆ * } the number of color classes with type (s, d) in c is S((s, d)). Our algorithm will maintain a binary table T with the property that, for S a possible coloring signature we have T (S) = 1 if and only if there exists a (χ d , ∆ * )-coloring of G with signature S. The size of T is therefore at most (χ d + 1) (∆ * +1) 2 . It is not hard to see how to compute T if G consists of a single vertex: the only color class then has type (1, 0), so the only possible signature is the one that sets S((1, 0)) = 1 and S((s, d)) = 0 otherwise. Now, suppose that G is either the union or the join of two graphs G 1 , G 2 for which our algorithm has already calculated the corresponding tables T 1 , T 2 . We will use the fact that for any valid (χ d , ∆ * )coloring c of G with signature S, its restrictions to G 1 , G 2 are also valid (χ d , ∆ * )-colorings. If these restrictions have signatures S 1 , S 2 it must then be the case that T 1 (S 1 ) = T 2 (S 2 ) = 1. It follows that in order to compute all the signatures for which we must have T (S) = 1 it suffices to consider all pairs of signatures S 1 , S 2 such that T 1 (S 1 ) = T 2 (S 2 ) = 1 and decide if it is possible to have a coloring of G with signature S whose restrictions to G 1 , G 2 have signatures S 1 , S 2 .
Given two signatures S 1 , S 2 such that T 1 (S 1 ) = T 2 (S 2 ) = 1 we would therefore like to generate all possible signatures S for colorings c of G such that S 1 , S 2 represent the restriction of c to G 1 , G 2 . Every color class of c will either consist of vertices of only one subgraph G 1 or G 2 , or it will be the result of merging a color class of G 1 with a color class of G 2 . Our algorithm will enumerate all possible merging combinations between color classes of G 1 and G 2 .
Let us now explain how we enumerate all merging possibilities. Let c 1 , c 2 be (χ d , ∆ * )-colorings of G 1 , G 2 with signatures S 1 , S 2 respectively. In the remainder of this proof we explain how given these two signatures we can generate all possible signatures of feasible colorings c of the union or join of G 1 , G 2 , such that c has signatures S 1 , S 2 when restricted to G 1 , G 2 respectively. Essentially, the problem is that some color classes of c 1 can be merged with some color classes of c 2 to produce color classes of the new graph, so we need to consider all possible combinations in which this can happen.
If G is the join of G 1 , G 2 we say that type (s 1 , d 1 ) is mergeable with type (s 2 , d 2 ) if s 1 + d 2 ≤ ∆ * and s 2 + d 1 ≤ ∆ * . If G is the union of G 1 , G 2 we say that any pair of types is mergeable. Furthermore, if G is the join of G 1 , G 2 and (s 1 , d 1 ), (s 2 , d 2 ) are mergeable types, we say that they merge into type (min{s 1 + s 2 , ∆ * + 1}, max{d 1 + s 2 , d 2 + s 1 }). If G is the union of G 1 , G 2 we say that types (s 1 , d 1 ) and (s 2 , d 2 ) merge into type (min{s 1 + s 2 , ∆ * + 1}, max{d 1 , d 2 }). The intuition behind these definitions is that a color class i of c 1 is mergeable with a color class j of c 2 if we can use a single color for c −1 1 (i) ∪ c −1 2 (j) in G, and the type of this color class is the type into which the types of i, j merge. Now, in order to enumerate all merging possibilities we construct an auxiliray bipartite graph G = (A 1 , A 2 , E ). The graph G consists of (∆ * + 1) 2 vertices on each side, each corresponding to a type. We place an edge between two vertices if their corresponding types are mergeable (so if G is a union of G 1 , G 2 then G is a complete bipartite graph). We also give a weight to each vertex as follows: if u ∈ A i corresponds to type (s, d) we set w(u) = S i ((s, d)). In words, the weight of a vertex that represents a type is the number of color classes of that type in the coloring of the subgraphs.
We will now enumerate assignments of non-negative weights to the edges of G which satisfy the condition that for all vertices u ∈ A 1 ∪ A 2 we have v∈N (u) w((u, v)) ≤ w(u). The idea here is that if we increase the weight of the edge (u, v) by one, we mean that we merge a color that has type u in c 1 with a color that has type v in c 2 to produce a color class in G. The constraint we imposed therefore means that the total number of times we do this for color classes of type u cannot be higher than w(u), which is the number of colors that have this type. It is not hard to see that the total number of valid edge-weight assignments is at most (χ d + 1) (∆ * +1) 4 , since every edge must receive weight in {0, . . . , χ d } and there are at most (∆ * + 1) 4 edges. This is the step that dominates the running time of our algorithm.
For each of the enumerated assignments of G we can now calculate a signature S of a coloring of G. For each type (s, d) let E (s,d) ⊆ E be the set of edges of G whose endpoints merge into type (s, d). Let u i ∈ A i be the vertices corresponding to type (s, d). We have S((s, d)) = i=1,2 (w(u i ) − v∈N (ui) w(u i , v))+ e∈E (s,d) w(e). We now check that the signature we computed refers to a coloring with at most χ d colors, that is, if S((s, d)) ≤ χ d , where s ∈ {1, . . . , ∆ * + 1} and d ∈ {0, . . . , ∆ * }. In this case we set T (S) = 1. The observation that completes the proof is that for all valid colorings c of G with signature S such that the restriction of c to G 1 , G 2 has signatures S 1 , S 2 there must exist a weight assignment for which the above procedure finds the signature S. Hence, by examining all pairs of feasible signatures S 1 , S 2 we will discover all feasible signatures of G. 2

Algorithm for Few Colors
In this section we provide an algorithm that solves DEFECTIVE COLORING in polynomial time on cographs if χ d is bounded. The type of a color class i is defined in a similar manner as in the first paragraph of Section 5.1. Specifically, for a given coloring c, we define the type of color i as the pair of two integers (s i , d i ) where s i := min{|c −1 (i)|, ∆ * + 1} and d i is the maximum degree of G[c −1 (i)].
Note that s i ∈ {0, . . . , ∆ * + 1}. What changes in this section is the signature S of a coloring c which is now defined as a function S : {1, . . . , χ d } → {0, . . . , ∆ * + 1} × {0, . . . , ∆ * }, which takes as input a color class and returns its type. Once again, we will construct a dynamic programming a table T which given a signature S set T (S) = 1 if the current graph has a (χ d , ∆ * )-coloring with signature S. Our table will have size at most (∆ * + 2) 2χ d , since this is an upper bound on the number of possible signatures. As in the previous section, we shall describe how to compute table T of a graph G which is the union or the join of two graphs G 1 and G 2 whose tables T 1 and T 2 are known.
Theorem 16 There is an algorithm which, given a cograph G and integers Proof: The base case is when we have a single vertex u in the graph G. In this case, any coloring of u is valid, so for all i ∈ {1, . . . , χ d } we define a signature S i such that S i (i) = (1, 0) and S i (j) = (0, 0) when i = j. Last, T (S) = 1 if and only if S = S i for any i. Now, suppose that G is either the union or the join of two graphs G 1 , G 2 for which we have already calculated their corresponding tables. Once again we just need to consider all pairs of signatures S 1 , S 2 such that T 1 (S 1 ) = T 2 (S 2 ) = 1 and decide if we can have a coloring of G with signature S whose restrictions to G 1 , G 2 have signatures S 1 , S 2 . Let S 1 , S 2 be one such pair of signatures, for which S j (i) = (s i j , d i j ), j ∈ {1, 2}. We examine the cases of union and join separately. Let us start with the case that G is the union of G 1 , G 2 . Define S such that for any i, S(i) = (min{s i 1 + s i 2 , ∆ * + 1}, max{d i 1 , d i 2 }) and set T (S) = 1. The case where G is the join of G 1 , G 2 is a little more complicated since we first need to check if, given two precolored graphs the outcome of their join is valid, that for all colors i, the maximum degree of G[i] remains at most ∆ * . This corresponds to checking for all colors i whether d = max{s i 1 + d i 2 , s i 2 + d j 1 } ≤ ∆ * . Given that the above is true, we define S such that for any i, S(i) = (min{s i 1 + s i 2 , ∆ * + 1}, d) and set S(T ) = 1.
The algorithm considers all pairs of elements of T 1 , T 2 , so it runs in time dominated by

Sub-Exponential Time Algorithm
We now combine the algorithms of Sections 5.1 and 5.2 in order to obtain a sub-exponential time algorithm for cographs.
Theorem 17 DEFECTIVE COLORING can be solved in time n O n 4 /5 on cographs.
Proof: First, we remind the reader that, from Lemma 2, if ∆ * · χ d ≥ n then the answer is trivially yes. Thus the interesting case is when ∆ * · χ d < n. Note that we also trivially have that ∆ * , χ d ≤ n.
If ∆ * ≤ 5 √ n, then the algorithm of Section 5.1 runs in time.

Split and Chordal Graphs
In this section we present the following results: first, we show that DEFECTIVE COLORING is hard on split graphs even when ∆ * is a fixed constant, as long as ∆ * ≥ 1; the problem is of course in P if ∆ * = 0. Then, we show that DEFECTIVE COLORING is hard on split graphs even when χ d is a fixed constant, as long as χ d ≥ 2; the problem is of course trivial if χ d = 1. These results completely describe the complexity of the problem when one of the two relevant parameters is fixed. We then give a treewidthbased procedure through which we obtain a polynomial-time algorithm even on chordal graphs when χ d , ∆ * are bounded (in fact, the algorithm is FPT parameterized by χ d + ∆ * ). Hence these results give a complete picture of the complexity of the problem on chordal graphs: the problem is still hard when one of χ d , ∆ * is bounded, but becomes easy if both are bounded. Let us also remark that both of the reductions we present are linear. Hence, under the Exponential Time Hypothesis Impagliazzo et al. (2001), they establish not only NP-hardness, but also unsolvability in time 2 o(n) for DEFECTIVE COLORING on split graphs, for constant values of χ d or ∆ * . This is in contrast with the results of Section 5.3 on cographs.

Hardness for Bounded Deficiency
In this section we show that DEFECTIVE COLORING is NP-hard for any fixed value ∆ * ≥ 1. We will describe a reduction from 3CNFSAT which for any given ∆ * ≥ 1 produces an instance of DEFECTIVE COLORING that has a (2n, ∆ * )-coloring if the given formula is satisfiable. Suppose we are given a CNF formula φ where X = {x 1 , . . . , x n } are the variables and C = {c 1 , . . . , c m } are the clauses and each clause contains exactly 3 literals. We construct a graph G as follows: • For each i ∈ {1, . . . , n} we construct a set U i of 2∆ * + 2 vertices; we partition U i into two sets U A i , U D i , each of size ∆ * , and two single vertices • For each i ∈ {1, . . . , n} we construct a vertex z A i , a vertex z B i , and a vertex z D i .
• We turn the vertices of U into a clique.
• For each i ∈ {1, . . . , n} we connect • For each j ∈ {1, . . . , m} we connect v j to all of U except for the following: for each variable x i that appears in Observe that the graph G we have constructed is split as U is a clique and the remaining vertices are an independent set. We claim that this graph has a (2n, ∆ * )-coloring if and only if φ is satisfiable.
Proof: We first color U as follows: fix a satisfying assignment and consider the variable x i . If x i is set to True then we color U A i ∪ {u B i } with color 2i − 1 and U D i ∪ {u C i } with color 2i; otherwise we color Note that now every vertex of the clique U has deficiency exactly ∆ * and we have used all colors.
We assign to vertex z A i color 2i and to vertex z D i color 2i − 1. Observe that z A i is not connected to which are the only vertices which may have color 2i at this point, so its deficiency is 0 and it does not affect the deficiency of any other vertex. Similarly, z D i has deficiency 0. We assign to z B i the same color as u C i and this vertex also has deficiency 0. Finally, for each j ∈ {1, . . . , m} we consider the j-th clause of φ in order to color v j . Since the assignment is satisfying, this clause contains a true literal, say involving the variable x i . We assign to v j the color 2i − 1. If x i appears positive in clause c j then v j is not connected to U A i ∪ {u B i }, which are all the vertices that have color 2i − 1, so its deficiency is 0. The reasoning is similar if x i appears negative in c j . 2 Lemma 19 If G has a (2n, ∆ * )-coloring, then φ is satisfiable.
Proof: First, observe that U is a clique of size 2n(∆ * + 1), so the given coloring must use all colors in U , each ∆ * + 1 times. Furthermore, all vertices of U have deficiency exactly ∆ * already in U , so they cannot have any neighbors with the same color outside of U . Because of the previous arguments, the color used in z A i can only appear in U i inside the clique (as z A i is connected to the rest of U ) and must appear there ∆ * + 1 times. The same argument applies to z B i , z D i . Therefore, if two distinct colors are used for the vertices in z A i , z B i , z D i , these colors cover all of U i and are not used anywhere else in U . In this case we say that the coloring of U i is normal. Furthermore, it is impossible to use three distinct colors for z A i , z B i , z D i . Suppose that some U i has a coloring that is not normal. Then z A i , z B i , z D i must use the same color. This color appears ∆ * + 1 times in U but cannot appear in U \ U i . Furthermore, it cannot appear in a neighbor of z A i , z B i or z D i . It can therefore not appear in U A i (which is connected to z A i ), nor in U D i (which is connected to z D i ), nor in u B i (which is connected to z B i ). So the only vertex where it may appear is u C i , contradicting the assumption that this color is used ∆ * + 1 times in the clique. We conclude that all U i must have a normal coloring.
Since all U i have a normal coloring, the 2∆ * + 2 vertices of each U i are colored with two colors, each used ∆ * + 1 times. Suppose without loss of generality that for all i the set U i is colored with colors 2i − 1 and 2i and furthermore that 2i − 1 is used at least once in U A i . We claim that U A i must in fact be monochromatic and colored completely with 2i − 1. This is trivially true if ∆ * = 1; while when ∆ * ≥ 2 if U A i uses both colors 2i − 1 and 2i, then no color is available for z A i . We now obtain an assignment to φ as follows: we set x i to True if u B i has color 2i − 1; otherwise we set x i to False. We claim that this assignment satisfies φ. Consider the j-th clause and let r be its assigned color. Suppose r appears in the colors of U i , so r = 2i − 1 or r = 2i. It must be the case that r is not used in any of the neighbors of v j , therefore the variable x i appears in c j . Suppose r = 2i. Then, the color 2i cannot appear in U D i (which is connected to v j ), which implies that U A i ∪ U D i are colored fully with 2i − 1. This can only happen if ∆ * = 1, but in this case u B i , u C i are both colored 2i. Since one of them is connected to v j we have a contradiction. Therefore, v j must be colored with 2i − 1. If v j is not connected to u B i (so x i appears positive in c j ) then u C i , u D i have color 2i, which means that u B i has color 2i − 1 and our assignment satisfies the clause. Similarly, if v j is not connected to u C i (so x i appears negative in c j ), then u B i must have color 2i, so our assignment sets x i to False and satisfies c j . 2 The main theorem of this section follows from Lemmas 18 and 19.
Theorem 20 DEFECTIVE COLORING is NP-hard on split graphs for any fixed ∆ * ≥ 1.

Hardness for Bounded Number of Colors
Theorem 21 DEFECTIVE COLORING is NP-complete on split graphs for every fixed value of χ d ≥ 2.
Proof: We reduce from the problem 3-SET SPLITTING, which takes as input a set of elements U , called the universe, and a family F of subsets of U of size exactly 3, and asks whether there is a partition (U 1 , U 2 ) of U such that, for every set S ∈ F, we have S ∩ U 1 = ∅ and S ∩ U 2 = ∅. This problem is wellknown to be NP-complete Garey and Johnson (1979). Given an instance (U, F) of 3-SET SPLITTING and a positive integer χ d , we build a split graph We proceed by making all the vertices of C 1 ∪ C 2 pairwise adjacent. We then associate each set S of F with two vertices v 1 S and v 2 S of C 1 and C 2 respectively, and every element x of U with a vertex w x of I. For every pair x ∈ U, S ∈ F, we make w x adjacent to v 1 S and v 2 S if and only if x ∈ S. We complete our construction by making all the vertices of C i adjacent to all the vertices of Z i for i ∈ {1, 2}, and all the vertices of C * adjacent to every vertex in V . Observe that the graph we constructed is split, since C 1 ∪ C 2 ∪ C * induces a clique and I ∪ Z 1 ∪ Z 2 induces an independent set. We now claim that there exists a partition (U 1 , U 2 ) of U as described above if and only if G can be colored with at most χ d colors and deficiency at most ∆ * = |F| + 1.
For the forward direction, we color every vertex of C 1 ∪ Z 2 with color 1 and every vertex of C 2 ∪ Z 1 with color 2. For each w x ∈ I we color w x with 1 if x ∈ U 1 and with 2 if x ∈ U 2 . We color the vertices of C * equitably with the remaining χ d − 2 colors. This produces the desired coloring of G.
For the converse, we first prove the following: Claim 22 For any coloring of G with χ d colors and deficiency at most ∆ * , all the vertices of C 1 have the same color. Similarly, all the vertices of C 2 have the same color, and this color is distinct from that of the vertices of C 1 . Additionally, the remaining χ d − 2 colors are each used exactly ∆ * + 1 times in C * .
Proof: We first consider the colors given to the vertices of Z 1 and Z 2 . Observe that since both sets have size χ d · (|F| + 2) = χ d · (∆ * + 1), there is a color c 1 that appears at least ∆ * + 1 times in Z 1 and a color c 2 that appears at least ∆ * + 1 times in Z 2 . Since Z 1 ⊂ N (u) for every vertex u ∈ C 1 ∪ C * , we obtain that no vertex of C 1 ∪ C * uses color c 1 . Using a similar argument, we obtain that no vertex of C 2 ∪ C * uses color c 2 .
We will first prove that c 1 = c 2 . Indeed, suppose that c 1 = c 2 . Since this color c 1 does not appear in C 1 ∪ C 2 ∪ C * , we are left with χ d − 1 available colors for these sets, where |C 1 ∪ C 2 ∪ C * | = χ d · |F| + 2χ d − 4. To obtain a contradiction observe that at least one color class should have size at least > |F| + 2 for sufficiently large F, which is more than ∆ * + 1 vertices. The above implies that C * must be colored using at most χ d − 2 colors. Since C * is a clique of size exactly (χ d − 2) · (|F| + 2) = (χ d − 2) · (∆ * + 1), it follows that C * is colored using χ d − 2 colors, each of which are used exactly ∆ * + 1 times, as desired. Last, we conclude that vertices in C 1 should only be colored c 2 and similarly vertices of C 2 should receive color c 1 . 2 By the previous claim C 1 and C 2 are both monochromatic and use different colors. Without loss of generality suppose that C 1 is colored with color 1 and C 2 with color 2. Since every vertex of I is adjacent to every vertex of C * , we immediately obtain that I must be colored using only 1 or 2. It only remains to show that for every set S of F, there exist elements x, y ∈ S such that vertex w x is colored with color 1 and vertex w y is colored with color 2. Then, the coloring of I will give us a partition of U . Assume for contradiction that there exists a set S whose elements x, y and z all have the same color, say color 1. From the above claim, we know that v 1 S ∈ C 1 uses color 1 and is adjacent to the other ∆ * − 2 vertices of C 1 , all of which also use color 1. Therefore, v 1 S is adjacent to ∆ * − 2 + 3 vertices using color 1, and hence has deficiency ∆ * + 1, a contradiction. This concludes the proof. 2

A Dynamic Programming Algorithm
In this section we present an algorithm which solves the problem efficiently on chordal graphs when χ d and ∆ * are small. Our main tool is a treewidth-based procedure, as well as known connections between the maximum clique size and treewidth of chordal graphs.
Theorem 23 DEFECTIVE COLORING can be solved in time (χ d ∆ * ) O(tw) n O(1) on any graph G with n vertices if a tree decomposition of width tw of G is supplied with the input.
Proof: We describe a dynamic programming algorithm which uses standard techniques, and hence we sketch some of the details. Suppose that we are given a rooted nice tree decomposition of G (we use here the definition of nice tree decomposition given in Bodlaender and Koster (2008)). For every bag B of the decomposition we denote by B ↓ the set of vertices of G that appear in B and bags below it in the decomposition. For a coloring c : V → {1, . . . , χ d } we say that the partial type of a vertex u ∈ B is a pair consisting of c(u) and |c −1 (c(u)) ∩ N (u) ∩ B ↓ |. In words, the type of a vertex is its color and its deficiency in the graph induced by B ↓ . Clearly, if c is a valid coloring, any vertex can have at most χ d · (∆ * + 1) types. Hence, if we define the type of B as a tuple containing the types of its vertices, any bag can have one of at most (χ d · (∆ * + 1)) tw types. Our dynamic programming algorithm will now construct a table which for every bag B and every possible bag type decides if there is a coloring of B ↓ with the specified type for which all vertices of B ↓ \ B have deficiency at most ∆ * . The table is easy to construct for leaf bags and forget bags. For introduce bags we consider all possible colors of the new vertex, and for each color we appropriately compute its deficiency and update the deficiency of its neighbors in the bag, rejecting solutions where a vertex reaches deficiency ∆ * + 1. Finally, for join bags we consider any pair of partial solutions from the two children bags that agree on the colors of all vertices of the bag and compute the deficiency of each vertex as the sum of its deficiencies in the two solutions. 2 We now recall the following theorem connecting ω(G) and tw(G) for chordal graphs.
Together with Lemma 3 this gives the following algorithm for chordal graphs.
Proof: We use Theorem 24 to compute an optimal tree decomposition of the input graph and its maximum clique size. If ω(G) > χ d (∆ * + 1) then we can immediately reject by Lemma 3. Otherwise, we know that tw(G) ≤ χ d (∆ * + 1) from Theorem 24, so we apply the algorithm of Theorem 23. 2

Conclusions
Our results indicate that DEFECTIVE COLORING is significantly harder than GRAPH COLORING, even on classes where the latter is easily in P. Though we have completely characterized the complexity of the problem on split and chordal graphs, its tractability on interval and proper interval graphs remains an interesting open problem as already posed in Havet et al. (2009). Beyond this, the results of this paper point to several potential future directions. First, the algorithms we have given for cographs are both XP parameterized by χ d or ∆ * . Is it possible to obtain FPT algorithms? On a related question, is it possible to obtain a faster sub-exponential time algorithm for DEFECTIVE COLORING on cographs? Second, is it possible to find other natural classes of graphs, beyond trivially perfect graphs, which are structured enough to make DEFECTIVE COLORING tractable? Finally, in this paper we have not considered the question of approximation algorithms. Though in general DEFECTIVE COLORING is likely to be quite hard to approximate (as a consequence of the hardness of GRAPH COL-ORING), it seems promising to also investigate this question in classes where GRAPH COLORING is in P.