Take the 2-minute tour ×
MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

It'll be great to get a pointer or answer to the following question:

What is the complexity of the following problem? Given an unweighted and undirected graph, can we have a proper (not necessarily minimal) vertex coloring of the graph in which each color is used at least twice?

share|improve this question
You will have to be more specific. It is not always possible to have a proper (vertex?) colouring of a graph of this sort: for instance, consider the 3-colouring of the 5-cycle. –  Niel de Beaudrap Jul 8 '10 at 9:08
Yes, I know, there may not be a proper vertex coloring (where each color is used at least twice) for a given graph. The question is that what is the complexity of checking this? –  Muse Jul 8 '10 at 9:25
Ah, sorry. Somehow I thought the question was how difficult it is to construct one (which obviously would help to answer your question). –  Niel de Beaudrap Jul 8 '10 at 11:42
add comment

6 Answers

This is NOW a complete answer. We can suppose that each color appears at most three times. Take the complement of the graph. Your question becomes equivalent to decide whether this graph has a perfect matching*, where we also allow triples (K_3) to be matched together. This problem WAS studied before:

Muse's answer gives a paper that has a reference to this paper that shows that this problem is in P, see the abstract or Lemma 1 and after:

P. Hell and D. G. Kirkpatrick: Packings by cliques and by finite families of graphs

Update: Ryan found an older paper proving the necessary result:

G. Cornuéjols, D. Hartvigsen, and W. Pulleyblank: Packing subgraphs in a graph

share|improve this answer
+1 for the statement "it is not hard to show that it is in P. Or NP-complete..." –  Rune Jul 8 '10 at 22:28
If the graph has a perfect matching, then this suffices to yield a solution; but the original problem is not equivalent to whether the complement has a perfect matching. Again, consider the 5-cycle. --- More generally, it suffices for the complement to be covered by a vertex-disjoint collection of cliques, where each clique has size at least 2; a perfect matching is a special case. –  Niel de Beaudrap Jul 9 '10 at 13:08
That is why I wrote matching* and not matching - I said that we also allow K_3's to be matched together. It is unnecessary to allow bigger cliques. I don't get what you are trying to say with the 5-cycle. –  domotorp Jul 9 '10 at 13:37
A 5-cycle is it's own complement, and contains neither a perfect-matching, nor a perfect-matching-asterisk. Thus, the 5-cycle is a graph for which your reduction does not work. –  Niel de Beaudrap Jul 12 '10 at 13:01
I think that the 5-cycle is just a graph for which the answer is NO. As it contains no matching*, it does not have a coloring which each colorclass having size at least two. –  domotorp Jul 12 '10 at 19:51
add comment

I think I have found the answer. The problem is easy and the reference is the following paper:


(The coloring problem is first phrased in terms of cliques in the complement graph)

share|improve this answer
@unknown: The paper is "Approximation algorithms and hardness results for the clique packing problem." Could you explain how the results in the paper address the posed question? The paper contains many results, and they are not phrased in the same terms as the posed problem. –  Joseph O'Rourke Jul 9 '10 at 10:11
see my answer for the connection –  domotorp Jul 9 '10 at 13:39
The coloring problem equivalent to partitioning the graph into cliques of size at least 2. This problem is quoted as polynomial-tim solvable in portal.acm.org/citation.cfm?id=1518279 . I refer to the 2nd paragraph in the introduction where it is stated that checking whether a graph can be packed by K_2, K_3,....K_n can be checked efficiently. 'Hell and Kirkpatrick [3] showed that this problem is NP-hard when F contains only complete graphs with at least three vertices, and it is polynomially solvable when F = {K2, . . . , Kr}, r > 2. –  Muse Jul 9 '10 at 14:07
@Muse & domotorp: Thanks for the clarifications! –  Joseph O'Rourke Jul 9 '10 at 14:35
add comment

I think domotorp is correct; let me clarify his answer a bit.

Note if any color appears four times or more, we can "split" it into two colors and still use each color at least twice. Finding a proper coloring is equivalent to partitioning the node set into disjoint independent sets (each part is a color class). Hence when we take the complement of the graph, we are seeking a partition of the node set into disjoint cliques. As we may assume each of these cliques have at most three nodes, the problem becomes: pack edges and triangles in a graph such that all nodes are covered. Not only is this problem in P, but the version where we have to maximize the number of nodes covered is also in P. That is proved here:

G. Cornuéjols, D. Hartvigsen, and W. Pulleyblank. Packing subgraphs in a graph. Operations Research Letters, Volume 1, Issue 4, September 1982, Pages 139-143

share|improve this answer
add comment

A simple observation: if the maximum degree Δ is at most n/2 − 1, then there exists an equitable colouring with at most Δ + 1 = n/2 colours, and each colour class has to contain at least two nodes.

share|improve this answer
nice observation...not sure what the complexity is if the degree is more than n/2. –  Muse Jul 8 '10 at 14:24
add comment

Some thoughts.

I like the idea of inverting the graph. I think the problem can be converted, to coloring the (inverted) graph for which each color appears exactly twice, or just once but then only on selected vertices (a joker vertex).

If the original inverted graph contains a 3-clique, then one of the vertices of the clique can be selected and be allowed (but not necessarily) to be colored with a color not appearing anywhere else in the graph. You can repeat this step, until the graph does not contain any 3-clique anymore, that does not have a selected vertex. I think it is not difficult to prove that a coloring in the converted problem can be used to construct a coloring in the original problem and vice versa.

With the converted problem, you eliminate any vertex that has 1 or 2 edges. In case of 1 edge, you remove the vertex and its neighbor. In case of 2 edges, you contract. By contraction, you can create a new 3-clique. However, in the converted problem, you are not allowed to color that with one color (that is why the conversion is necessary, because it allows the contraction).

A cycle with an odd number of vertices, will end up in a single vertex, in which it becomes clear that a coloring is not possible. But not all impossible colorings will end up like that.

Finally, you can do a BFS. For the search-border, you have a set of possibilities. Each element of the set, specifies for every vertex on the border, whether it needs another vertex of the same color or not. You want the keep the search border small.

It might be NPC. For that, consider the vertices on the search-border as propositional variables and prove that any propositional expression can expressed as such graph (I don't know if that is possible).


share|improve this answer
add comment

It is NP-hard, since you can reduce the standard graph coloring problem to this problem by adding a sufficient number of degree-0 vertices.

share|improve this answer
But there's no requirement for minimality here. –  rgrig Jul 8 '10 at 9:53
Yes, we don't need to use the minimum number of colors. So it does not follow from the first response that the problem is NP-hard –  Muse Jul 8 '10 at 10:12
Is it true that "if there is a good coloring then any minimum coloring is good"? (where 'good coloring' = 'proper vertex coloring with no solitary color' as required in the question) –  rgrig Jul 8 '10 at 14:13
It is not obvious...maybe it is true...not sure. –  Muse Jul 8 '10 at 14:23
No, it's false: consider a star plus an isolated vertex. There are two distinct minimal colorings; in one of them, the center vertex of the star is the only vertex of its color. –  JBL Jul 8 '10 at 15:55
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.