Graph theory · Definition
Graph coloring
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.
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
- What is the minimum number of colors in a proper coloring of the complete graph \(K_5\)?
- What is the minimum number of colors needed by a graph that has at least one edge?
- What is the minimum number of colors needed by the cycle \(C_7\) (7 vertices)?
- What is the minimum number of colors needed by the cycle \(C_8\)?
- The graph has vertices \(1,2,3,4\) and edges \(\{1,2\},\{2,3\},\{1,3\},\{3,4\}\). Which is a proper coloring?
- The wheel \(W_5\) is a cycle \(C_5\) plus a central vertex joined to all 5 cycle vertices. How many colors does it need?
- In how many ways can a path on 4 vertices be colored with 3 available colors so that adjacent vertices differ?
- The Petersen graph has 10 vertices, all of degree 3, and contains 5-cycles. What is the minimum number of colors of a proper coloring?
- Let \(\Delta\) be the maximum degree of a graph \(G\). Which statement is true for every graph?
- If a graph \(G\) contains \(K_4\) as a subgraph, what can be guaranteed about the minimum number of colors \(\chi(G)\)?
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