Graph theory · Definition

Graph coloring

discrete mathematicsgraphs

Before you start you need to know

Coloring a graph is the abstract way to allocate conflicting resources: exam timetables, radio frequencies or compiler registers.

Definition

A proper coloring \(c\) with \(k\) colors of a graph \(G=(V,E)\) assigns to each vertex one of the colors \(1,\dots,k\) so that no two adjacent vertices share a color.

\[c:V\to\{1,\dots,k\},\qquad c(u)\neq c(v)\ \text{ if } \{u,v\}\in E\]

The chromatic number \(\chi(G)\) is the least \(k\) for which a proper coloring exists. We have \(\chi(G)=1\) only when there are no edges, and \(\chi(G)=2\) exactly when \(G\) has edges and is bipartite. In \(K_n\) all vertices are adjacent, so \(\chi(K_n)=n\); for a cycle, \(\chi(C_n)=2\) if \(n\) is even and \(3\) if it is odd.

Two observations give bounds. If \(G\) contains a complete subgraph \(K_r\), then \(\chi(G)\ge r\), because those \(r\) vertices use distinct colors. And if \(\Delta\) is the maximum degree, a greedy coloring (coloring vertices one by one with a free color) uses at most \(\Delta+1\) colors, since each vertex has at most \(\Delta\) already colored neighbors. Brooks' theorem sharpens this: except for complete graphs and odd cycles, \(\Delta\) colors suffice.

A guiding example is exam scheduling: courses are vertices, there is an edge when they share students, and each color is a time slot; \(\chi(G)\) is the least number of clash-free slots. A common mistake is to think greedy coloring always gives the minimum: it depends on the vertex order, and finding \(\chi(G)\) is hard in general. The famous four color theorem states that every planar graph can be colored with 4 colors.

Think about it

Why can a proper coloring of a graph with an edge never use a single color?

The two endpoints of the edge are adjacent and must have different colors, so at least two colors are needed.

A graph has \(\chi(G)=3\). Can it contain a \(K_4\)?

No. A \(K_4\) forces \(\chi(G)\ge4\), contradicting \(\chi(G)=3\).

Exercises 10

References

  • Kenneth H. Rosen, Discrete Mathematics and Its Applications, 8th edition, McGraw-Hill, 2019. §10.8
  • Susanna S. Epp, Discrete Mathematics with Applications, 5th edition, Cengage, 2019. §10.8
  • Ralph P. Grimaldi, Discrete and Combinatorial Mathematics: An Applied Introduction, 5th edition, Pearson, 2003. §11.6