Vertex coloring is the assignment of labels, called colors, to the vertices of a graph. The purpose is usually to separate adjacent vertices. Two vertices joined by an edge represent a conflict: they cannot receive the same color.
This idea turns a graph into a model of incompatibility. If vertices are tasks, an edge may mean that two tasks cannot occur at the same time. If vertices are radio transmitters, an edge may mean that two transmitters interfere. If vertices are exams, an edge may mean that some student must take both exams. A coloring assigns resources so that conflicts are respected.
66.1 Coloring a Graph
Let be a graph. A vertex coloring of is a function
where is a set of colors.
If , then is called a -coloring. The value is the color assigned to the vertex .
A coloring is proper if adjacent vertices receive different colors. Thus, for every edge ,
This is the main form of coloring studied in elementary graph theory. Unless stated otherwise, a coloring in this chapter means a proper vertex coloring.
66.2 Color Classes
Given a coloring , each color determines a subset of vertices:
The set is called a color class.
In a proper coloring, no two adjacent vertices lie in the same color class. Therefore each color class is an independent set. Conversely, if the vertex set of a graph can be partitioned into independent sets, then the graph has a proper -coloring.
Thus vertex coloring may be viewed in two equivalent ways.
| View | Description |
|---|---|
| Function view | Assign a color to each vertex |
| Partition view | Partition vertices into independent sets |
The partition view is often more useful in proofs. The function view is often more useful in algorithms.
66.3 -Colorable Graphs
A graph is -colorable if it has a proper coloring using at most colors.
If is -colorable, then it is also -colorable. The extra color may simply remain unused. Therefore colorability is monotone in the number of allowed colors.
The smallest useful values have special names.
| Number of colors | Meaning |
|---|---|
| 1 | The graph has no edges |
| 2 | The graph is bipartite |
| 3 | The graph is 3-colorable |
| 4 | The graph is 4-colorable |
A graph is 1-colorable exactly when no edge is present. If an edge exists, then and must receive different colors.
A graph is 2-colorable exactly when it is bipartite. The two color classes form the two parts of the bipartition.
66.4 Chromatic Number
The chromatic number of a graph , denoted , is the least number of colors needed in a proper vertex coloring.
This definition is standard: the chromatic number is the minimum number of colors in a proper coloring.
A coloring using exactly colors is called an optimal coloring. A graph with chromatic number is called -chromatic.
For example:
In a complete graph , every pair of distinct vertices is adjacent. Therefore no two vertices may share a color. All vertices require distinct colors.
For a cycle ,
An even cycle alternates between two colors. An odd cycle cannot be colored with two colors, because the alternating pattern returns to the starting point with a conflict.
66.5 Examples
Consider the path graph :
A proper 2-coloring is given by
Thus
Now consider the triangle . Each vertex is adjacent to the other two. If one vertex receives color 1 and another receives color 2, the third vertex is adjacent to both, so it requires a third color. Hence
Now consider the square . Opposite vertices may share colors, and adjacent vertices differ. Thus
These examples show that the number of vertices alone does not determine the chromatic number. The edge structure determines which vertices may share colors.
66.6 Basic Bounds
Every finite graph satisfies
when is nonempty.
The upper bound is obtained by assigning a distinct color to every vertex. This is always proper. The lower bound follows because at least one color is required for a nonempty graph.
A better upper bound uses the maximum degree. Let be the maximum degree of . Then
To see this, order the vertices in any way and color them one by one. When a vertex is colored, at most of its neighbors have already received colors. Therefore among available colors, at least one color remains available for .
This argument gives a simple greedy coloring proof. It also shows that local degree information gives a global coloring bound.
66.7 Cliques and Lower Bounds
A clique is a set of vertices that are pairwise adjacent. If a graph contains a clique of size , then those vertices must all receive different colors. Therefore
where is the clique number of , the size of a largest clique.
This lower bound is often useful, but it need not be exact. Some graphs require many colors even when their largest clique is small. Odd cycles of length at least five have clique number but chromatic number .
The gap between clique number and chromatic number is one of the central themes of coloring theory.
66.8 Bipartite Graphs as 2-Colorable Graphs
A graph is bipartite if its vertex set can be written as a disjoint union
such that every edge has one endpoint in and one endpoint in .
This is exactly the same as a proper 2-coloring. Assign color 1 to every vertex in , and color 2 to every vertex in . Since no edge lies inside or inside , adjacent vertices receive different colors.
Conversely, if a graph has a proper 2-coloring, the two color classes form a bipartition.
Thus:
For a graph with at least one edge,
66.9 Greedy Coloring
The greedy coloring algorithm colors vertices one at a time. At each step, it assigns the smallest available color that does not conflict with already colored neighbors.
The algorithm depends on the chosen vertex order.
Suppose the vertices are ordered as
For each , assign the smallest color not used by any previously colored neighbor of .
Greedy coloring always produces a proper coloring. However, it may use more colors than necessary. The same graph may receive different numbers of colors under different vertex orders.
This behavior is important. Coloring is partly structural and partly algorithmic. A graph may have a small chromatic number, while a poor coloring order causes a simple algorithm to use more colors.
66.10 Coloring and Scheduling
Vertex coloring gives a clean model for scheduling conflicts.
Let each vertex represent an event. Put an edge between two vertices if the two events cannot occur at the same time. A proper coloring assigns time slots to events so that conflicting events receive different slots.
In this model:
| Graph concept | Scheduling meaning |
|---|---|
| Vertex | Event |
| Edge | Conflict |
| Color | Time slot |
| Proper coloring | Feasible schedule |
| Chromatic number | Minimum number of time slots |
For example, in exam scheduling, each exam is a vertex. Two exams are adjacent if some student is enrolled in both. A coloring assigns exam periods. A proper coloring ensures that no student has two exams at the same time.
The chromatic number is the smallest number of periods needed.
66.11 Coloring and Maps
Map coloring is another classical source of graph coloring.
Given a map divided into regions, construct a graph as follows. Each region becomes a vertex. Two vertices are joined by an edge when the corresponding regions share a boundary segment.
A proper vertex coloring of this graph assigns colors to regions so that neighboring regions have different colors.
This converts a geometric problem into a graph problem. The Four Color Theorem states that every planar graph can be colored with at most four colors. In graph-theoretic language, if is planar, then
This theorem is deep. It belongs to planar graph theory, but vertex coloring gives its language.
66.12 Critical Graphs
A graph is color-critical, or simply critical, if removing any vertex lowers its chromatic number. More precisely, is -critical if
and
for every vertex .
Critical graphs isolate the obstruction to coloring with fewer colors. For example, is -critical. Odd cycles are 3-critical.
Critical graphs are useful because many coloring arguments reduce to minimal counterexamples. If a theorem about -colorability fails, one can often choose a smallest counterexample. Such a graph usually has critical structure.
66.13 Coloring Subgraphs
If is a subgraph of , then
Any proper coloring of restricts to a proper coloring of . Removing vertices or edges cannot force the use of more colors.
This monotonicity gives immediate lower bounds. If contains a subgraph whose chromatic number is known, then must use at least as many colors as .
For example, if contains a triangle, then
If contains , then
66.14 Common Chromatic Numbers
Several standard graph families have simple chromatic numbers.
| Graph | Chromatic number |
|---|---|
| Empty graph on vertices | 1, if |
| Complete graph | |
| Path , | 2 |
| Even cycle | 2 |
| Odd cycle | 3 |
| Nonempty bipartite graph | 2 |
| Tree with at least two vertices | 2 |
A tree with at least two vertices is bipartite, hence 2-colorable. Since it has at least one edge, it cannot be 1-colorable. Therefore its chromatic number is 2.
66.15 The Role of Vertex Coloring
Vertex coloring belongs to the structural part of graph theory, but it also has algorithmic and applied significance.
Structurally, coloring measures how far a graph is from being independent or bipartite. It studies the tension between adjacency and grouping.
Algorithmically, coloring asks for efficient methods to assign colors. Some coloring problems are easy, such as testing whether a graph is 2-colorable. Others are computationally difficult; determining chromatic number is generally hard for large graphs, and even planar coloring can involve difficult decision problems.
In applications, coloring converts conflict constraints into a discrete allocation problem. The same formal model appears in scheduling, register allocation, frequency assignment, map coloring, and resource sharing.
66.16 Exercises
Find the chromatic number of .
Find the chromatic number of .
Prove that every complete graph has chromatic number .
Prove that every bipartite graph is 2-colorable.
Give an example of a graph with clique number and chromatic number .
Apply greedy coloring to using the natural cyclic order of the vertices.
Find an ordering of the vertices of a bipartite graph for which greedy coloring uses more than two colors.
Prove that if is a subgraph of , then .
Construct the conflict graph for four exams where exam pairs , , and conflict. Find a minimum coloring.
Prove that a graph is 1-colorable if and only if it has no edges.