Skip to main content

10.4 Graph Coloring, Chromatic Number Bounds & the Four Color Theorem

πŸ“šModule 10: Advanced Graph Theory: Trees, Planarity & ColoringTopic 10.4: Coloring & Chromatic Numbers⏱️5 min read
🎯High-Yield For:Semester Exams β€’ GATE CSE β€’ Technical Interviews

πŸ’‘ Core Intuition: The 3-Second Mental Model​

🍳 The Everyday Analogy: Political Maps & University Exam Scheduling​

Think of coloring as conflict-free resource scheduling:

  1. 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).
  2. 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 Ο‡(G)\chi(G) is the absolute minimum number of exam periods needed so no student has two exams at the same time!
  3. Brooks' Theorem: If every server in a network has at most 5 cables (Ξ”=5\Delta = 5), you can color the entire network using at most 5 colors, unless the network is literally an all-to-all complete clique (K6K_6) 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 kk-color it to map hundreds of virtual variables to kk 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. Ο‡(G)\chi(G) determines the minimum radio spectrum license required.
  • Pattern Matching & Sudoku: A Sudoku board is a 9-coloring of a 729-edge 81-vertex graph!

🎨 Proper Vertex Coloring & Chromatic Numbers​

πŸ“–Definition 10.6: Proper Vertex Coloring & Chromatic Numberdefinition
  1. Proper Vertex Coloring: An assignment of colors (or labels {1,2,…,k}\{1, 2, \dots, k\}) to the vertices of a graph G=(V,E)G = (V, E) such that no two adjacent vertices share the same color: {u,v}∈Eβ€…β€ŠβŸΉβ€…β€Šc(u)β‰ c(v)\{u, v\} \in E \implies c(u) \neq c(v)
  2. kk-Colorable: A graph is kk-colorable if there exists a valid proper vertex coloring using at most kk colors.
  3. Chromatic Number (Ο‡(G)\chi(G)): The minimum number of colors required for a proper vertex coloring of GG: Ο‡(G)=min⁑{k∣GΒ isΒ k-colorable}\chi(G) = \min \{ k \mid G \text{ is } k\text{-colorable} \} A graph with Ο‡(G)=k\chi(G) = k is said to be kk-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.
βœ“ Wheel Chromatic Parity Theorem: Ο‡(Wβ‚™) = 3 (if n is odd rim) vs 4 (if n is even rim)Wβ‚…: Even Wheel (Rim Cβ‚… Odd) βž” Ο‡ = 4W₆: Odd Wheel (Rim C₆ Even) βž” Ο‡ = 3HubColor 41Blue (1)2Green (2)3Blue (1)4Green (2)5Violet (3)HubColor 31Blue (1)2Green (2)3Blue (1)4Green (2)5Blue (1)6Green (2)
Odd-cycle rim Cβ‚… requires 3 colors + 1 hub = 4 colors (Ο‡(Wβ‚…)=4); Even-cycle rim C₆ requires 2 colors + 1 hub = 3 colors (Ο‡(W₆)=3).

βš–οΈ Theoretical Bounds on Chromatic Numbers​

πŸ“Theorem 10.12: Lower and Upper Bounds on Chromatic Numberstheorem

For any simple graph GG:

  1. Clique Lower Bound: Ο‡(G)β‰₯Ο‰(G)\chi(G) \ge \omega(G) where Ο‰(G)\omega(G) is the clique number (the number of vertices in the largest complete subgraph KkK_k contained in GG).
  2. Independence Lower Bound: Ο‡(G)β‰₯∣V∣α(G)\chi(G) \ge \frac{|V|}{\alpha(G)} where Ξ±(G)\alpha(G) is the independence number (the size of the largest independent set in GG). Each color class forms an independent set with at most Ξ±(G)\alpha(G) vertices.
  3. Greedy Upper Bound: Ο‡(G)≀Δ(G)+1\chi(G) \le \Delta(G) + 1 where Ξ”(G)\Delta(G) is the maximum vertex degree in GG. In any greedy coloring, a vertex has at most Ξ”(G)\Delta(G) neighbors, which leaves at least one color free among Ξ”(G)+1\Delta(G) + 1 colors.
πŸ“Theorem 10.13: Brooks' Theorem (1941)theorem

For any connected undirected graph GG:

Ο‡(G)≀Δ(G)\chi(G) \le \Delta(G)

