Colouring: the fewest colours that keep neighbours apart
Decide whether a described colouring is proper. The idea in plain words, a worked example, and a check with the answers shown — part of the free Quantitative Reasoning guides.
A colouring of a graph assigns a colour to every vertex so that no edge joins two vertices of the same colour. Such a colouring is proper.
| | | | |---|---|---| | T | T | T |
The number that matters is the chromatic number: the fewest colours a proper colouring needs.
- - An edgeless graph needs 1.
- - A bipartite graph needs 2 (next lesson).
- - A triangle needs 3.
- - needs.
The origin is map colouring: countries are vertices, shared borders are edges, and a proper colouring is a set of colours that never puts the same one on two countries sharing a border. The four-colour theorem says every PLANAR graph — every graph that can be drawn with no crossing edges — needs at most 4.
Computing the chromatic number in general is hard, but on the small graphs in this course it is settled by trying 2 colours, then 3, and stopping at the first that works.
It is the smallest number of resources that makes a conflict-free assignment possible. Colour a radio network's transmitters with frequencies, and the chromatic number is the fewest frequencies that avoid interference. Colour a timetable's exams with time slots, and it is the fewest slots that avoid clashes for students taking both.
Two facts make it tractable in practice. First, a GREEDY colouring — take the vertices in any order, give each the smallest colour not used by its already-coloured neighbours — never uses more than colours, where is the maximum degree. That is a bound, not the answer, but it is a guarantee and it is instant. Second, the chromatic number is at least the size of the largest complete subgraph, since the vertices of all need different colours. Bounds from both sides, which is often enough.
What makes it hard in general is that those bounds can be far apart, and deciding whether 3 colours suffice is NP-complete. The small graphs here are settled by trying each in turn.
*,. Find the chromatic number.**
Step one — is 1 colour possible? No: the graph has edges, and one colour would put the same colour on both ends of every edge.
Step two — is 2 possible? Try: 1 red, 2 blue, 3 red — but is an edge, so 3 cannot be red. Try 3 blue instead — but is an edge, so 3 cannot be blue either. Both colours are used by 3's neighbours, so two colours fail. The triangle 1–2–3 is why: three mutually adjacent vertices need three colours.
Step three — is 3 possible? 1 red, 2 blue, 3 green, 4 red, 5 blue. Check each edge: differs, differs, differs, differs, differs, differs. A proper 3-colouring exists.
Answer.. Lower bound from the triangle, upper bound from the explicit colouring — the two meet, which is what settles it.
- Decide whether a described colouring is proper
- Find the chromatic number of a small graph by trying each k
- Use a triangle as a lower bound and an explicit colouring as an upper bound
- 1. What is the chromatic number of a triangle?
- 2. What is the chromatic number of a 4-cycle?
- 3. Why does a graph containing a triangle need at least 3 colours?
Answers
1. 3 — every pair is adjacent, so all three differ. 2. 2 — colour alternately around the cycle. 3. The triangle's three vertices are mutually adjacent, so no two of them may share a colour, and three vertices with three different colours need three.