5. Colorings
Greedy: can find
planar (all in plane without edge overlap): by the Four Color Theorem. By Heuristic: possible
2-colorable: linear time
even cycles are 2-colorable odd cycles are 3-colorable
a graph is bipartite no subgraph is cycle of uneven length
a block graph, where each block can be colored with at most colors, can be colored with colors
Brooks’ Theorem
Theorem
For any connected graph that is neither a complete graph nor an odd cycle (the entire graph), the chromatic number satisfies
where is the maximum degree of
Greedy Coloring
- Visit vertices in any order .
- Assign each the smallest color not used by its already-colored neighbors.
Greedy-Coloring(G):
pick any ordering V = {v₁, ..., vₙ}
c[v₁] ← 1
for i = 2 to n:
c[vᵢ] ← min{ k ∈ ℕ | k ≠ c(u) for all u ∈ N(vᵢ) ∩ {v₁,...,vᵢ₋₁} }
Bound:
where is the maximum degree.
Runtime: iterating over all nodes and their neighbors
Caveat: The number of colors used depends heavily on vertex ordering. There always exists an ordering achieving colors — but we don’t know which one.
Heuristic
- Order nodes with ascending degree
3-Colorable Algorithm
A 3-colorable graph can always be colored in with .