Graph Coloring

2 min read Last updated Sat Jun 27 2026 08:46:52 GMT+0000 (Coordinated Universal Time)

The assignment of colors to vertices (or edges) of a graph such that no 2 adjacent vertices share the same color.

Chromatic Number

The chromatic number χ(G)\chi(G) is the minimum number of colors needed to properly color the vertices of GG.

Bounds:

  • χ(G)1\chi(G) \ge 1 for any non-empty graph
  • χ(G)ω(G)\chi(G) \ge \omega(G), where ω(G)\omega(G) is the clique number (size of the largest complete subgraph)
  • χ(G)Δ(G)+1\chi(G) \le \Delta(G) + 1, where Δ(G)\Delta(G) is the maximum vertex degree (Brooks’ theorem tightens this for non-complete non-odd-cycle graphs to χ(G)Δ(G)\chi(G) \le \Delta(G))

Special cases:

  • χ(G)=1\chi(G) = 1 iff GG has no edges
  • χ(G)=2\chi(G) = 2 iff GG is bipartite
  • χ(Kn)=n\chi(K_n) = n for the complete graph on nn vertices

Four-Color Theorem

Any planar graph satisfies χ(G)4\chi(G) \le 4. The converse does not hold: a graph with χ(G)4\chi(G) \le 4 need not be planar.

Algorithms

Determining χ(G)\chi(G) exactly is NP-hard.

  • Greedy coloring assigns colors in vertex order, using the smallest color not taken by any neighbor. Produces at most Δ(G)+1\Delta(G) + 1 colors. Not globally optimal.
  • Backtracking search finds the exact chromatic number but is exponential in the worst case.
  • Heuristic methods (DSATUR, RLF) give near-optimal colorings for large graphs.

Applications

  • Register allocation in compilers: variables are vertices, edges connect variables live simultaneously, colors are registers.
  • Scheduling: tasks are vertices, conflicts are edges, colors are time slots.
  • Map coloring: regions are vertices, shared borders are edges.
Was this helpful?