# Graph coloring

(Redirected from Chromatic number)

Not to be confused with Edge coloring. Graph coloring_sentence_0

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. Graph coloring_sentence_1

In its simplest form, it is a way of coloring the vertices of a graph such that no two adjacent vertices are of the same color; this is called a vertex coloring. Graph coloring_sentence_2

Similarly, an edge coloring assigns a color to each edge so that no two adjacent edges are of 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. Graph coloring_sentence_3

Vertex coloring is usually used to introduce graph coloring problems, since other coloring problems can be transformed into a vertex coloring instance. Graph coloring_sentence_4

For example, an edge coloring of a graph is just a vertex coloring of its line graph, and a face coloring of a plane graph is just a vertex coloring of its dual. Graph coloring_sentence_5

However, non-vertex coloring problems are often stated and studied as-is. Graph coloring_sentence_6

This is partly pedagogical, and partly because some problems are best studied in their non-vertex form, as in the case of edge coloring. Graph coloring_sentence_7

The convention of using colors originates from coloring the countries of a map, where each face is literally colored. Graph coloring_sentence_8

This was generalized to coloring the faces of a graph embedded in the plane. Graph coloring_sentence_9

By planar duality it became coloring the vertices, and in this form it generalizes to all graphs. Graph coloring_sentence_10

In mathematical and computer representations, it is typical to use the first few positive or non-negative integers as the "colors". Graph coloring_sentence_11

In general, one can use any finite set as the "color set". Graph coloring_sentence_12

The nature of the coloring problem depends on the number of colors but not on what they are. Graph coloring_sentence_13

Graph coloring enjoys many practical applications as well as theoretical challenges. Graph coloring_sentence_14

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. Graph coloring_sentence_15

It has even reached popularity with the general public in the form of the popular number puzzle Sudoku. Graph coloring_sentence_16

Graph coloring is still a very active field of research. Graph coloring_sentence_17

Note: Many terms used in this article are defined in Glossary of graph theory. Graph coloring_sentence_18

## History Graph coloring_section_0

See also: History of the four color theorem and History of graph theory Graph coloring_sentence_19

The first results about graph coloring deal almost exclusively with planar graphs in the form of the coloring of maps. Graph coloring_sentence_20

While trying to color a map of the counties of England, Francis Guthrie postulated the four color conjecture, noting that four colors were sufficient to color the map so that no regions sharing a common border received the same color. Graph coloring_sentence_21

Guthrie’s brother passed on the question to his mathematics teacher Augustus de Morgan at University College, who mentioned it in a letter to William Hamilton in 1852. Graph coloring_sentence_22

Arthur Cayley raised the problem at a meeting of the London Mathematical Society in 1879. Graph coloring_sentence_23

The same year, Alfred Kempe published a paper that claimed to establish the result, and for a decade the four color problem was considered solved. Graph coloring_sentence_24

For his accomplishment Kempe was elected a Fellow of the Royal Society and later President of the London Mathematical Society. Graph coloring_sentence_25

In 1890, Heawood pointed out that Kempe’s argument was wrong. Graph coloring_sentence_26

However, in that paper he proved the five color theorem, saying that every planar map can be colored with no more than five colors, using ideas of Kempe. Graph coloring_sentence_27

In the following century, a vast amount of work and theories were developed to reduce the number of colors to four, until the four color theorem was finally proved in 1976 by Kenneth Appel and Wolfgang Haken. Graph coloring_sentence_28

The proof went back to the ideas of Heawood and Kempe and largely disregarded the intervening developments. Graph coloring_sentence_29

The proof of the four color theorem is also noteworthy for being the first major computer-aided proof. Graph coloring_sentence_30

In 1912, George David Birkhoff introduced the chromatic polynomial to study the coloring problems, which was generalised to the Tutte polynomial by Tutte, important structures in algebraic graph theory. Graph coloring_sentence_31

