# Lecture 37: Graph coloring

• Graph coloring
• definition, applications
• Stated but unproven results:
• planar graphs are 4-colorable
• $$k$$-coloring is NP-complete for $$k \geq 3$$.
• We also finished the proof that finding Hamiltonian paths is hard; this has been added to last lecture's notes.

## Graph coloring

An $$X$$-coloring of a graph $$G = (V,E)$$ is a function $$c : V → X$$ satisfying $$c(u) \neq c(v)$$ whenever $$(u,v) \in E$$.

A $$k$$-coloring is a $$\{1,2,\dots,k\}$$-coloring.

Examples:

• The original example is coloring a map: make a vertex for each country, and add an edge between any two adjacent countries. Then the resulting colors make the boundaries obvious, because the two countries on opposite sides of each border must have different colors

• Coloring is good for resource allocation. For example, to assign courses to time slots, one can build a graph where the vertices are courses and there is an edge between two courses if they have at least one student taking both of them. A $$k$$-coloring assigns one of $$k$$ time slots to each exam so that no student has a conflict.

Facts:

• Every planar graph (a graph is planar if it can be drawn in a plane with no edges crossing) is 4-colorable.

• Finding a 3-coloring is NP-complete in general graphs.