In graph theory, graph coloring is a special case of graph labeling; it is an assignment of labels traditionally called "colors" to elements of a graph subject to certain constraints. In its simplest form, it is a way of coloring the vertices of a graph such that no two adjacent vertices share the same color; this is called a vertex coloring. Similarly, an edge coloring assigns a color to each edge so that no two adjacent edges share the same color, and a face coloring of a planar graph assigns a color to each face or region so that no two faces that share a boundary have the same color.
Vertex coloring is the starting point of the subject, and other coloring problems can be transformed into a vertex version. For example, an edge coloring of a graph is just a vertex coloring of its line graph, and a face coloring of a planar graph is just a vertex coloring of its planar dual. However, non-vertex coloring problems are often stated and studied as is. That is partly for perspective, and partly because some problems are best studied in non-vertex form, as for instance is edge coloring.
The convention of using colors originates from coloring the countries of a map, where each face is literally colored. This was generalized to coloring the faces of a graph embedded in the plane. By planar duality it became coloring the vertices, and in this form it generalizes to all graphs. In mathematical and computer representations it is typical to use the first few positive or nonnegative integers as the "colors". In general one can use any finite set as the "color set". The nature of the coloring problem depends on the number of colors but not on what they are.
Graph coloring enjoys many practical applications as well as theoretical challenges. Beside the classical types of problems, different limitations can also be set on the graph, or on the way a color is assigned, or even on the color itself. It has even reached popularity with the general public in the form of the popular number puzzle Sudoku. Graph coloring is still a very active field of research.
Note: Many terms used in this article are defined in the glossary of graph theory.
When used without any qualification, a coloring of a graph is always assumed to be a vertex coloring, namely an assignment of colors to the vertices of the graph. Again, when used without any qualification, a coloring is nearly always assumed to be proper, meaning no two adjacent vertices are assigned the same color. Here, "adjacent" means sharing the same edge. A coloring using at most k colors is called a (proper) k-coloring and is equivalent to the problem of partitioning the vertex set into k or fewer independent sets.
The least number of colors needed to color a graph G is called its chromatic number, χ(G). For example the chromatic number of a complete graph of n vertices (a graph with an edge between every two vertices), is . A graph that can be assigned a (proper) k-coloring is k-colorable, and it is k-chromatic if its chromatic number is exactly k.
The problem of finding the chromatic number is NP-hard. The corresponding decision problem (Is there a coloring which uses at most colors?) is NP-complete, and in fact was one of Karp's 21 NP-complete problems. It remains NP-complete even on planar graphs of degree at most 4, as shown by Garey and Johnson in 1974. There are however some efficient approximation algorithms that employ semidefinite programming.
Some properties of χ(G):
For planar graphs, vertex colorings are essentially dual to nowhere-zero flows.
About infinite graphs, much less is known. The following is one of the few results about infinite graph coloring:
The chromatic number of the plane, where two points are adjacent if they have unit distance, is unknown, although it is one of 4, 5, 6, or 7. Other open problems concerning the chromatic number of graphs include the Hadwiger conjecture stating that every graph with chromatic number k has a complete graph on k vertices as a minor, and the Erdős–Faber–Lovász conjecture bounding the chromatic number of unions of complete graphs that have at exactly one vertex in common to each pair.
The case k = 2 is equivalent to determining whether or not the graph is bipartite. This can be accomplished in polynomial time. For k >= 3 the problem is NP-Complete. By the gap theorem, this implies that the problem can not be approximated by a polynomial algorithm within a factor of 4/3 unless P=NP.
One consequence of the Strong Perfect Graph Theorem of Chudnovsky, Robertson, Seymour, and Thomas is that it is possible to determine the chromatic number of a perfect graph in polynomial time.
- The algorithms that do not ensure a result with the smallest possible number of colors. Here we can find the sequential algorithms (those that color one vertex at a time), heuristic algorithms, global randomized algorithms, metaheuristic algorithms (using simulated annealing, tabu search, etc.), and genetic algorithms, to name several types.
The algorithm is as follows:
This algorithm does not necessarily find a coloring.
The chromatic polynomial counts the number of ways a graph can be colored using no more than a given number of colors. For example, using three colors, the graph in the image to the right can be colored in 12 ways. With only two colors, it cannot be colored at all. With four colors, it can be colored in 24 + 4⋅12 = 72 ways: using all four colors, there are 4! = 24 valid colorings (every assignment of four colors to any 4-vertex graph is a proper coloring); and for every choice of three of the four colors, there are 12 valid 3-colorings. So, for the graph in the example, a table of the number of valid colorings would start like this:
|Number of colorings||0||0||12||72||…|
The chromatic polynomial is a function that counts the number of -colorings of . As the name indicates, for a given the function is indeed a polynomial in . For the example graph, , and indeed .
The chromatic polynomial includes at least as much information about the colorability of as does the chromatic number. Indeed, χ is the smallest positive integer that is not a root of the chromatic polynomial,
It was first used by Birkhoff and Lewis in their attack on the four-color theorem. It remains an unsolved problem to characterize graphs which have the same chromatic polynomial and to determine precisely which polynomials are chromatic.
|Tree with vertices|