Kempe had already drawn attention to the general, non-planar case in 1879, and many results on generalisations of planar graph coloring to surfaces of higher order followed in the early 20th century. Graph coloring_sentence_32

In 1960, Claude Berge formulated another conjecture about graph coloring, the strong perfect graph conjecture, originally motivated by an information-theoretic concept called the zero-error capacity of a graph introduced by Shannon. Graph coloring_sentence_33

The conjecture remained unresolved for 40 years, until it was established as the celebrated strong perfect graph theorem by Chudnovsky, Robertson, Seymour, and Thomas in 2002. Graph coloring_sentence_34

Graph coloring has been studied as an algorithmic problem since the early 1970s: the chromatic number problem is one of Karp’s 21 NP-complete problems from 1972, and at approximately the same time various exponential-time algorithms were developed based on backtracking and on the deletion-contraction recurrence of . Graph coloring_sentence_35

One of the major applications of graph coloring, register allocation in compilers, was introduced in 1981. Graph coloring_sentence_36

## Definition and terminology Graph coloring_section_1

### Vertex coloring Graph coloring_section_2

When used without any qualification, a coloring of a graph is almost always a proper vertex coloring, namely a labeling of the graph’s vertices with colors such that no two vertices sharing the same edge have the same color. Graph coloring_sentence_37

Since a vertex with a loop (i.e. a connection directly back to itself) could never be properly colored, it is understood that graphs in this context are loopless. Graph coloring_sentence_38

The terminology of using colors for vertex labels goes back to map coloring. Graph coloring_sentence_39

Labels like red and blue are only used when the number of colors is small, and normally it is understood that the labels are drawn from the integers {1, 2, 3, ...}. Graph coloring_sentence_40

A coloring using at most k colors is called a (proper) k-coloring. Graph coloring_sentence_41

The smallest number of colors needed to color a graph G is called its chromatic number, and is often denoted χ(G). Graph coloring_sentence_42

Sometimes γ(G) is used, since χ(G) is also used to denote the Euler characteristic of a graph. Graph coloring_sentence_43

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. A subset of vertices assigned to the same color is called a color class, every such class forms an independent set. Graph coloring_sentence_44

Thus, a k-coloring is the same as a partition of the vertex set into k independent sets, and the terms k-partite and k-colorable have the same meaning. Graph coloring_sentence_45

### Chromatic polynomial Graph coloring_section_3

Main article: Chromatic polynomial Graph coloring_sentence_46

The chromatic polynomial counts the number of ways a graph can be colored using no more than a given number of colors. Graph coloring_sentence_47

For example, using three colors, the graph in the adjacent image can be colored in 12 ways. Graph coloring_sentence_48

With only two colors, it cannot be colored at all. Graph coloring_sentence_49

With four colors, it can be colored in 24 + 4⋅12 = 72 ways: using all four colors, there are 4! Graph coloring_sentence_50

= 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. Graph coloring_sentence_51

So, for the graph in the example, a table of the number of valid colorings would start like this: Graph coloring_sentence_52

Graph coloring_table_general_0

 Available colorsGraph coloring_cell_0_0_0 1Graph coloring_cell_0_0_1 2Graph coloring_cell_0_0_2 3Graph coloring_cell_0_0_3 4Graph coloring_cell_0_0_4 …Graph coloring_cell_0_0_5 Number of coloringsGraph coloring_cell_0_1_0 0Graph coloring_cell_0_1_1 0Graph coloring_cell_0_1_2 12Graph coloring_cell_0_1_3 72Graph coloring_cell_0_1_4 …Graph coloring_cell_0_1_5

The chromatic polynomial is a function P(G, t) that counts the number of t-colorings of G. As the name indicates, for a given G the function is indeed a polynomial in t. For the example graph, P(G, t) = t(t − 1)(t − 2), and indeed P(G, 4) = 72. Graph coloring_sentence_53

The chromatic polynomial includes at least as much information about the colorability of G as does the chromatic number. Graph coloring_sentence_54

