Graph Coloring
Concepts & Applications
Learn how to assign colors to vertices so that no two adjacent vertices share the same color, and discover why this idea powers scheduling, map coloring, and register allocation.
What Is Graph Coloring?
A graph coloring is an assignment of labels (called "colors") to each vertex of a graph such that no two adjacent vertices share the same color. Adjacent means they are connected by an edge.
Key Terminology
Why Does It Matter?
Graph coloring is not just abstract: it models real-world constraint satisfaction. Any time you must assign resources so that conflicting items differ, you are solving a coloring problem.
The Chromatic Number \( \chi(G) \)
The chromatic number \( \chi(G) \) is the central quantity of interest. It answers: what is the fewest colors needed for a proper coloring of \( G \)?
The Four Color Theorem
Every planar graph (a graph that can be drawn in the plane without edge crossings) can be properly colored with at most 4 colors.
Bounds on \( \chi(G) \)
Bipartite vs Non-Bipartite
| Bipartite | Non-Bipartite | |
|---|---|---|
| Odd cycles? | None | Contains at least one |
| Chromatic number | \( \chi = 2 \) | \( \chi \geq 3 \) |
| 2-colorable? | Yes | No |
The Greedy Coloring Algorithm
The greedy algorithm provides a simple, constructive way to color any graph. It does not always use the fewest colors, but guarantees at most \( \Delta(G) + 1 \).
Example: Greedy on a Path Graph
Example: Coloring \( K_4 \)
Example: The Wheel Graph \( W_5 \)
The Chromatic Polynomial
The chromatic polynomial \( P(G, k) \) counts the number of proper \( k \)-colorings of \( G \). It is always a polynomial in \( k \).
Deletion-Contraction Method
To compute \( P(G, k) \) for any graph, pick any edge \( e = \{u, v\} \) and apply:
Common Mistakes
Summary of Key Graphs
| Graph Family | \( \chi(G) \) | Key Property |
|---|---|---|
| Complete \( K_n \) | \( n \) | Every vertex adjacent to all others |
| Even cycle \( C_{2m} \) | \( 2 \) | Bipartite: no odd cycles |
| Odd cycle \( C_{2m+1} \) | \( 3 \) | Odd cycle forces a third color |
| Tree / Forest | \( 2 \) | Bipartite: acyclic connected |
| Wheel \( W_n \) | \( 3 \) or \( 4 \) | Hub + cycle rim; depends on rim parity |
| Planar graph | \( \leq 4 \) | Four Color Theorem |
Question 1 of 5
What is the chromatic number of the complete graph \( K_5 \)?
Question 2 of 5
A graph \( G \) is bipartite. What can you conclude about \( \chi(G) \)?
Question 3 of 5
According to Brooks' Theorem, if \( G \) is a connected graph that is neither a complete graph nor an odd cycle, what is an upper bound on \( \chi(G) \)?
Question 4 of 5
The chromatic polynomial of a tree on \( n \) vertices is \( P(T, k) = \):
Question 5 of 5
In the deletion-contraction formula, \( P(G, k) = P(G - e, k) - P(G/e, k) \). What does \( G/e \) represent?