IntermediateAbout 25 min
Graph Coloring (Greedy)
Read the full article on Substack
7 min read.
Assign colors to vertices such that no two adjacent vertices share the same color. The greedy approach gives an upper bound on the chromatic number.
Think of it this way: Think of scheduling exams. No two exams can happen simultaneously if they share students. Assigning time slots is like coloring: adjacent nodes (shared students) need different colors (times).
Colour 6 nodes with 3 colours so no edge joins two nodes of the same colour.
1/14
Check your understanding
Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.
Greedy colouring
Sequence
Order the steps of the greedy colouring algorithm.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
- 1Drop a step here
- 2Drop a step here
- 3Drop a step here
- 4Drop a step here
- 5Drop a step here
5 pieces left to place
Quiz
20 questionsQuestion 1 of 20
Score: 0
What is the chromatic number of a graph?
Done with this lesson?
Sign in free to keep your progress, streak and quiz scores.