Indeed, χ is the smallest positive integer that is not a root of the chromatic polynomial Graph coloring_sentence_55

### Edge coloring Graph coloring_section_4

Main article: Edge coloring Graph coloring_sentence_56

An edge coloring of a graph is a proper coloring of the edges, meaning an assignment of colors to edges so that no vertex is incident to two edges of the same color. Graph coloring_sentence_57

An edge coloring with k colors is called a k-edge-coloring and is equivalent to the problem of partitioning the edge set into k matchings. Graph coloring_sentence_58

The smallest number of colors needed for an edge coloring of a graph G is the chromatic index, or edge chromatic number, χ′(G). Graph coloring_sentence_59

A Tait coloring is a 3-edge coloring of a cubic graph. Graph coloring_sentence_60

The four color theorem is equivalent to the assertion that every planar cubic bridgeless graph admits a Tait coloring. Graph coloring_sentence_61

### Total coloring Graph coloring_section_5

Main article: Total coloring Graph coloring_sentence_62

Total coloring is a type of coloring on the vertices and edges of a graph. Graph coloring_sentence_63

When used without any qualification, a total coloring is always assumed to be proper in the sense that no adjacent vertices, no adjacent edges, and no edge and its end-vertices are assigned the same color. Graph coloring_sentence_64

The total chromatic number χ″(G) of a graph G is the fewest colors needed in any total coloring of G. Graph coloring_sentence_65

## Properties Graph coloring_section_7

### Upper bounds on the chromatic number Graph coloring_section_8

Assigning distinct colors to distinct vertices always yields a proper coloring, so Graph coloring_sentence_66

If G contains a clique of size k, then at least k colors are needed to color that clique; in other words, the chromatic number is at least the clique number: Graph coloring_sentence_67

For perfect graphs this bound is tight. Graph coloring_sentence_68

Finding cliques is known as the clique problem. Graph coloring_sentence_69

The 2-colorable graphs are exactly the bipartite graphs, including trees and forests. Graph coloring_sentence_70

By the four color theorem, every planar graph can be 4-colored. Graph coloring_sentence_71

A greedy coloring shows that every graph can be colored with one more color than the maximum vertex degree, Graph coloring_sentence_72

### Lower bounds on the chromatic number Graph coloring_section_9

Several lower bounds for the chromatic bounds have been discovered over the years: Graph coloring_sentence_73

Lovász number: The Lovász number of a complementary graph is also a lower bound on the chromatic number: Graph coloring_sentence_74

Fractional chromatic number: The fractional chromatic number of a graph is a lower bound on the chromatic number as well: Graph coloring_sentence_75

These bounds are ordered as follows: Graph coloring_sentence_76

### Graphs with high chromatic number Graph coloring_section_10

Graphs with large cliques have a high chromatic number, but the opposite is not true. Graph coloring_sentence_77

The Grötzsch graph is an example of a 4-chromatic graph without a triangle, and the example can be generalised to the Mycielskians. Graph coloring_sentence_78

Graph coloring_description_list_0

• Mycielski’s Theorem (Alexander Zykov , Jan Mycielski ): There exist triangle-free graphs with arbitrarily high chromatic number.Graph coloring_item_0_0

From Brooks’s theorem, graphs with high chromatic number must have high maximum degree. Graph coloring_sentence_79

Another local property that leads to high chromatic number is the presence of a large clique. Graph coloring_sentence_80

But colorability is not an entirely local phenomenon: A graph with high girth looks locally like a tree, because all cycles are long, but its chromatic number need not be 2: Graph coloring_sentence_81

Graph coloring_description_list_1

• Theorem (Erdős): There exist graphs of arbitrarily high girth and chromatic number.Graph coloring_item_1_1

### Bounds on the chromatic index Graph coloring_section_11

Moreover, Graph coloring_sentence_82

In general, the relationship is even stronger than what Brooks’s theorem gives for vertex coloring: Graph coloring_sentence_83