unless GG is:

  1. A Complete Graph (KnK_n, where Ο‡(Kn)=Ξ”+1=n\chi(K_n) = \Delta + 1 = n), or
  2. An Odd Cycle (C2k+1C_{2k+1}, where Ο‡=3=Ξ”+1\chi = 3 = \Delta + 1).

For all other graphs, the chromatic number is strictly bounded by the maximum degree Ξ”(G)\Delta(G)!


πŸ—ΊοΈ The Four Color Theorem for Planar Graphs​

πŸ“Theorem 10.14: The Four Color Theorem (Appel & Haken, 1976)theorem

Every planar graph is 4-colorable:

Ο‡(G)≀4(forΒ allΒ planarΒ graphsΒ G)\chi(G) \le 4 \quad (\text{for all planar graphs } G)
  • 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 (Ο‡(G)≀5\chi(G) \le 5), using Euler's formula invariant that every planar graph has at least one vertex with deg⁑(v)≀5\deg(v) \le 5, followed by Kempe chain color swapping.


βœ‚οΈ Edge Coloring & Vizing's Theorem​

πŸ“–Definition 10.7: Edge Coloring & Chromatic Indexdefinition
  1. Proper Edge Coloring: An assignment of colors to the edges of GG such that no two incident edges share the same color.
  2. Chromatic Index (Ο‡β€²(G)\chi'(G)): The minimum number of colors needed for a proper edge coloring of GG.
πŸ“Theorem 10.15: Vizing's Theorem (1964)theorem

For any simple undirected graph GG, the chromatic index Ο‡β€²(G)\chi'(G) satisfies:

Ξ”(G)≀χ′(G)≀Δ(G)+1\Delta(G) \le \chi'(G) \le \Delta(G) + 1

Every simple graph falls into one of only two classes:

  • Class 1: Ο‡β€²(G)=Ξ”(G)\chi'(G) = \Delta(G) (e.g. all bipartite graphs, by KΕ‘nig's Line Coloring Theorem).
  • Class 2: Ο‡β€²(G)=Ξ”(G)+1\chi'(G) = \Delta(G) + 1 (e.g. odd cycles C2k+1C_{2k+1}, complete graphs K2k+1K_{2k+1}).

⚑ The Welsh-Powell Greedy Coloring Algorithm​

The Welsh-Powell Algorithm provides an efficient heuristic to find near-optimal vertex colorings in O(V2)O(V^2) time:

The 4-Step Welsh-Powell Greedy Coloring Algorithm

Systematic degree-ordered procedure to color graphs with minimal colors

1

Sort Vertices by Descending Degree

Ordering

List all vertices in non-increasing order of their degrees: deg(v₁) β‰₯ deg(vβ‚‚) β‰₯ ... β‰₯ deg(vβ‚™).

2

Assign Current Color c to First Uncolored Vertex

Anchor

Pick the highest-degree uncolored vertex v and assign it the current color c (e.g. Color 1).

3

Greedily Propagate Color c to Non-Adjacent Vertices

Greedy Sweep

Scan down the sorted list. Assign color c to each uncolored vertex that is NOT adjacent to ANY vertex already painted with color c.

4

Advance to Next Color & Repeat

Next Color

Pick 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 Ο‡(G)\chi(G) for:

  1. Cycle graph C5C_5 (Pentagon).
  2. Cycle graph C6C_6 (Hexagon).
  3. Wheel graph W5W_5 (Hub connected to C5C_5).
  4. Wheel graph W6W_6 (Hub connected to C6C_6).

