Reputation: 61
Can we colour a graph in 3 colours in polynomial time? I read that colouring a graph with 2
colours is easy,but colouring a graph with 3 different colours(No two vertices have the
same color) is np-hard.However,I wonder if there is a magic box that says 'yes' for 'A
graph being 3-colourable in polynomial time?'.If it says 'yes' how would it solve it in
polynomial time? Any Ideas ?
Upvotes: 1
Views: 7286
Reputation: 51053
@Peter de Rivaz's answer is probably the simplest one, and uses only O(nk) tests of the "magic box", where k is the number of colours (3 in this question). I was thinking about the problem myself and came up with an alternative solution which is a bit more complex, and uses O(n²) tests of the "magic box", but for the purpose of the proof, it works just as well:
This works because after the first stage, H is "edge maximal" in the sense that it is k-colorable but no edge can be added such that it will still be k-colorable. Any graph satisfying this property is necessarily the complement of a graph with at most k connected components, each of which is a complete graph.
Upvotes: 1
Reputation: 33509
Add 3 new vertices to your graph called red/green/blue, each connected to the other 2 but nothing else.
Then for each vertex in your graph:
At the end of this process you will have identified a colour for each vertex (the colour that it is not connected to).
This is O(N*magic) where magic is the complexity of your magic box.
Upvotes: 3