### Other properties Graph coloring_section_12

A graph has a k-coloring if and only if it has an acyclic orientation for which the longest path has length at most k; this is the Gallai–Hasse–Roy–Vitaver theorem (). Graph coloring_sentence_84

For planar graphs, vertex colorings are essentially dual to nowhere-zero flows. Graph coloring_sentence_85

About infinite graphs, much less is known. Graph coloring_sentence_86

The following are two of the few results about infinite graph coloring: Graph coloring_sentence_87

Graph coloring_unordered_list_2

• If all finite subgraphs of an infinite graph G are k-colorable, then so is G, under the assumption of the axiom of choice. This is the de Bruijn–Erdős theorem of .Graph coloring_item_2_2
• If a graph admits a full n-coloring for every n ≥ n0, it admits an infinite full coloring ().Graph coloring_item_2_3

### Open problems Graph coloring_section_13

The chromatic number of the plane, where two points are adjacent if they have unit distance, is unknown, although it is one of 5, 6, or 7. Graph coloring_sentence_88

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, the Erdős–Faber–Lovász conjecture bounding the chromatic number of unions of complete graphs that have at most one vertex in common to each pair, and the Albertson conjecture that among k-chromatic graphs the complete graphs are the ones with smallest crossing number. Graph coloring_sentence_89

## Algorithms Graph coloring_section_14

Graph coloring_table_infobox_1

NameGraph coloring_header_cell_1_2_0 Graph coloring, vertex coloring, k-coloringGraph coloring_cell_1_2_1
InputGraph coloring_header_cell_1_3_0 Graph G with n vertices. Integer kGraph coloring_cell_1_3_1
OutputGraph coloring_header_cell_1_4_0 Does G admit a proper vertex coloring with k colors?Graph coloring_cell_1_4_1
InputGraph coloring_header_cell_1_11_0 Graph G with n vertices.Graph coloring_cell_1_11_1
ApproximabilityGraph coloring_header_cell_1_14_0 O(n (log n)(log log n))Graph coloring_cell_1_14_1
InapproximabilityGraph coloring_header_cell_1_15_0 O(n) unless P = NPGraph coloring_cell_1_15_1
InputGraph coloring_header_cell_1_18_0 Graph G with n vertices. Integer kGraph coloring_cell_1_18_1
OutputGraph coloring_header_cell_1_19_0 The number P (G,k) of proper k-colorings of GGraph coloring_cell_1_19_1
ApproximabilityGraph coloring_header_cell_1_22_0 FPRAS for restricted casesGraph coloring_cell_1_22_1
InapproximabilityGraph coloring_header_cell_1_23_0 No PTAS unless P = NPGraph coloring_cell_1_23_1

### Polynomial time Graph coloring_section_15

Determining if a graph can be colored with 2 colors is equivalent to determining whether or not the graph is bipartite, and thus computable in linear time using breadth-first search or depth-first search. Graph coloring_sentence_90

More generally, the chromatic number and a corresponding coloring of perfect graphs can be computed in polynomial time using semidefinite programming. Graph coloring_sentence_91

Closed formulas for chromatic polynomial are known for many classes of graphs, such as forests, chordal graphs, cycles, wheels, and ladders, so these can be evaluated in polynomial time. Graph coloring_sentence_92

If the graph is planar and has low branch-width (or is nonplanar but with a known branch decomposition), then it can be solved in polynomial time using dynamic programming. Graph coloring_sentence_93

In general, the time required is polynomial in the graph size, but exponential in the branch-width. Graph coloring_sentence_94

### Contraction Graph coloring_section_17

The chromatic number satisfies the recurrence relation: Graph coloring_sentence_95

The chromatic polynomial satisfies the following recurrence relation Graph coloring_sentence_96

### Greedy coloring Graph coloring_section_18

Main article: Greedy coloring Graph coloring_sentence_97