Step-by-Step Solution:

  1. Cycle C5C_5 (Odd Cycle)

    • Number of vertices n=5n = 5 (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!
    • Ο‡(C5)=3\chi(C_5) = 3.
  2. Cycle C6C_6 (Even Cycle)

    • Number of vertices n=6n = 6 (even).
    • Alternating colors Red, Blue, Red, Blue, Red, Blue cleanly colors the cycle with zero conflicts.
    • It is bipartite!
    • Ο‡(C6)=2\chi(C_6) = 2.
  3. Wheel W5W_5 (Hub + C5C_5)

    • The rim is C5C_5, which requires Ο‡(C5)=3\chi(C_5) = 3 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!
    • Ο‡(W5)=3+1=4\chi(W_5) = 3 + 1 = 4.
    • Ο‡(W5)=4\chi(W_5) = 4.
  4. Wheel W6W_6 (Hub + C6C_6)

    • The rim is C6C_6, which requires Ο‡(C6)=2\chi(C_6) = 2 colors.
    • The central hub requires a unique 3rd color.
    • Ο‡(W6)=2+1=3\chi(W_6) = 2 + 1 = 3.
    • Ο‡(W6)=3\chi(W_6) = 3.

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 (A,B,C,D,EA, B, C, D, E) have overlapping student enrollments. Conflicting courses that share students cannot have exams at the same time:

  • Course AA conflicts with B,C,DB, C, D.
  • Course BB conflicts with A,C,EA, C, E.
  • Course CC conflicts with A,B,D,EA, B, D, E.
  • Course DD conflicts with A,C,EA, C, E.
  • Course EE conflicts with B,C,DB, C, D.

What is the minimum number of exam time slots required?

Step-by-Step Solution:

  1. Step 1: Model as a Graph

    • Vertices: {A,B,C,D,E}\{A, B, C, D, E\}.
    • Vertex degrees:
      • deg⁑(A)=3\deg(A) = 3 (connected to B,C,DB, C, D)
      • deg⁑(B)=3\deg(B) = 3 (connected to A,C,EA, C, E)
      • deg⁑(C)=4\deg(C) = 4 (connected to A,B,D,EA, B, D, E)
      • deg⁑(D)=3\deg(D) = 3 (connected to A,C,EA, C, E)
      • deg⁑(E)=3\deg(E) = 3 (connected to B,C,DB, C, D)
  2. Step 2: Identify Cliques

    • Vertices {A,B,C}\{A, B, C\} are all mutually adjacent: forms a triangle (K3K_3).
    • Are there any 4-cliques (K4K_4)?
      • Test {A,B,C,D}\{A, B, C, D\}: Is BB connected to DD? No edge exists between BB and DD!
      • Test {A,B,C,E}\{A, B, C, E\}: Is AA connected to EE? No edge exists between AA and EE!
      • Max clique size Ο‰(G)=3\omega(G) = 3.
  3. Step 3: Apply Welsh-Powell Coloring

    • Sorted vertices by degree: C(4),A(3),B(3),D(3),E(3)C(4), A(3), B(3), D(3), E(3).
    • Color 1 (Time Slot 1):
      • Assign Color 1 to highest-degree vertex: CC.
      • Look for non-neighbors of CC: CC connects to all other 4 vertices! No other vertex can take Color 1.
      • Color 1: {C}\{C\}.
    • Color 2 (Time Slot 2):
      • Pick next uncolored vertex: AA. Assign Color 2 to AA.
      • Check non-neighbors of AA: EE is not connected to AA. Assign Color 2 to EE.
      • (Check if EE can share Color 2: EE is not adjacent to AA. Valid!).
      • Color 2: {A,E}\{A, E\}.
    • Color 3 (Time Slot 3):
      • Remaining uncolored vertices: {B,D}\{B, D\}.
      • Pick BB. Assign Color 3 to BB.
      • Check non-neighbors of BB: DD is not connected to BB. Assign Color 3 to DD.
      • Color 3: {B,D}\{B, D\}.
    • All vertices are successfully colored using 3 colors!
  4. Step 4: Conclusion

    • Since Ο‰(G)=3\omega(G) = 3, Ο‡(G)β‰₯3\chi(G) \ge 3.
    • Since we found a valid 3-coloring ({C},{A,E},{B,D}\{C\}, \{A, E\}, \{B, D\}), the chromatic number is exactly: Ο‡(G)=3\chi(G) = 3
    • 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​

Core Conceptual Questions

Question 1: If a graph has no triangles (Ο‰(G)=2\omega(G) = 2), 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 Ο‡(G)=4\chi(G) = 4. 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 K7K_7 with zero edge crossings! By the Heawood conjecture, coloring maps on a torus requires up to 7 colors!

Common Interview Traps: Architectural Trade-Offs

Trap 1: Assuming Ο‡(G)=Ο‰(G)\chi(G) = \omega(G) always holds Why it fails: Ο‰(G)\omega(G) (clique number) is only a lower bound. For odd cycle C5C_5, the largest clique is an edge (K2K_2, so Ο‰=2\omega = 2), but Ο‡(C5)=3\chi(C_5) = 3. Never assume chromatic number equals the size of the largest complete subgraph!

Trap 2: Believing Brooks' Theorem applies to KnK_n and odd cycles Why it fails: Complete graphs KnK_n and odd cycles C2k+1C_{2k+1} are the exact two exceptions to Brooks' Theorem where Ο‡(G)=Ξ”(G)+1\chi(G) = \Delta(G) + 1. For all other connected graphs, Ο‡(G)≀Δ(G)\chi(G) \le \Delta(G).

πŸ’¬

Discussion & Doubts