It models conflict
Exam scheduling, register allocation, frequency assignment. An edge means "cannot share", and a colour is a resource.
The chromatic number is the fewest colours needed. Two colours is a linear test, three is NP-complete, and the four-colour theorem says planar graphs never need more than four.
Core ideas
Colouring models conflict: adjacent things cannot share a resource, and the chromatic number is how many resources are needed.
Exam scheduling, register allocation, frequency assignment. An edge means "cannot share", and a colour is a resource.
It never uses more than Δ + 1 colours, and the visiting order can cost it colours it did not need.
χ ≤ 2 is one search; χ ≤ 3 is NP-complete. The boundary between easy and hard is exactly there.
The material
The definition, bounds, the greedy algorithm, and the four-colour theorem.
A proper colouring assigns a colour to each vertex so that adjacent vertices differ. The chromatic number χ(G) is the smallest number of colours admitting one.
χ(G) ≤ 2 if and only if G is bipartite, if and only if G has no odd cycle. Testable in Θ(n + |E|) by “Bipartite Graphs”.
Colouring the vertices in any order, giving each the smallest colour unused by its already-coloured neighbours, uses at most Δ + 1 colours, where Δ is the maximum degree.
When a vertex is coloured, it has at most Δ neighbours, so at most Δ colours are forbidden. Among Δ + 1 colours one is always available.
□
Brooks's theorem sharpens this: χ(G) ≤ Δ unless G is a complete graph or an odd cycle, which are the two families needing Δ + 1.
Greedy is not optimal, and the order is what costs it. On a bipartite graph a bad order can use many colours where two suffice, which is why the algorithm is a bound rather than a solution.
Deciding whether χ(G) ≤ 3 is NP-complete, and computing χ(G) exactly is NP-hard. Even approximating it well is hard.
The jump from 2 to 3 is the sharpest example on this path of a problem changing character with a parameter. Nothing in the statements suggests it, and “P, NP and NP-Completeness” in Algorithms and Complexity explains what NP-complete means.
Every planar graph has χ(G) ≤ 4.
Conjectured in 1852 and proved by Appel and Haken in 1976, with a proof that reduced the problem to 1936 configurations and checked them by computer. It was the first major theorem whose proof could not be verified by a human reading it, and the resulting argument about what counts as a proof has not entirely settled.
The five-colour theorem, by contrast, has a short human proof by induction using Euler's formula from “Planar Graphs and Euler's Formula”. Four is genuinely harder than five.
Interactive
Your graph, the course's algorithms
Method
Bound first, then colour.
A Kₖ inside G forces χ ≥ k. This is the standard lower bound and it is often tight.
If the graph is bipartite, χ = 2 and you are finished. One search.
At most Δ + 1 colours. Trying several vertex orders often reduces it.
If the clique lower bound meets the greedy upper bound, that value is χ. Otherwise exact computation is expensive.
Five exams; edges join exams with a student in common.
The triangle gave the lower bound and greedy gave the upper, and they met — which is the only cheap way to be certain. Without a matching lower bound, greedy's answer is an upper bound and nothing more.
For a graph of your own, find the largest complete subgraph you can and run greedy. If the two numbers meet you have χ exactly; if not, you have located the difficulty.
Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.
No recommendations yet for this lesson.