For chordal graphs, and for special cases of chordal graphs such as interval graphs and indifference graphs, the greedy coloring algorithm can be used to find optimal colorings in polynomial time, by choosing the vertex ordering to be the reverse of a perfect elimination ordering for the graph. Graph coloring_sentence_98

The perfectly orderable graphs generalize this property, but it is NP-hard to find a perfect ordering of these graphs. Graph coloring_sentence_99

The maximum (worst) number of colors that can be obtained by the greedy algorithm, by using a vertex ordering chosen to maximize this number, is called the Grundy number of a graph. Graph coloring_sentence_100

### Parallel and distributed algorithms Graph coloring_section_19

In the field of distributed algorithms, graph coloring is closely related to the problem of symmetry breaking. Graph coloring_sentence_101

The current state-of-the-art randomized algorithms are faster for sufficiently large maximum degree Δ than deterministic algorithms. Graph coloring_sentence_102

The fastest randomized algorithms employ the multi-trials technique by Schneider et al. Graph coloring_sentence_103

In a symmetric graph, a deterministic distributed algorithm cannot find a proper vertex coloring. Graph coloring_sentence_104

Some auxiliary information is needed in order to break symmetry. Graph coloring_sentence_105

A standard assumption is that initially each node has a unique identifier, for example, from the set {1, 2, ..., n}. Graph coloring_sentence_106

Put otherwise, we assume that we are given an n-coloring. Graph coloring_sentence_107

The challenge is to reduce the number of colors from n to, e.g., Δ + 1. Graph coloring_sentence_108

The more colors are employed, e.g. O(Δ) instead of Δ + 1, the fewer communication rounds are required. Graph coloring_sentence_109

A straightforward distributed version of the greedy algorithm for (Δ + 1)-coloring requires Θ(n) communication rounds in the worst case − information may need to be propagated from one side of the network to another side. Graph coloring_sentence_110

The simplest interesting case is an n-cycle. Graph coloring_sentence_111

Richard Cole and Uzi Vishkin show that there is a distributed algorithm that reduces the number of colors from n to O(log n) in one synchronous communication step. Graph coloring_sentence_112

By iterating the same procedure, it is possible to obtain a 3-coloring of an n-cycle in O(log* n) communication steps (assuming that we have unique node identifiers). Graph coloring_sentence_113

The function log*, iterated logarithm, is an extremely slowly growing function, "almost constant". Graph coloring_sentence_114

Hence the result by Cole and Vishkin raised the question of whether there is a constant-time distributed algorithm for 3-coloring an n-cycle. Graph coloring_sentence_115

showed that this is not possible: any deterministic distributed algorithm requires Ω(log* n) communication steps to reduce an n-coloring to a 3-coloring in an n-cycle. Graph coloring_sentence_116

The problem of edge coloring has also been studied in the distributed model. Graph coloring_sentence_117

achieve a (2Δ − 1)-coloring in O(Δ + log* n) time in this model. Graph coloring_sentence_118

The lower bound for distributed vertex coloring due to applies to the distributed edge coloring problem as well. Graph coloring_sentence_119

### Decentralized algorithms Graph coloring_section_20

Decentralized algorithms are ones where no message passing is allowed (in contrast to distributed algorithms where local message passing takes places), and efficient decentralized algorithms exist that will color a graph if a proper coloring exists. Graph coloring_sentence_120

These assume that a vertex is able to sense whether any of its neighbors are using the same color as the vertex i.e., whether a local conflict exists. Graph coloring_sentence_121

This is a mild assumption in many applications e.g. in wireless channel allocation it is usually reasonable to assume that a station will be able to detect whether other interfering transmitters are using the same channel (e.g. by measuring the SINR). Graph coloring_sentence_122

This sensing information is sufficient to allow algorithms based on learning automata to find a proper graph coloring with probability one. Graph coloring_sentence_123

### Computational complexity Graph coloring_section_21

Graph coloring is computationally hard. Graph coloring_sentence_124

