10.4 Graph Coloring, Chromatic Number Bounds & the Four Color Theorem
π‘ Core Intuition: The 3-Second Mental Modelβ
π³ The Everyday Analogy: Political Maps & University Exam Schedulingβ
Think of coloring as conflict-free resource scheduling:
- The Map Coloring Rule: You are a cartographer coloring a world map. Countries that share a common land border cannot be painted the same color (otherwise, you cannot tell where one country ends and the next begins). How many colors do you need?
- In 1976, mathematicians proved that you never need more than 4 colors for any flat map on Earth! (The Four Color Theorem).
- University Exam Scheduling (Register Allocation):
- Vertices: College courses.
- Edges: A student is enrolled in both courses (conflict!).
- Coloring: Time slots. Courses that conflict cannot share the same time slot. The Chromatic Number is the absolute minimum number of exam periods needed so no student has two exams at the same time!
- Brooks' Theorem: If every server in a network has at most 5 cables (), you can color the entire network using at most 5 colors, unless the network is literally an all-to-all complete clique () or an odd cycle!
π» Bridging to Computer Science: Compiler Register Allocation & Wireless Frequency Assignmentβ
In computer systems:
- Compiler Register Allocation (Chaitin's Algorithm): Variables whose lifetimes overlap cannot share the same physical CPU register. Compilers construct an interference graph and -color it to map hundreds of virtual variables to physical machine registers (e.g. 16 registers in x86-64).
- Cellular Tower Frequency Assignment: Adjacent cellular cell towers cannot broadcast on the same radio frequency without radio interference. determines the minimum radio spectrum license required.
- Pattern Matching & Sudoku: A Sudoku board is a 9-coloring of a 729-edge 81-vertex graph!
πTable of Contents
π¨ Proper Vertex Coloring & Chromatic Numbersβ
- Proper Vertex Coloring: An assignment of colors (or labels ) to the vertices of a graph such that no two adjacent vertices share the same color:
- -Colorable: A graph is -colorable if there exists a valid proper vertex coloring using at most colors.
- Chromatic Number (): The minimum number of colors required for a proper vertex coloring of : A graph with is said to be -chromatic.
Chromatic Numbers of Standard Graph Families
Exact chromatic values across canonical symmetric graph topologies
Null Graph (No Edges)
Independent Set- E = β : No two vertices are adjacent.
- Every vertex can be colored with the exact same color.
- Ο(G) = 1.
Trees & Bipartite Graphs
2-Colorable- Every tree (with |V| β₯ 2) is bipartite.
- Bipartite graphs have no odd cycles.
- Ο(Tree) = 2, Ο(K_{m, n}) = 2.
Complete Graph (Kβ)
All-to-All Clique- Every pair of vertices is connected by an edge.
- Every vertex requires a completely unique color.
- Ο(Kβ) = n.
Cycle Graph (Cβ)
Even vs Odd Parity- If n is EVEN (e.g. Cβ, Cβ): Ο(Cβ) = 2.
- If n is ODD (e.g. Cβ, Cβ ): Ο(Cβ) = 3 (odd cycle requires 3rd color).
Wheel Graph (Wβ)
Hub + Rim Cβ- Central hub connects to all rim vertices (requires unique color).
- If rim n is EVEN: Ο(Wβ) = 2 (rim) + 1 (hub) = 3.
- If rim n is ODD: Ο(Wβ) = 3 (rim) + 1 (hub) = 4.
βοΈ Theoretical Bounds on Chromatic Numbersβ
For any simple graph :
- Clique Lower Bound: where is the clique number (the number of vertices in the largest complete subgraph contained in ).
- Independence Lower Bound: where is the independence number (the size of the largest independent set in ). Each color class forms an independent set with at most vertices.
- Greedy Upper Bound: where is the maximum vertex degree in . In any greedy coloring, a vertex has at most neighbors, which leaves at least one color free among colors.
For any connected undirected graph :
unless is:
- A Complete Graph (, where ), or
- An Odd Cycle (, where ).
For all other graphs, the chromatic number is strictly bounded by the maximum degree !
πΊοΈ The Four Color Theorem for Planar Graphsβ
Every planar graph is 4-colorable:
- First major mathematical theorem proven with substantial computer verification: Kenneth Appel and Wolfgang Haken reduced all possible planar graphs to 1,936 reducible configurations, verifying each on an IBM 360 mainframe.
- Immediate Geographic Corollary: Any political map drawn on a flat surface or sphere can be colored using at most 4 colors such that no two adjacent territories share the same color.
The Five Color Theorem (Heawood, 1890): A simple pencil-and-paper proof exists showing that every planar graph is 5-colorable (), using Euler's formula invariant that every planar graph has at least one vertex with , followed by Kempe chain color swapping.
βοΈ Edge Coloring & Vizing's Theoremβ
- Proper Edge Coloring: An assignment of colors to the edges of such that no two incident edges share the same color.
- Chromatic Index (): The minimum number of colors needed for a proper edge coloring of .
For any simple undirected graph , the chromatic index satisfies:
Every simple graph falls into one of only two classes:
- Class 1: (e.g. all bipartite graphs, by KΕnig's Line Coloring Theorem).
- Class 2: (e.g. odd cycles , complete graphs ).
β‘ The Welsh-Powell Greedy Coloring Algorithmβ
The Welsh-Powell Algorithm provides an efficient heuristic to find near-optimal vertex colorings in time:
The 4-Step Welsh-Powell Greedy Coloring Algorithm
Systematic degree-ordered procedure to color graphs with minimal colors
Sort Vertices by Descending Degree
OrderingList all vertices in non-increasing order of their degrees: deg(vβ) β₯ deg(vβ) β₯ ... β₯ deg(vβ).
Assign Current Color c to First Uncolored Vertex
AnchorPick the highest-degree uncolored vertex v and assign it the current color c (e.g. Color 1).
Greedily Propagate Color c to Non-Adjacent Vertices
Greedy SweepScan down the sorted list. Assign color c to each uncolored vertex that is NOT adjacent to ANY vertex already painted with color c.
Advance to Next Color & Repeat
Next ColorPick a new color (c + 1) and repeat from the top uncolored vertex until every vertex is colored.
π Step-by-Step Worked Examplesβ
Example 1: Finding Chromatic Numbers of Cycle and Wheel Graphsβ
Problem Statement: Determine the chromatic number for:
- Cycle graph (Pentagon).
- Cycle graph (Hexagon).
- Wheel graph (Hub connected to ).
- Wheel graph (Hub connected to ).
Step-by-Step Solution:
-
Cycle (Odd Cycle)
- Number of vertices (odd).
- If we alternate colors
Red, Blue, Red, Blue, the 5th vertex is adjacent to both the 4th vertex (Blue) and the 1st vertex (Red). - A 3rd color (
Green) is mandatory! - .
-
Cycle (Even Cycle)
- Number of vertices (even).
- Alternating colors
Red, Blue, Red, Blue, Red, Bluecleanly colors the cycle with zero conflicts. - It is bipartite!
- .
-
Wheel (Hub + )
- The rim is , which requires colors.
- The central hub vertex connects to every single vertex on the rim.
- Therefore, the hub cannot share any color used by the rim, requiring an additional 4th color!
- .
- .
-
Wheel (Hub + )
- The rim is , which requires colors.
- The central hub requires a unique 3rd color.
- .
- .
Key Takeaway: Wheel graphs alternate chromatic numbers based on rim parity: odd rims require 4 colors, while even rims require 3 colors.
Example 2: University Exam Scheduling via Graph Coloringβ
Problem Statement: Five university courses () have overlapping student enrollments. Conflicting courses that share students cannot have exams at the same time:
- Course conflicts with .
- Course conflicts with .
- Course conflicts with .
- Course conflicts with .
- Course conflicts with .
What is the minimum number of exam time slots required?
Step-by-Step Solution:
-
Step 1: Model as a Graph
- Vertices: .
- Vertex degrees:
- (connected to )
- (connected to )
- (connected to )
- (connected to )
- (connected to )
-
Step 2: Identify Cliques
- Vertices are all mutually adjacent: forms a triangle ().
- Are there any 4-cliques ()?
- Test : Is connected to ? No edge exists between and !
- Test : Is connected to ? No edge exists between and !
- Max clique size .
-
Step 3: Apply Welsh-Powell Coloring
- Sorted vertices by degree: .
- Color 1 (Time Slot 1):
- Assign Color 1 to highest-degree vertex: .
- Look for non-neighbors of : connects to all other 4 vertices! No other vertex can take Color 1.
- Color 1: .
- Color 2 (Time Slot 2):
- Pick next uncolored vertex: . Assign Color 2 to .
- Check non-neighbors of : is not connected to . Assign Color 2 to .
- (Check if can share Color 2: is not adjacent to . Valid!).
- Color 2: .
- Color 3 (Time Slot 3):
- Remaining uncolored vertices: .
- Pick . Assign Color 3 to .
- Check non-neighbors of : is not connected to . Assign Color 3 to .
- Color 3: .
- All vertices are successfully colored using 3 colors!
-
Step 4: Conclusion
- Since , .
- Since we found a valid 3-coloring (), the chromatic number is exactly:
- Exactly 3 exam time slots are required.
Key Takeaway: Graph coloring models real-world conflict resolution by partitioning vertices into independent, conflict-free time slots.
π― Exam & Interview Pitfall Checkβ
Question 1: If a graph has no triangles (), can its chromatic number still be arbitrarily large? Key Focus Points: Yes! This was Jan Mycielski's famous discovery (1955). The Mycielski construction produces triangle-free graphs with chromatic numbers 3, 4, 5, 6, ..., and arbitrarily high! For example, the GrΓΆtzsch graph has 11 vertices, has NO triangles, yet has . Having no triangles does NOT bound the chromatic number!
Question 2: Does the Four Color Theorem apply to graphs drawn on a torus (a donut shape)? Key Focus Points: No! The Four Color Theorem applies strictly to planar surfaces and spheres (genus 0). On a torus (genus 1), you can draw complete graph with zero edge crossings! By the Heawood conjecture, coloring maps on a torus requires up to 7 colors!
Trap 1: Assuming always holds Why it fails: (clique number) is only a lower bound. For odd cycle , the largest clique is an edge (, so ), but . Never assume chromatic number equals the size of the largest complete subgraph!
Trap 2: Believing Brooks' Theorem applies to and odd cycles Why it fails: Complete graphs and odd cycles are the exact two exceptions to Brooks' Theorem where . For all other connected graphs, .