It is NP-complete to decide if a given graph admits a k-coloring for a given k except for the cases k ∈ {0,1,2} . Graph coloring_sentence_125

In particular, it is NP-hard to compute the chromatic number. Graph coloring_sentence_126

The 3-coloring problem remains NP-complete even on 4-regular planar graphs. Graph coloring_sentence_127

However, for every k > 3, a k-coloring of a planar graph exists by the four color theorem, and it is possible to find such a coloring in polynomial time. Graph coloring_sentence_128

The best known approximation algorithm computes a coloring of size at most within a factor O(n(log log n)(log n)) of the chromatic number. Graph coloring_sentence_129

For all ε > 0, approximating the chromatic number within n is NP-hard. Graph coloring_sentence_130

It is also NP-hard to color a 3-colorable graph with 4 colors and a k-colorable graph with k colors for sufficiently large constant k. Graph coloring_sentence_131

For edge coloring, the proof of Vizing’s result gives an algorithm that uses at most Δ+1 colors. Graph coloring_sentence_132

However, deciding between the two candidate values for the edge chromatic number is NP-complete. Graph coloring_sentence_133

In terms of approximation algorithms, Vizing’s algorithm shows that the edge chromatic number can be approximated to within 4/3, and the hardness result shows that no (4/3 − ε )-algorithm exists for any ε > 0 unless P = NP. Graph coloring_sentence_134

These are among the oldest results in the literature of approximation algorithms, even though neither paper makes explicit use of that notion. Graph coloring_sentence_135

## Applications Graph coloring_section_22

### Scheduling Graph coloring_section_23

Vertex coloring models to a number of scheduling problems. Graph coloring_sentence_136

In the cleanest form, a given set of jobs need to be assigned to time slots, each job requires one such slot. Graph coloring_sentence_137

Jobs can be scheduled in any order, but pairs of jobs may be in conflict in the sense that they may not be assigned to the same time slot, for example because they both rely on a shared resource. Graph coloring_sentence_138

The corresponding graph contains a vertex for every job and an edge for every conflicting pair of jobs. Graph coloring_sentence_139

The chromatic number of the graph is exactly the minimum makespan, the optimal time to finish all jobs without conflicts. Graph coloring_sentence_140

Details of the scheduling problem define the structure of the graph. Graph coloring_sentence_141

For example, when assigning aircraft to flights, the resulting conflict graph is an interval graph, so the coloring problem can be solved efficiently. Graph coloring_sentence_142

In bandwidth allocation to radio stations, the resulting conflict graph is a unit disk graph, so the coloring problem is 3-approximable. Graph coloring_sentence_143

### Register allocation Graph coloring_section_24

Main article: Register allocation Graph coloring_sentence_144

A compiler is a computer program that translates one computer language into another. Graph coloring_sentence_145

To improve the execution time of the resulting code, one of the techniques of compiler optimization is register allocation, where the most frequently used values of the compiled program are kept in the fast processor registers. Graph coloring_sentence_146

Ideally, values are assigned to registers so that they can all reside in the registers when they are used. Graph coloring_sentence_147

The textbook approach to this problem is to model it as a graph coloring problem. Graph coloring_sentence_148

The compiler constructs an interference graph, where vertices are variables and an edge connects two vertices if they are needed at the same time. Graph coloring_sentence_149

If the graph can be colored with k colors then any set of variables needed at the same time can be stored in at most k registers. Graph coloring_sentence_150

### Other applications Graph coloring_section_25

The problem of coloring a graph arises in many practical areas such as pattern matching, sports scheduling, designing seating plans, exam timetabling, the scheduling of taxis, and solving Sudoku puzzles. Graph coloring_sentence_151

## Other colorings Graph coloring_section_26

### Ramsey theory Graph coloring_section_27

Main article: Ramsey theory Graph coloring_sentence_152

### Other colorings Graph coloring_section_28

Coloring can also be considered for signed graphs and gain graphs. Graph coloring_sentence_153