Graph coloring: Difference between revisions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
imported>Citation bot
Added hdl. | Use this bot. Report bugs. | Suggested by Dominic3203 | Category:Computational problems in graph theory | #UCB_Category 67/78
imported>BagLuke
Other colorings: Added interval coloring
 
Line 2: Line 2:
[[File:Petersen graph 3-coloring.svg|thumb|right|A proper vertex coloring of the [[Petersen graph]] with 3 colors, the minimum number possible.]]
[[File:Petersen graph 3-coloring.svg|thumb|right|A proper vertex coloring of the [[Petersen graph]] with 3 colors, the minimum number possible.]]


In [[graph theory]], '''graph coloring''' is a methodic assignment of labels traditionally called "colors" to elements of a [[Graph (discrete mathematics)|graph]]. The assignment is subject to certain constraints, such as that no two adjacent elements have the same color. Graph coloring is a special case of [[graph labeling]]. In its simplest form, it is a way of coloring the [[Vertex (graph theory)|vertices]] of a graph such that no two adjacent vertices are of the same color; this is called a '''vertex coloring'''. Similarly, an ''[[edge coloring]]'' assigns a color to each [[Edge (graph theory)|edges]] 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 (graph theory)|face]] (or region) so that no two faces that share a boundary have the same color.
In [[graph theory]], '''graph coloring''' is a methodic assignment of labels traditionally called "colors" to elements of a [[Graph (discrete mathematics)|graph]]. The assignment is subject to certain constraints, such as that no two adjacent elements have the same color. Graph coloring is a special case of [[graph labeling]]. In its simplest form, it is a way of coloring the [[Vertex (graph theory)|vertices]] of a graph such that no two adjacent vertices are of the same color; this is called a '''vertex coloring'''. Similarly, an ''[[edge coloring]]'' assigns a color to each [[Edge (graph theory)|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 (graph theory)|face]] (or region) so that no two faces that share a boundary have the same color.


Vertex coloring is often used to introduce graph coloring problems, since other coloring problems can be transformed into a vertex coloring instance. 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|dual]]. However, non-vertex coloring problems are often stated and studied as-is. This is partly [[Pedagogy|pedagogical]], and partly because some problems are best studied in their non-vertex form, as in the case of edge coloring.
Vertex coloring is often used to introduce graph coloring problems, since other coloring problems can be transformed into a vertex coloring instance. 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|dual]]. However, non-vertex coloring problems are often stated and studied as-is. This is partly [[Pedagogy|pedagogical]], and partly because some problems are best studied in their non-vertex form, as in the case of edge coloring.
Line 14: Line 14:
== History ==
== History ==
{{See also | History of the four color theorem | History of graph theory}}
{{See also | History of the four color theorem | History of graph theory}}
[[File:Map of United States vivid colors shown.png|thumb|right|A map of the [[United States]] using colors to show political divisions using the [[four color theorem]].]]
[[File:Map of United States vivid colors shown.png|thumb|right|A map of the [[United States]] using colors to follow the [[four color theorem]].]]


The first results about graph coloring deal almost exclusively with [[planar graphs]] in the form of [[map coloring]].
The first results about graph coloring deal almost exclusively with [[planar graphs]] in the form of [[map coloring]]. While trying to color a map of the counties of England in 1852, [[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.<ref>{{Cite book |last=MacKenzie |first=Donald |title=Mechanizing Proof: Computing, Risk, and Trust |date=2004 |publisher=MIT Press |pages=103}}</ref> Guthrie's brother [[Frederick Guthrie (scientist)|Frederick]] passed on the question to his mathematics teacher [[Augustus De Morgan]] at [[University College London|University College]], who mentioned it in a letter to [[William Rowan Hamilton|William Hamilton]] in 1852. [[Arthur Cayley]] raised the problem at a meeting of the [[London Mathematical Society]] in 1879. 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. For his accomplishment Kempe was elected a Fellow of the [[Royal Society]] and later President of the London Mathematical Society.<ref>M. Kubale, ''History of graph coloring'', in {{harvtxt|Kubale|2004}}.</ref>
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. Guthrie's brother passed on the question to his mathematics teacher [[Augustus De Morgan]] at [[University College London|University College]], who mentioned it in a letter to [[William Rowan Hamilton|William Hamilton]] in 1852. [[Arthur Cayley]] raised the problem at a meeting of the [[London Mathematical Society]] in 1879. 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. For his accomplishment Kempe was elected a Fellow of the [[Royal Society]] and later President of the London Mathematical Society.<ref>M. Kubale, ''History of graph coloring'', in {{harvtxt|Kubale|2004}}.</ref>


In 1890, [[Percy John Heawood]] pointed out that Kempe's argument was wrong. 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. In the following century, a vast amount of work was done 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]]. The proof went back to the ideas of Heawood and Kempe and largely disregarded the intervening developments.{{sfnp|van Lint|Wilson|2001|loc=Chap. 33}}
In 1890, [[Percy John Heawood]] pointed out that Kempe's argument was wrong. 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. In the following century, a vast amount of work was done 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]]. The proof went back to the ideas of Heawood and Kempe and largely disregarded the intervening developments.{{sfnp|van Lint|Wilson|2001|loc=Chap. 33}} The proof of the four color theorem is noteworthy, aside from its solution of a century-old problem, for being the first major [[computer-aided proof]].
The proof of the four color theorem is noteworthy, aside from its solution of a century-old problem, for being the first major computer-aided proof.


In 1912, [[George David Birkhoff]] introduced the [[chromatic polynomial]] to study the coloring problem, which was generalised to the [[Tutte polynomial]] by [[W. T. Tutte]], both of which are important invariants in [[algebraic graph theory]]. Kempe had already drawn attention to the general, non-planar case in 1879,{{sfnp|Jensen|Toft|1995|p=2}} and many results on generalisations of planar graph coloring to surfaces of higher order followed in the early 20th century.
In 1912, [[George David Birkhoff]] introduced the [[chromatic polynomial]] to study the coloring problem, which was generalised to the [[Tutte polynomial]] by [[W. T. Tutte]], both of which are important invariants in [[algebraic graph theory]]. Kempe had already drawn attention to the general, non-planar case in 1879,{{sfnp|Jensen|Toft|1995|p=2}} and many results on generalisations of planar graph coloring to surfaces of higher order followed in the early 20th century.
Line 26: Line 24:
In 1960, [[Claude Berge]] formulated another conjecture about graph coloring, the ''strong perfect graph conjecture'', originally motivated by an [[information theory|information-theoretic]] concept called the [[zero-error capacity]] of a graph introduced by [[Claude Shannon|Shannon]]. The conjecture remained unresolved for 40 years, until it was established as the celebrated [[strong perfect graph theorem]] by [[Maria Chudnovsky|Chudnovsky]], [[Neil Robertson (mathematician)|Robertson]], [[Paul Seymour (mathematician)|Seymour]], and [[Robin Thomas (mathematician)|Thomas]] in 2002.
In 1960, [[Claude Berge]] formulated another conjecture about graph coloring, the ''strong perfect graph conjecture'', originally motivated by an [[information theory|information-theoretic]] concept called the [[zero-error capacity]] of a graph introduced by [[Claude Shannon|Shannon]]. The conjecture remained unresolved for 40 years, until it was established as the celebrated [[strong perfect graph theorem]] by [[Maria Chudnovsky|Chudnovsky]], [[Neil Robertson (mathematician)|Robertson]], [[Paul Seymour (mathematician)|Seymour]], and [[Robin Thomas (mathematician)|Thomas]] in 2002.


Graph coloring has been studied as an algorithmic problem since the early 1970s: the chromatic number problem (see section ''{{slink|#Vertex coloring}}'' below) 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 {{harvtxt|Zykov|1949}}. One of the major applications of graph coloring, [[register allocation]] in compilers, was introduced in 1981.
Graph coloring has been studied as an algorithmic problem since the early 1970s: the chromatic number problem (see section ''{{slink|#Vertex coloring}}'' below) 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 {{harvtxt|Zykov|1949}}. One of the major applications of graph coloring, [[register allocation]] in compilers, was introduced in 1981.


== Definition and terminology ==
== Definition and terminology ==
Line 40: Line 38:


{{anchor|Chromatic number}}
{{anchor|Chromatic number}}
A coloring using at most {{mvar|k}} colors is called a (proper) '''{{mvar|k}}-coloring'''. The smallest number of colors needed to color a graph {{mvar|G}} is called its '''chromatic number''', and is often denoted {{math|χ(''G'')}}.<ref>{{Cite web |last=Weisstein |first=Eric W. |title=Chromatic Number |url=https://mathworld.wolfram.com/ChromaticNumber.html |access-date=2025-02-09 |website=mathworld.wolfram.com |language=en}}</ref> Sometimes {{math|γ(''G'')}} is used, since {{math|χ(''G'')}} is also used to denote the [[Euler characteristic]] of a graph.<ref>{{Cite web |last=Weisstein |first=Eric W. |title=Euler Characteristic |url=https://mathworld.wolfram.com/EulerCharacteristic.html |access-date=2025-02-09 |website=mathworld.wolfram.com |language=en}}</ref> A graph that can be assigned a (proper) {{mvar|k}}-coloring is ''' {{mvar|k}}-colorable''', and it is '''{{mvar|k}}-chromatic''' if its chromatic number is exactly {{mvar|k}}. A subset of vertices assigned to the same color is called a ''color class''; every such class forms an [[Independent set (graph theory)|independent set]]. Thus, a {{mvar|k}}-coloring is the same as a partition of the vertex set into {{mvar|k}} independent sets, and the terms ''{{mvar|k}}-partite'' and ''{{mvar|k}}-colorable'' have the same meaning.
A coloring using at most {{mvar|k}} colors is called a (proper) '''{{mvar|k}}-coloring'''. The smallest number of colors needed to color a graph {{mvar|G}} is called its '''chromatic number''', and is often denoted {{math|χ(''G'')}}.<ref>{{Cite web |last=Weisstein |first=Eric W. |title=Chromatic Number |url=https://mathworld.wolfram.com/ChromaticNumber.html |access-date=2025-02-09 |website=mathworld.wolfram.com |language=en}}</ref> Sometimes {{math|γ(''G'')}} is used, since {{math|χ(''G'')}} is also used to denote the [[Euler characteristic]] of a graph.<ref>{{Cite web |last=Weisstein |first=Eric W. |title=Euler Characteristic |url=https://mathworld.wolfram.com/EulerCharacteristic.html |access-date=2025-02-09 |website=mathworld.wolfram.com |language=en}}</ref> A graph that can be assigned a (proper) {{mvar|k}}-coloring is ''' {{mvar|k}}-colorable''', and it is '''{{mvar|k}}-chromatic''' if its chromatic number is exactly {{mvar|k}}. A subset of vertices assigned to the same color is called a ''color class''; every such class forms an [[Independent set (graph theory)|independent set]]. Thus, a {{mvar|k}}-coloring is the same as a partition of the vertex set into {{mvar|k}} independent sets, and the terms ''{{mvar|k}}-partite'' and ''{{mvar|k}}-colorable'' have the same meaning.


=== Chromatic polynomial ===
=== Chromatic polynomial ===
Line 82: Line 80:
{{Main|Edge coloring}}
{{Main|Edge coloring}}


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. An edge coloring with {{mvar|k}} colors is called a {{mvar|k}}-edge-coloring and is equivalent to the problem of partitioning the edge set into {{mvar|k}} [[Matching (graph theory)|matchings]]. The smallest number of colors needed for an edge coloring of a graph {{mvar|G}} is the '''chromatic index''', or '''edge chromatic number''', {{math|''{{prime|χ}}''(''G'')}}. A '''Tait coloring''' is a 3-edge coloring of a [[cubic graph]]. The [[four color theorem]] is equivalent to the assertion that every planar cubic [[bridge (graph theory)|bridgeless]] graph admits a Tait coloring.
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. An edge coloring with {{mvar|k}} colors is called a {{mvar|k}}-edge-coloring and is equivalent to the problem of partitioning the edge set into {{mvar|k}} [[Matching (graph theory)|matchings]]. The smallest number of colors needed for an edge coloring of a graph {{mvar|G}} is the '''chromatic index''', or '''edge chromatic number''', {{math|''{{prime|χ}}''(''G'')}}. A '''Tait coloring''' is a 3-edge coloring of a [[cubic graph]]. The [[four color theorem]] is equivalent to the assertion that every planar cubic [[bridge (graph theory)|bridgeless]] graph admits a Tait coloring.


=== Total coloring ===
=== Total coloring ===
Line 90: Line 88:


=== Face coloring ===
=== Face coloring ===
For a graph with a strong embedding on a surface, the '''face coloring''' is the dual of the vertex coloring problem.
For a graph with a strong embedding on a surface, the '''face coloring''' is the dual of the vertex coloring problem.


=== Tutte's flow theory ===
=== Tutte's flow theory ===
For a graph ''G'' with a strong embedding on an orientable surface, [[William T. Tutte]]<ref>{{harvtxt|Tutte|1949}}</ref><ref>{{harvtxt|Tutte|1954}}</ref><ref>{{harvtxt|Zhang|1997}}</ref> discovered that if the graph is ''k''-face-colorable then ''G'' admits a nowhere-zero ''k''-flow. The equivalence holds if the surface is sphere.
For a graph {{mvar|G}} with a strong embedding on an orientable surface, [[William T. Tutte]]<ref>{{harvtxt|Tutte|1949}}</ref><ref>{{harvtxt|Tutte|1954}}</ref><ref>{{harvtxt|Zhang|1997}}</ref> discovered that if the graph is {{mvar|k}}-face-colorable then {{mvar|G}} admits a nowhere-zero {{mvar|k}}-flow. The equivalence holds if the surface is sphere.


=== Unlabeled coloring ===
=== Unlabeled coloring ===
Line 118: Line 116:
: <math>\chi(G) \le \Delta(G) + 1. </math>
: <math>\chi(G) \le \Delta(G) + 1. </math>


Complete graphs have <math>\chi(G)=n</math> and <math>\Delta(G)=n-1</math>, and [[odd cycle]]s have <math>\chi(G)=3</math> and <math>\Delta(G)=2</math>, so for these graphs this bound is best possible. In all other cases, the bound can be slightly improved; [[Brooks' theorem]]{{sfnp|Brooks|1941}} states that
Complete graphs have <math>\chi(G)=n</math> and <math>\Delta(G)=n-1</math>, and [[odd cycle]]s have <math>\chi(G)=3</math> and <math>\Delta(G)=2</math>, so for these graphs this bound is best possible. In all other cases, the bound can be slightly improved; [[Brooks' theorem]]{{sfnp|Brooks|1941}} states that
: '''[[Brooks' theorem]]:''' <math>\chi (G) \le \Delta (G) </math> for a connected, simple graph ''G'', unless ''G'' is a complete graph or an odd cycle.
: '''[[Brooks' theorem]]:''' <math>\chi (G) \le \Delta (G) </math> for a connected, simple graph ''G'', unless ''G'' is a complete graph or an odd cycle.


Line 146: Line 144:
=== Graphs with high chromatic number ===
=== Graphs with high chromatic number ===
Graphs with large [[Clique (graph theory)|cliques]] have a high chromatic number, but the opposite is not true. The [[Grötzsch graph]] is an example of a 4-chromatic graph without a triangle, and the example can be generalized to the [[Mycielskian]]s.
Graphs with large [[Clique (graph theory)|cliques]] have a high chromatic number, but the opposite is not true. The [[Grötzsch graph]] is an example of a 4-chromatic graph without a triangle, and the example can be generalized to the [[Mycielskian]]s.
: '''Theorem''' ({{harvard citations|nb|first=William T.|last=Tutte|year=1947|author-link=W. T. Tutte}},{{sfnp|Descartes|1947}} {{harvard citations|nb|first=Alexander|last=Zykov|year=1949|author-link=Alexander Zykov}}, {{harvard citations|nb|first=Jan|last=Mycielski|year=1955|author-link=Jan Mycielski}}): There exist triangle-free graphs with arbitrarily high chromatic number.
: '''Theorem''' ([[W. T. Tutte]], [[#{{harvid|Descartes|1947}}|1947]],{{sfnp|Descartes|1947}} {{harvard citations|nb|first=Alexander|last=Zykov|year=1949|author-link=Alexander Zykov}}, {{harvard citations|nb|first=Jan|last=Mycielski|year=1955|author-link=Jan Mycielski}}): There exist triangle-free graphs with arbitrarily high chromatic number.


To prove this, both, Mycielski and Zykov, each gave a construction of an inductively defined family of [[triangle-free graph]]s but with arbitrarily large chromatic number.{{sfnp|Scott|Seymour|2020}} {{harvtxt|Burling|1965}} constructed axis aligned boxes in <math>\mathbb{R}^{3}</math> whose [[intersection graph]] is triangle-free and requires arbitrarily many colors to be properly colored. This family of graphs is then called the Burling graphs. The same class of graphs is used for the construction of a family of triangle-free line segments in the plane, given by Pawlik et al. (2014).{{sfnp|Pawlik|Kozik|Krawczyk|Lasoń|2014}} It shows that the chromatic number of its intersection graph is arbitrarily large as well. Hence, this implies that axis aligned boxes in <math>\mathbb{R}^{3}</math> as well as line segments in <math>\mathbb{R}^{2}</math> are not [[χ-bounded|''χ''-bounded]].{{sfnp|Pawlik|Kozik|Krawczyk|Lasoń|2014}}
To prove this, both, Mycielski and Zykov, each gave a construction of an inductively defined family of [[triangle-free graph]]s but with arbitrarily large chromatic number.{{sfnp|Scott|Seymour|2020}} {{harvtxt|Burling|1965}} constructed axis aligned boxes in <math>\mathbb{R}^{3}</math> whose [[intersection graph]] is triangle-free and requires arbitrarily many colors to be properly colored. This family of graphs is then called the Burling graphs. The same class of graphs is used for the construction of a family of triangle-free line segments in the plane, given by Pawlik et al. (2014).{{sfnp|Pawlik|Kozik|Krawczyk|Lasoń|2014}} It shows that the chromatic number of its intersection graph is arbitrarily large as well. Hence, this implies that axis aligned boxes in <math>\mathbb{R}^{3}</math> as well as line segments in <math>\mathbb{R}^{2}</math> are not [[χ-bounded|''χ''-bounded]].{{sfnp|Pawlik|Kozik|Krawczyk|Lasoń|2014}}
Line 177: Line 175:


=== Open problems ===
=== Open problems ===
As stated above, <math> \omega(G) \le \chi(G) \le \Delta(G) + 1. </math> A conjecture of Reed from 1998 is that the value is essentially closer to the lower bound,  
As stated above, <math> \omega(G) \le \chi(G) \le \Delta(G) + 1. </math> A conjecture of Reed from 1998 is that the value is essentially closer to the lower bound, <math> \chi(G) \le \left\lceil \frac{\omega(G) + \Delta(G) + 1}{2} \right\rceil. </math>
<math> \chi(G) \le \left\lceil \frac{\omega(G) + \Delta(G) + 1}{2} \right\rceil. </math>


The [[Hadwiger–Nelson problem|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. Other [[unsolved problems in mathematics|open problems]] concerning the chromatic number of graphs include the [[Hadwiger conjecture (graph theory)|Hadwiger conjecture]] stating that every graph with chromatic number ''k'' has a [[complete graph]] on ''k'' vertices as a [[graph minor|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 theory)|crossing number]].
The [[Hadwiger–Nelson problem|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. Other [[unsolved problems in mathematics|open problems]] concerning the chromatic number of graphs include the [[Hadwiger conjecture (graph theory)|Hadwiger conjecture]] stating that every graph with chromatic number ''k'' has a [[complete graph]] on ''k'' vertices as a [[graph minor|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 theory)|crossing number]].


When Birkhoff and Lewis introduced the chromatic polynomial in their attack on the four-color theorem, they conjectured that for planar graphs ''G'', the polynomial <math>P(G,t)</math> has no zeros in the region <math>[4,\infty)</math>. Although it is known that such a chromatic polynomial has no zeros in the region <math>[5,\infty)</math> and that <math>P(G,4) \neq 0</math>, their conjecture is still unresolved. It also remains an unsolved problem to characterize graphs which have the same chromatic polynomial and to determine which polynomials are chromatic.
When Birkhoff and Lewis introduced the chromatic polynomial in their attack on the [[four color theorem]], they conjectured that for planar graphs <math>G</math>, the polynomial <math>P(G,t)</math> has no zeros in the region <math>[4,\infty)</math>. Although it is known that such a chromatic polynomial has no zeros in the region <math>[5,\infty)</math> and that <math>P(G,4) \neq 0</math>, their conjecture is still unresolved. It also remains an unsolved problem to characterize graphs which have the same chromatic polynomial and to determine which polynomials are chromatic.


== Algorithms ==
== Algorithms ==
Line 240: Line 237:


=== Polynomial time ===
=== Polynomial time ===
Determining if a graph can be colored with 2 colors is equivalent to determining whether or not the graph is [[Bipartite graph|bipartite]], and thus computable in [[linear time]] using [[breadth-first search]] or [[depth-first search]]. More generally, the chromatic number and a corresponding coloring of [[perfect graph]]s can be computed in [[polynomial time]] using [[semidefinite programming]]. [[Closed-form expression|Closed formulas]] for chromatic polynomials are known for many classes of graphs, such as forests, chordal graphs, cycles, wheels, and ladders, so these can be evaluated in polynomial time.
Determining if a graph can be colored with 2 colors is equivalent to determining whether or not the graph is [[Bipartite graph|bipartite]], and thus computable in [[linear time]] using [[breadth-first search]] or [[depth-first search]]. More generally, the chromatic number and a corresponding coloring of [[perfect graph]]s can be computed in [[polynomial time]] using [[semidefinite programming]]. [[Closed-form expression|Closed formulas]] for chromatic polynomials are known for many classes of graphs, such as forests, chordal graphs, cycles, wheels, and ladders, so these can be evaluated in polynomial time.


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. In general, the time required is polynomial in the graph size, but exponential in the branch-width.
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. In general, the time required is polynomial in the graph size, but exponential in the branch-width.
Line 247: Line 244:
[[Brute-force search]] for a ''k''-coloring considers each of the <math>k^n</math> assignments of ''k'' colors to ''n'' vertices and checks for each if it is legal. To compute the chromatic number and the chromatic polynomial, this procedure is used for every <math>k=1,\ldots,n-1</math>, impractical for all but the smallest input graphs.
[[Brute-force search]] for a ''k''-coloring considers each of the <math>k^n</math> assignments of ''k'' colors to ''n'' vertices and checks for each if it is legal. To compute the chromatic number and the chromatic polynomial, this procedure is used for every <math>k=1,\ldots,n-1</math>, impractical for all but the smallest input graphs.


Using [[dynamic programming]] and a bound on the number of [[maximal independent set]]s, ''k''-colorability can be decided in time and space <math>O(2.4423^n)</math>.{{sfnp|Lawler|1976}} Using the principle of [[inclusion–exclusion]] and [[Frank Yates|Yates]]'s algorithm for the fast zeta transform, ''k''-colorability can be decided in time <math>O(2^n n)</math>{{sfnp|Björklund|Husfeldt|Koivisto|2009|page=550}}{{sfnp|Yates|1937|page=66-67}}{{sfnp|Knuth|1997|loc=Chapter 4.6.4, pp. 501-502}}{{sfnp|Koivisto|2004|pp=45, 96–103}} for any ''k''. Faster algorithms are known for 3- and 4-colorability, which can be decided in time <math>O(1.3289^n)</math>{{sfnp|Beigel|Eppstein|2005}} and <math>O(1.7272^n)</math>,{{sfnp|Fomin|Gaspers|Saurabh|2007}} respectively. Exponentially faster algorithms are also known for 5- and 6-colorability, as well as for restricted families of graphs, including sparse graphs.{{sfnp|Zamir|2021}}
Using [[dynamic programming]] and a bound on the number of [[maximal independent set]]s, ''k''-colorability can be decided in time and space <math>O(2.4423^n)</math>.{{sfnp|Lawler|1976}} Using the principle of [[inclusion–exclusion]] and [[Frank Yates|Yates]]'s algorithm for the fast zeta transform, ''k''-colorability can be decided in time <math>O(2^n n)</math>{{sfnp|Björklund|Husfeldt|Koivisto|2009|page=550}}{{sfnp|Yates|1937|page=66-67}}{{sfnp|Knuth|1997|loc=Chapter 4.6.4, pp. 501-502}}{{sfnp|Koivisto|2004|pp=45, 96–103}} for any ''k''. Faster algorithms are known for 3- and 4-colorability, which can be decided in time <math>O(1.3289^n)</math>{{sfnp|Beigel|Eppstein|2005}} and <math>O(1.7272^n)</math>,{{sfnp|Fomin|Gaspers|Saurabh|2007}} respectively. Exponentially faster algorithms are also known for 5- and 6-colorability, as well as for restricted families of graphs, including sparse graphs.{{sfnp|Zamir|2021}}


=== Contraction ===
=== Contraction ===
The [[contraction (graph theory)|contraction]] <math>G/uv</math> of a graph ''G'' is the graph obtained by identifying the vertices ''u'' and ''v'', and removing any edges between them. The remaining edges originally incident to ''u'' or ''v'' are now incident to their identification (''i.e.'', the new fused node ''uv''). This operation plays a major role in the analysis of graph coloring.
The [[contraction (graph theory)|contraction]] <math>G/uv</math> of a graph ''G'' is the graph obtained by identifying the vertices ''u'' and ''v'', and removing any edges between them. The remaining edges originally incident to ''u'' or ''v'' are now incident to their identification (''i.e.'', the new fused node ''uv''). This operation plays a major role in the analysis of graph coloring.


The chromatic number satisfies the [[recurrence relation]]:
The chromatic number satisfies the [[recurrence relation]]:
Line 257: Line 254:


The chromatic polynomial satisfies the following recurrence relation
The chromatic polynomial satisfies the following recurrence relation
: <math>P(G-uv, k)= P(G/uv, k)+ P(G, k)</math>
: <math>P(G-uv, k)= P(G/uv, k)+ P(G, k),</math>
where ''u'' and ''v'' are adjacent vertices, and <math>G-uv</math> is the graph with the edge {{mvar|uv}} removed. <math>P(G - uv, k)</math> represents the number of possible proper colorings of the graph, where the vertices may have the same or different colors. Then the proper colorings arise from two different graphs. To explain, if the vertices ''u'' and ''v'' have different colors, then we might as well consider a graph where ''u'' and ''v'' are adjacent. If ''u'' and ''v'' have the same colors, we might as well consider a graph where ''u'' and ''v'' are contracted. Tutte's curiosity about which other graph properties satisfied this recurrence led him to discover a bivariate generalization of the chromatic polynomial, the [[Tutte polynomial]].
where ''u'' and ''v'' are adjacent vertices, and <math>G-uv</math> is the graph with the edge {{mvar|uv}} removed. <math>P(G - uv, k)</math> represents the number of possible proper colorings of the graph, where the vertices may have the same or different colors. Then the proper colorings arise from two different graphs. To explain, if the vertices ''u'' and ''v'' have different colors, then we might as well consider a graph where ''u'' and ''v'' are adjacent. If ''u'' and ''v'' have the same colors, we might as well consider a graph where ''u'' and ''v'' are contracted. Tutte's curiosity about which other graph properties satisfied this recurrence led him to discover a bivariate generalization of the chromatic polynomial, the [[Tutte polynomial]].


These expressions give rise to a recursive procedure called the ''deletion–contraction algorithm'', which forms the basis of many algorithms for graph coloring. The running time satisfies the same recurrence relation as the [[Fibonacci numbers]], so in the worst case the algorithm runs in time within a polynomial factor of <math>\left(\tfrac{1+\sqrt{5}}2\right)^{n+m}=O(1.6180^{n+m})</math> for ''n'' vertices and ''m'' edges.{{sfnp|Wilf|1986}} The analysis can be improved to within a polynomial factor of the number <math>t(G)</math> of [[spanning tree (mathematics)|spanning trees]] of the input graph.{{sfnp|Sekine|Imai|Tani|1995}} In practice, [[branch and bound]] strategies and [[isomorphism|graph isomorphism]] rejection are employed to avoid some recursive calls. The running time depends on the heuristic used to pick the vertex pair.
These expressions give rise to a recursive procedure called the ''deletion–contraction algorithm'', which forms the basis of many algorithms for graph coloring. The running time satisfies the same recurrence relation as the [[Fibonacci numbers]], so in the worst case the algorithm runs in time within a polynomial factor of <math>\left(\tfrac{1+\sqrt{5}}2\right)^{n+m}=O(1.6180^{n+m})</math> for ''n'' vertices and ''m'' edges.{{sfnp|Wilf|1986}} The analysis can be improved to within a polynomial factor of the number <math>t(G)</math> of [[spanning tree (mathematics)|spanning trees]] of the input graph.{{sfnp|Sekine|Imai|Tani|1995}} In practice, [[branch and bound]] strategies and [[isomorphism|graph isomorphism]] rejection are employed to avoid some recursive calls. The running time depends on the heuristic used to pick the vertex pair.


=== Greedy coloring ===
=== Greedy coloring ===
{{Main|Greedy coloring}}
{{Main|Greedy coloring}}
[[File:Greedy colourings.svg|thumb|right|Two greedy colorings of the same graph using different vertex orders. The right example generalizes to 2-colorable graphs with ''n'' vertices, where the greedy algorithm expends <math>n/2</math> colors.]]
[[File:Greedy colourings.svg|thumb|right|Two greedy colorings of the same graph using different vertex orders. The right example generalizes to 2-colorable graphs with ''n'' vertices, where the greedy algorithm expends <math>n/2</math> colors.]]


The [[greedy algorithm]] considers the vertices in a specific order <math>v_1</math>, ..., <math> v_n</math> and assigns to <math>v_i</math> the smallest available color not used by <math>v_i</math>'s neighbours among <math>v_1</math>, ..., <math> v_{i-1}</math>, adding a fresh color if needed. The quality of the resulting coloring depends on the chosen ordering. There exists an ordering that leads to a greedy coloring with the optimal number of <math>\chi(G)</math> colors. On the other hand, greedy colorings can be arbitrarily bad; for example, the [[crown graph]] on ''n'' vertices can be 2-colored, but has an ordering that leads to a greedy coloring with <math>n/2</math> colors.
The [[greedy algorithm]] considers the vertices in a specific order <math>v_1</math>, ..., <math> v_n</math> and assigns to <math>v_i</math> the smallest available color not used by <math>v_i</math>'s neighbours among <math>v_1</math>, ..., <math> v_{i-1}</math>, adding a fresh color if needed. The quality of the resulting coloring depends on the chosen ordering. There exists an ordering that leads to a greedy coloring with the optimal number of <math>\chi(G)</math> colors. On the other hand, greedy colorings can be arbitrarily bad; for example, the [[crown graph]] on ''n'' vertices can be 2-colored, but has an ordering that leads to a greedy coloring with <math>n/2</math> colors.


For [[chordal graph]]s, and for special cases of chordal graphs such as [[interval graph]]s and [[indifference graph]]s, 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. The [[perfectly orderable graph]]s generalize this property, but it is NP-hard to find a perfect ordering of these graphs.
For [[chordal graph]]s, and for special cases of chordal graphs such as [[interval graph]]s and [[indifference graph]]s, 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. The [[perfectly orderable graph]]s generalize this property, but it is NP-hard to find a perfect ordering of these graphs.


If the vertices are ordered according to their [[degree (graph theory)|degree]]s, the resulting greedy coloring uses at most <math>\text{max}_i \text{ min}
If the vertices are ordered according to their [[degree (graph theory)|degree]]s, the resulting greedy coloring uses at most <math>\text{max}_i \text{ min}
\{d(x_i ) + 1, i\}</math> colors, at most one more than the graph's maximum degree. This heuristic is sometimes called the Welsh–Powell algorithm.{{sfnp|Welsh|Powell|1967}} Another heuristic due to [[Daniel Brélaz|Brélaz]] establishes the ordering dynamically while the algorithm proceeds, choosing next the vertex adjacent to the largest number of different colors.{{sfnp|Brélaz|1979}} Many other graph coloring heuristics are similarly based on greedy coloring for a specific static or dynamic strategy of ordering the vertices, these algorithms are sometimes called '''sequential coloring''' algorithms.
\{d(x_i ) + 1, i\}</math> colors, at most one more than the graph's maximum degree. This heuristic is sometimes called the Welsh–Powell algorithm.{{sfnp|Welsh|Powell|1967}} Another heuristic due to [[Daniel Brélaz|Brélaz]] establishes the ordering dynamically while the algorithm proceeds, choosing next the vertex adjacent to the largest number of different colors.{{sfnp|Brélaz|1979}} Many other graph coloring heuristics are similarly based on greedy coloring for a specific static or dynamic strategy of ordering the vertices, these algorithms are sometimes called '''sequential coloring''' algorithms.


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.
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.
Line 307: Line 305:


=== Decentralized algorithms ===
=== Decentralized algorithms ===
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. 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. 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). This sensing information is sufficient to allow algorithms based on learning automata to find a proper graph coloring with probability one.<ref>E.g. see {{harvtxt|Leith|Clifford|2006}} and {{harvtxt|Duffy|O'Connell|Sapozhnikov|2008}}.</ref>
Decentralized algorithms are ones where no [[message passing]] is allowed (in contrast to distributed algorithms where local message passing takes place), and efficient decentralized algorithms exist that will color a graph if a proper coloring exists. 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. 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). This sensing information is sufficient to allow algorithms based on learning automata to find a proper graph coloring with probability one.<ref>E.g. see {{harvtxt|Leith|Clifford|2006}} and {{harvtxt|Duffy|O'Connell|Sapozhnikov|2008}}.</ref>


=== Computational complexity ===
=== Computational complexity ===
Graph coloring is computationally hard. It is [[NP-complete]] to decide if a given graph admits a ''k''-coloring for a given ''k'' except for the cases ''k'' ∈ {{brace|0,1,2}}. In particular, it is NP-hard to compute the chromatic number.<ref>{{harvtxt|Garey|Johnson|Stockmeyer|1974}};  {{harvtxt|Garey|Johnson|1979}}.</ref> The 3-coloring problem remains NP-complete even on 4-regular [[planar graph]]s.{{sfnp|Dailey|1980}} On graphs with maximal degree 3 or less, however, [[Brooks' theorem]] implies that the 3-coloring problem can be solved in linear time. Further, 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. However, finding the [[lexicographic order|lexicographically]] smallest 4-coloring of a planar graph is NP-complete.{{sfnp|Khuller|Vazirani|1991}}
Graph coloring is computationally hard. It is [[NP-complete]] to decide if a given graph admits a ''k''-coloring for a given ''k'' except for the cases ''k'' ∈ {{brace|0,1,2}}. In particular, it is NP-hard to compute the chromatic number.<ref>{{harvtxt|Garey|Johnson|Stockmeyer|1974}};  {{harvtxt|Garey|Johnson|1979}}.</ref> The 3-coloring problem remains NP-complete even on 4-regular [[planar graph]]s.{{sfnp|Dailey|1980}} On graphs with maximal degree 3 or less, however, [[Brooks' theorem]] implies that the 3-coloring problem can be solved in linear time. Further, 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. However, finding the [[lexicographic order|lexicographically]] smallest 4-coloring of a planar graph is NP-complete.{{sfnp|Khuller|Vazirani|1991}}


The best known [[approximation algorithm]] computes a coloring of size at most within a factor ''O''(''n''(log&nbsp;log&nbsp;''n'')<sup>2</sup>(log&nbsp;n)<sup>−3</sup>) of the chromatic number.{{sfnp|Halldórsson|1993}} For all ''ε''&nbsp;>&nbsp;0, approximating the chromatic number within ''n''<sup>1&minus;''ε''</sup> is [[NP-hard]].{{sfnp|Zuckerman|2007}}
The best known [[approximation algorithm]] computes a coloring of size at most within a factor ''O''(''n''(log&nbsp;log&nbsp;''n'')<sup>2</sup>(log&nbsp;n)<sup>−3</sup>) of the chromatic number.{{sfnp|Halldórsson|1993}} For all ''ε''&nbsp;>&nbsp;0, approximating the chromatic number within ''n''<sup>1&minus;''ε''</sup> is [[NP-hard]].{{sfnp|Zuckerman|2007}}
Line 316: Line 314:
It is also NP-hard to color a 3-colorable graph with 5 colors,{{sfnp|Bulín|Krokhin|Opršal|2019}} 4-colorable graph with 7 colours,{{sfnp|Bulín|Krokhin|Opršal|2019}} and a ''k''-colorable graph with <math>\textstyle\binom k {\lfloor k/2 \rfloor} - 1</math> colors for ''k'' ≥ 5.{{sfnp|Wrochna|Živný|2020}}
It is also NP-hard to color a 3-colorable graph with 5 colors,{{sfnp|Bulín|Krokhin|Opršal|2019}} 4-colorable graph with 7 colours,{{sfnp|Bulín|Krokhin|Opršal|2019}} and a ''k''-colorable graph with <math>\textstyle\binom k {\lfloor k/2 \rfloor} - 1</math> colors for ''k'' ≥ 5.{{sfnp|Wrochna|Živný|2020}}


Computing the coefficients of the chromatic polynomial is [[Sharp-P-complete|♯P-hard]]. In fact, even computing the value of <math>\chi(G,k)</math> is ♯P-hard at any [[rational point]] ''k'' except for ''k''&nbsp;=&nbsp;1 and ''k''&nbsp;=&nbsp;2.{{sfnp|Jaeger|Vertigan|Welsh|1990}} There is no [[FPRAS]] for evaluating the chromatic polynomial at any rational point ''k''&nbsp;≥&nbsp;1.5 except for ''k''&nbsp;=&nbsp;2 unless [[NP (complexity)|NP]]&nbsp;=&nbsp;[[RP (complexity)|RP]].{{sfnp|Goldberg|Jerrum|2008}}
Computing the coefficients of the chromatic polynomial is [[Sharp-P-complete|#P-hard]]. In fact, even computing the value of <math>\chi(G,k)</math> is #P-hard at any [[rational point]] ''k'' except for ''k''&nbsp;=&nbsp;1 and ''k''&nbsp;=&nbsp;2.{{sfnp|Jaeger|Vertigan|Welsh|1990}} There is no [[FPRAS]] for evaluating the chromatic polynomial at any rational point ''k''&nbsp;≥&nbsp;1.5 except for ''k''&nbsp;=&nbsp;2 unless [[NP (complexity)|NP]]&nbsp;=&nbsp;[[RP (complexity)|RP]].{{sfnp|Goldberg|Jerrum|2008}}


For edge coloring, the proof of Vizing's result gives an algorithm that uses at most Δ+1 colors. However, deciding between the two candidate values for the edge chromatic number is NP-complete.{{sfnp|Holyer|1981}} In terms of approximation algorithms, Vizing's algorithm shows that the edge chromatic number can be approximated to within 4/3,
For edge coloring, the proof of Vizing's result gives an algorithm that uses at most Δ+1 colors. However, deciding between the two candidate values for the edge chromatic number is NP-complete.{{sfnp|Holyer|1981}} In terms of approximation algorithms, Vizing's algorithm shows that the edge chromatic number can be approximated to within 4/3,
Line 334: Line 332:
A [[compiler]] is a [[computer program]] that translates one [[computer language]] into another. 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 register]]s. Ideally, values are assigned to registers so that they can all reside in the registers when they are used.
A [[compiler]] is a [[computer program]] that translates one [[computer language]] into another. 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 register]]s. Ideally, values are assigned to registers so that they can all reside in the registers when they are used.


The textbook approach to this problem is to model it as a graph coloring problem.{{sfnp|Chaitin|1982}} The compiler constructs an ''interference graph'', where vertices are variables and an edge connects two vertices if they are needed at the same time. 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.
The textbook approach to this problem is to model it as a graph coloring problem.{{sfnp|Chaitin|1982}} The compiler constructs an ''interference graph'', where vertices are variables and an edge connects two vertices if they are needed at the same time. 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.


=== Other applications===
=== Other applications===


The problem of coloring a graph arises in many practical areas such as sports scheduling,{{sfnp|Lewis|2021|loc=Chapter 8: Designing sports leagues|pp=221–246}} designing seating plans,{{sfnp|Lewis|2021|loc=Chapter 7: Designing seating plans|pp=203–220}} exam timetabling,{{sfnp|Lewis|2021|loc=Chapter 9: Designing university timetables|pp=247–276}} the scheduling of taxis,{{sfnp|Lewis|2021|loc=Section 1.1.3: Scheduling taxis|pp=5–6}} and solving [[Sudoku]] puzzles.{{sfnp|Lewis|2021|loc=Section 6.4: Latin squares and sudoku puzzles|pp=172–179}}
The problem of coloring a graph arises in many practical areas such as sports scheduling,{{sfnp|Lewis|2021|loc=Chapter 8: Designing sports leagues|pp=221–246}} designing seating plans,{{sfnp|Lewis|2021|loc=Chapter 7: Designing seating plans|pp=203–220}} exam timetabling,{{sfnp|Lewis|2021|loc=Chapter 9: Designing university timetables|pp=247–276}} the scheduling of taxis,{{sfnp|Lewis|2021|loc=Section 1.1.3: Scheduling taxis|pp=5–6}} and solving [[Sudoku]] puzzles.{{sfnp|Lewis|2021|loc=Section 6.4: Latin squares and sudoku puzzles|pp=172–179}}


== Other colorings ==
== Other colorings ==
Line 356: Line 354:
For each vertex v in G, the color sum of {{math|v, &sigma;(v)}}, is the sum of all of the adjacent vertices to v mod k. The color sum of v is denoted by
For each vertex v in G, the color sum of {{math|v, &sigma;(v)}}, is the sum of all of the adjacent vertices to v mod k. The color sum of v is denoted by


:{{math|1= &sigma;(v) = &sum;<sub>u &in; N(v)</sub> c(u)}}
:{{math|1= &sigma;(v) = &sum;<sub>u &in; N(v)</sub> c(u),}}


where u is an arbitrary vertex in the neighborhood of v, N(v). We then color each vertex with the new coloring determined by the sum of the adjacent vertices. The graph G has a modular k-coloring if, for every pair of adjacent vertices a,b, &sigma;(a) &ne; &sigma;(b). The modular chromatic number of G, mc(G), is the minimum value of k such that there exists a modular k-coloring of G.<
where u is an arbitrary vertex in the neighborhood of v, N(v). We then color each vertex with the new coloring determined by the sum of the adjacent vertices. The graph G has a modular k-coloring if, for every pair of adjacent vertices a,b, &sigma;(a) &ne; &sigma;(b). The modular chromatic number of G, mc(G), is the minimum value of k such that there exists a modular k-coloring of G.<
Line 367: Line 365:
; [[Adjacent-vertex-distinguishing-total coloring]] : A total coloring with the additional restriction that any two adjacent vertices have different color sets
; [[Adjacent-vertex-distinguishing-total coloring]] : A total coloring with the additional restriction that any two adjacent vertices have different color sets
; [[Acyclic coloring]] : Every 2-chromatic subgraph is acyclic
; [[Acyclic coloring]] : Every 2-chromatic subgraph is acyclic
; [[B-coloring]] : a coloring of the vertices where each color class contains a vertex that has a neighbor in all other color classes.
; [[B-coloring]] : Each color class contains a vertex that has a neighbor in all other color classes.
; Bounded Coloring : a coloring in which the number of vertices per color is bounded
; Bounded Coloring : A coloring in which the number of vertices per color is bounded
; [[Centered coloring]]: Every connected [[induced subgraph]] has a color that is used exactly once
; [[Circular coloring]] : Motivated by task systems in which production proceeds in a cyclic way
; [[Circular coloring]] : Motivated by task systems in which production proceeds in a cyclic way
; [[Cocoloring]] : An improper vertex coloring where every color class induces an independent set or a clique
; [[Cocoloring]] : An improper vertex coloring where every color class induces an independent set or a clique
Line 382: Line 381:
; [[Perfect matching#Connection to Graph Coloring|Inherited vertex coloring]] : A set of vertex colorings induced by perfect matchings of [[Edge_coloring|edge-colored Graphs]].
; [[Perfect matching#Connection to Graph Coloring|Inherited vertex coloring]] : A set of vertex colorings induced by perfect matchings of [[Edge_coloring|edge-colored Graphs]].
{{Col-break}}
{{Col-break}}
; [[Interval edge coloring]] : A color of edges meeting in a common vertex must be contiguous
; [[Interval coloring]] : A partition of vertices of an [[ordered graph]] into intervals such that two adjacent vertices in the same interval
; [[Interval edge coloring]] : A color of edges meeting in a common vertex must be contiguous (unrelated to the above entry)
; [[List coloring]]: Each vertex chooses from a list of colors
; [[List coloring]]: Each vertex chooses from a list of colors
; [[List edge-coloring]]:Each edge chooses from a list of colors
; [[List edge-coloring]]:Each edge chooses from a list of colors
; [[L(h, k)-coloring|L(''h'', ''k'')-coloring]]: Difference of colors at adjacent vertices is at least ''h'' and difference of colors of vertices at a distance two is at least ''k''. A particular case is [[L(2,1)-coloring]].
; [[L(h, k)-coloring|L(''h'', ''k'')-coloring]]: Difference of colors at adjacent vertices is at least ''h'' and difference of colors of vertices at a distance two is at least ''k''. A particular case is [[L(2,1)-coloring]].
; [[Oriented coloring]] : Takes into account orientation of edges of the graph
; [[Oriented coloring]] : Takes into account orientation of edges of the graph
; [[Packing coloring]] : The distance between any two vertices with the same color must be greater than the assigned color's value
; [[Path coloring]] : Models a routing problem in graphs
; [[Path coloring]] : Models a routing problem in graphs
; [[Radio coloring]] : Sum of the distance between the vertices and the difference of their colors is greater than ''k'' + 1, where ''k'' is a positive integer.
; [[Radio coloring]] : Sum of the distance between the vertices and the difference of their colors is greater than ''k'' + 1, where ''k'' is a positive integer.
Line 397: Line 398:
; [[T-coloring|''T''-coloring]] : Absolute value of the difference between two colors of adjacent vertices must not belong to fixed set ''T''
; [[T-coloring|''T''-coloring]] : Absolute value of the difference between two colors of adjacent vertices must not belong to fixed set ''T''
; [[Total coloring]] :Vertices and edges are colored
; [[Total coloring]] :Vertices and edges are colored
; [[Tree-depth|Centered coloring]]: Every connected [[induced subgraph]] has a color that is used exactly once
; [[Monochromatic triangle|Triangle-free edge coloring]]: The edges are colored so that each color class forms a [[triangle-free graph|triangle-free]] subgraph
; [[Monochromatic triangle|Triangle-free edge coloring]]: The edges are colored so that each color class forms a [[triangle-free graph|triangle-free]] subgraph
; [[Weak coloring]] : An improper vertex coloring where every non-isolated node has at least one neighbor with a different color
; [[Weak coloring]] : An improper vertex coloring where every non-isolated node has at least one neighbor with a different color

Latest revision as of 21:52, 13 December 2025

Template:Short description

File:Petersen graph 3-coloring.svg
A proper vertex coloring of the Petersen graph with 3 colors, the minimum number possible.

In graph theory, graph coloring is a methodic assignment of labels traditionally called "colors" to elements of a graph. The assignment is subject to certain constraints, such as that no two adjacent elements have the same color. Graph coloring is a special case of graph labeling. 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. 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.

Vertex coloring is often used to introduce graph coloring problems, since other coloring problems can be transformed into a vertex coloring instance. 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. However, non-vertex coloring problems are often stated and studied as-is. This is partly pedagogical, and partly because some problems are best studied in their non-vertex form, as in the case of edge coloring.

The convention of using colors originates from coloring the countries in a political 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 non-negative 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.

Template:Xref

History

Script error: No such module "Labelled list hatnote".

File:Map of United States vivid colors shown.png
A map of the United States using colors to follow the four color theorem.

The first results about graph coloring deal almost exclusively with planar graphs in the form of map coloring. While trying to color a map of the counties of England in 1852, 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.[1] Guthrie's brother Frederick 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. Arthur Cayley raised the problem at a meeting of the London Mathematical Society in 1879. 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. For his accomplishment Kempe was elected a Fellow of the Royal Society and later President of the London Mathematical Society.[2]

In 1890, Percy John Heawood pointed out that Kempe's argument was wrong. 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. In the following century, a vast amount of work was done 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. The proof went back to the ideas of Heawood and Kempe and largely disregarded the intervening developments.Template:Sfnp The proof of the four color theorem is noteworthy, aside from its solution of a century-old problem, for being the first major computer-aided proof.

In 1912, George David Birkhoff introduced the chromatic polynomial to study the coloring problem, which was generalised to the Tutte polynomial by W. T. Tutte, both of which are important invariants in algebraic graph theory. Kempe had already drawn attention to the general, non-planar case in 1879,Template:Sfnp and many results on generalisations of planar graph coloring to surfaces of higher order followed in the early 20th century.

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. 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 has been studied as an algorithmic problem since the early 1970s: the chromatic number problem (see section Template:Slink below) 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 Script error: No such module "Footnotes".. One of the major applications of graph coloring, register allocation in compilers, was introduced in 1981.

Definition and terminology

File:Graph with all three-colourings 2.svg
This graph can be 3-colored in 12 different ways.

Vertex coloring

When used without any qualification, a coloring of a graph almost always refers to 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. 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.

The terminology of using colors for vertex labels goes back to map coloring. 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 Template:MsetScript error: No such module "Check for unknown parameters"..

Script error: No such module "anchor". A coloring using at most Template:Mvar colors is called a (proper) Template:Mvar-coloring. The smallest number of colors needed to color a graph Template:Mvar is called its chromatic number, and is often denoted χ(G)Script error: No such module "Check for unknown parameters"..[3] Sometimes γ(G)Script error: No such module "Check for unknown parameters". is used, since χ(G)Script error: No such module "Check for unknown parameters". is also used to denote the Euler characteristic of a graph.[4] A graph that can be assigned a (proper) Template:Mvar-coloring is Template:Mvar-colorable, and it is Template:Mvar-chromatic if its chromatic number is exactly Template:Mvar. A subset of vertices assigned to the same color is called a color class; every such class forms an independent set. Thus, a Template:Mvar-coloring is the same as a partition of the vertex set into Template:Mvar independent sets, and the terms Template:Mvar-partite and Template:Mvar-colorable have the same meaning.

Chromatic polynomial

File:Chromatic polynomial of all 3-vertex graphs.png
All non-isomorphic graphs on 3 vertices and their chromatic polynomials. The empty graph E3Script error: No such module "Check for unknown parameters". (red) admits a 1-coloring; the complete graph K3Script error: No such module "Check for unknown parameters". (blue) admits a 3-coloring; the other graphs admit a 2-coloring.

Script error: No such module "Labelled list hatnote".

The chromatic polynomial counts the number of ways a graph can be colored using some of a given number of colors. For example, using three colors, the graph in the adjacent image 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:

Available colors 1 2 3 4 ...
Number of colorings 0 0 12 72 ...

The chromatic polynomial is a function P(G, t)Script error: No such module "Check for unknown parameters". that counts the number of Template:Mvar-colorings of Template:Mvar. As the name indicates, for a given Template:Mvar the function is indeed a polynomial in Template:Mvar. For the example graph, P(G, t) = t(t − 1)2(t − 2)Script error: No such module "Check for unknown parameters"., and indeed P(G, 4) = 72Script error: No such module "Check for unknown parameters"..

The chromatic polynomial includes more information about the colorability of Template:Mvar than does the chromatic number. Indeed, Template:Mvar is the smallest positive integer that is not a zero of the chromatic polynomial χ(G) = minTemplate:BraceScript error: No such module "Check for unknown parameters"..

Chromatic polynomials for certain graphs
Triangle K3Script error: No such module "Check for unknown parameters". t(t − 1)(t − 2)Script error: No such module "Check for unknown parameters".
Complete graph Template:Mvar t(t − 1)(t − 2) ... (t − (n − 1))Script error: No such module "Check for unknown parameters".
Tree with Template:Mvar vertices t(t − 1)n−1Script error: No such module "Check for unknown parameters".
Cycle Template:Mvar (t − 1)n + (−1)n(t − 1)Script error: No such module "Check for unknown parameters".
Petersen graph t(t − 1)(t − 2)(t7 − 12t6 + 67t5 − 230t4 + 529t3 − 814t2 + 775t − 352)Script error: No such module "Check for unknown parameters".

Edge coloring

Script error: No such module "Labelled list hatnote".

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. An edge coloring with Template:Mvar colors is called a Template:Mvar-edge-coloring and is equivalent to the problem of partitioning the edge set into Template:Mvar matchings. The smallest number of colors needed for an edge coloring of a graph Template:Mvar is the chromatic index, or edge chromatic number, Template:Prime(G)Script error: No such module "Check for unknown parameters".. A Tait coloring is a 3-edge coloring of a cubic graph. The four color theorem is equivalent to the assertion that every planar cubic bridgeless graph admits a Tait coloring.

Total coloring

Script error: No such module "Labelled list hatnote".

Total coloring is a type of coloring on the vertices and edges of a graph. 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. The total chromatic number χTemplate:Pprime(G)Script error: No such module "Check for unknown parameters". of a graph Template:Mvar is the fewest colors needed in any total coloring of Template:Mvar.

Face coloring

For a graph with a strong embedding on a surface, the face coloring is the dual of the vertex coloring problem.

Tutte's flow theory

For a graph Template:Mvar with a strong embedding on an orientable surface, William T. Tutte[5][6][7] discovered that if the graph is Template:Mvar-face-colorable then Template:Mvar admits a nowhere-zero Template:Mvar-flow. The equivalence holds if the surface is sphere.

Unlabeled coloring

An unlabeled coloring of a graph is an orbit of a coloring under the action of the automorphism group of the graph. The colors remain labeled; it is the graph that is unlabeled. There is an analogue of the chromatic polynomial which counts the number of unlabeled colorings of a graph from a given finite color set.

If we interpret a coloring of a graph on Template:Mvar vertices as a vector in Template:Tmath, the action of an automorphism is a permutation of the coefficients in the coloring vector.

Properties

Upper bounds on the chromatic number

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

1χ(G)n.

The only graphs that can be 1-colored are edgeless graphs. A complete graph Kn of n vertices requires χ(Kn)=n colors. In an optimal coloring there must be at least one of the graph's m edges between every pair of color classes, so

χ(G)(χ(G)1)2m.

More generally a family of graphs is χScript error: No such module "Check for unknown parameters".-bounded if there is some function c such that the graphs G in can be colored with at most c(ω(G)) colors, where ω(G) is the clique number of G. For the family of the perfect graphs this function is c(ω(G))=ω(G).

The 2-colorable graphs are exactly the bipartite graphs, including trees and forests. By the four color theorem, every planar graph can be 4-colored.

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

χ(G)Δ(G)+1.

Complete graphs have χ(G)=n and Δ(G)=n1, and odd cycles have χ(G)=3 and Δ(G)=2, so for these graphs this bound is best possible. In all other cases, the bound can be slightly improved; Brooks' theoremTemplate:Sfnp states that

Brooks' theorem: χ(G)Δ(G) for a connected, simple graph G, unless G is a complete graph or an odd cycle.

Lower bounds on the chromatic number

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

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:

χ(G)ω(G).

For perfect graphs this bound is tight. Finding cliques is known as the clique problem.

Hoffman's bound: Let W be a real symmetric matrix such that Wi,j=0 whenever (i,j) is not an edge in G. Define χW(G)=1λmax(W)λmin(W), where λmax(W),λmin(W) are the largest and smallest eigenvalues of W. Define χH(G)=maxWχW(G), with W as above. Then:

χH(G)χ(G).

Template:Vanchor: Let W be a positive semi-definite matrix such that Wi,j1k1 whenever (i,j) is an edge in G. Define χV(G) to be the least k for which such a matrix W exists. Then

χV(G)χ(G).

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

ϑ(G¯)χ(G).

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

χf(G)χ(G).

These bounds are ordered as follows:

χH(G)χV(G)ϑ(G¯)χf(G)χ(G).

Graphs with high chromatic number

Graphs with large cliques have a high chromatic number, but the opposite is not true. The Grötzsch graph is an example of a 4-chromatic graph without a triangle, and the example can be generalized to the Mycielskians.

Theorem (W. T. Tutte, [[#Template:Harvid|1947]],Template:Sfnp Alexander Zykov 1949, Jan Mycielski 1955): There exist triangle-free graphs with arbitrarily high chromatic number.

To prove this, both, Mycielski and Zykov, each gave a construction of an inductively defined family of triangle-free graphs but with arbitrarily large chromatic number.Template:Sfnp Script error: No such module "Footnotes". constructed axis aligned boxes in 3 whose intersection graph is triangle-free and requires arbitrarily many colors to be properly colored. This family of graphs is then called the Burling graphs. The same class of graphs is used for the construction of a family of triangle-free line segments in the plane, given by Pawlik et al. (2014).Template:Sfnp It shows that the chromatic number of its intersection graph is arbitrarily large as well. Hence, this implies that axis aligned boxes in 3 as well as line segments in 2 are not χ-bounded.Template:Sfnp

From Brooks's theorem, graphs with high chromatic number must have high maximum degree. 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:

Theorem (Erdős): There exist graphs of arbitrarily high girth and chromatic number.Template:Sfnp

Bounds on the chromatic index

An edge coloring of G is a vertex coloring of its line graph L(G), and vice versa. Thus,

χ(G)=χ(L(G)).

There is a strong relationship between edge colorability and the graph's maximum degree Δ(G). Since all edges incident to the same vertex need their own color, we have

χ(G)Δ(G).

Moreover,

Kőnig's theorem: χ(G)=Δ(G) if G is bipartite.

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

Vizing's Theorem: A graph of maximal degree Δ has edge-chromatic number Δ or Δ+1.

Other properties

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 Script error: No such module "Footnotes"..

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

About infinite graphs, much less is known. The following are two of the few results about infinite graph coloring:

  • 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 Script error: No such module "Footnotes"..
  • If a graph admits a full n-coloring for every nn0, it admits an infinite full coloring Script error: No such module "Footnotes"..

Open problems

As stated above, ω(G)χ(G)Δ(G)+1. A conjecture of Reed from 1998 is that the value is essentially closer to the lower bound, χ(G)ω(G)+Δ(G)+12.

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

When Birkhoff and Lewis introduced the chromatic polynomial in their attack on the four color theorem, they conjectured that for planar graphs G, the polynomial P(G,t) has no zeros in the region [4,). Although it is known that such a chromatic polynomial has no zeros in the region [5,) and that P(G,4)0, their conjecture is still unresolved. It also remains an unsolved problem to characterize graphs which have the same chromatic polynomial and to determine which polynomials are chromatic.

Algorithms

Script error: No such module "Infobox".Template:Template other

Polynomial time

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. More generally, the chromatic number and a corresponding coloring of perfect graphs can be computed in polynomial time using semidefinite programming. Closed formulas for chromatic polynomials are known for many classes of graphs, such as forests, chordal graphs, cycles, wheels, and ladders, so these can be evaluated in polynomial time.

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. In general, the time required is polynomial in the graph size, but exponential in the branch-width.

Exact algorithms

Brute-force search for a k-coloring considers each of the kn assignments of k colors to n vertices and checks for each if it is legal. To compute the chromatic number and the chromatic polynomial, this procedure is used for every k=1,,n1, impractical for all but the smallest input graphs.

Using dynamic programming and a bound on the number of maximal independent sets, k-colorability can be decided in time and space O(2.4423n).Template:Sfnp Using the principle of inclusion–exclusion and Yates's algorithm for the fast zeta transform, k-colorability can be decided in time O(2nn)Template:SfnpTemplate:SfnpTemplate:SfnpTemplate:Sfnp for any k. Faster algorithms are known for 3- and 4-colorability, which can be decided in time O(1.3289n)Template:Sfnp and O(1.7272n),Template:Sfnp respectively. Exponentially faster algorithms are also known for 5- and 6-colorability, as well as for restricted families of graphs, including sparse graphs.Template:Sfnp

Contraction

The contraction G/uv of a graph G is the graph obtained by identifying the vertices u and v, and removing any edges between them. The remaining edges originally incident to u or v are now incident to their identification (i.e., the new fused node uv). This operation plays a major role in the analysis of graph coloring.

The chromatic number satisfies the recurrence relation:

χ(G)=min{χ(G+uv),χ(G/uv)}

due to Script error: No such module "Footnotes"., where u and v are non-adjacent vertices, and G+uv is the graph with the edge Template:Mvar added. Several algorithms are based on evaluating this recurrence and the resulting computation tree is sometimes called a Zykov tree. The running time is based on a heuristic for choosing the vertices u and v.

The chromatic polynomial satisfies the following recurrence relation

P(Guv,k)=P(G/uv,k)+P(G,k),

where u and v are adjacent vertices, and Guv is the graph with the edge Template:Mvar removed. P(Guv,k) represents the number of possible proper colorings of the graph, where the vertices may have the same or different colors. Then the proper colorings arise from two different graphs. To explain, if the vertices u and v have different colors, then we might as well consider a graph where u and v are adjacent. If u and v have the same colors, we might as well consider a graph where u and v are contracted. Tutte's curiosity about which other graph properties satisfied this recurrence led him to discover a bivariate generalization of the chromatic polynomial, the Tutte polynomial.

These expressions give rise to a recursive procedure called the deletion–contraction algorithm, which forms the basis of many algorithms for graph coloring. The running time satisfies the same recurrence relation as the Fibonacci numbers, so in the worst case the algorithm runs in time within a polynomial factor of (1+52)n+m=O(1.6180n+m) for n vertices and m edges.Template:Sfnp The analysis can be improved to within a polynomial factor of the number t(G) of spanning trees of the input graph.Template:Sfnp In practice, branch and bound strategies and graph isomorphism rejection are employed to avoid some recursive calls. The running time depends on the heuristic used to pick the vertex pair.

Greedy coloring

Script error: No such module "Labelled list hatnote".

File:Greedy colourings.svg
Two greedy colorings of the same graph using different vertex orders. The right example generalizes to 2-colorable graphs with n vertices, where the greedy algorithm expends n/2 colors.

The greedy algorithm considers the vertices in a specific order v1, ..., vn and assigns to vi the smallest available color not used by vi's neighbours among v1, ..., vi1, adding a fresh color if needed. The quality of the resulting coloring depends on the chosen ordering. There exists an ordering that leads to a greedy coloring with the optimal number of χ(G) colors. On the other hand, greedy colorings can be arbitrarily bad; for example, the crown graph on n vertices can be 2-colored, but has an ordering that leads to a greedy coloring with n/2 colors.

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. The perfectly orderable graphs generalize this property, but it is NP-hard to find a perfect ordering of these graphs.

If the vertices are ordered according to their degrees, the resulting greedy coloring uses at most maxi min{d(xi)+1,i} colors, at most one more than the graph's maximum degree. This heuristic is sometimes called the Welsh–Powell algorithm.Template:Sfnp Another heuristic due to Brélaz establishes the ordering dynamically while the algorithm proceeds, choosing next the vertex adjacent to the largest number of different colors.Template:Sfnp Many other graph coloring heuristics are similarly based on greedy coloring for a specific static or dynamic strategy of ordering the vertices, these algorithms are sometimes called sequential coloring algorithms.

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.

Heuristic algorithms

Two well-known polynomial-time heuristics for graph colouring are the DSatur and recursive largest first (RLF) algorithms.

Similarly to the greedy colouring algorithm, DSatur colours the vertices of a graph one after another, expending a previously unused colour when needed. Once a new vertex has been coloured, the algorithm determines which of the remaining uncoloured vertices has the highest number of different colours in its neighbourhood and colours this vertex next. This is defined as the degree of saturation of a given vertex.

The recursive largest first algorithm operates in a different fashion by constructing each color class one at a time. It does this by identifying a maximal independent set of vertices in the graph using specialised heuristic rules. It then assigns these vertices to the same color and removes them from the graph. These actions are repeated on the remaining subgraph until no vertices remain.

The worst-case complexity of DSatur is O(n2), where n is the number of vertices in the graph. The algorithm can also be implemented using a binary heap to store saturation degrees, operating in O((n+m)logn) where m is the number of edges in the graph.Template:Sfnp This produces much faster runs with sparse graphs. The overall complexity of RLF is slightly higher than DSatur at O(mn).Template:Sfnp

DSatur and RLF are exact for bipartite, cycle, and wheel graphs.Template:Sfnp

Parallel and distributed algorithms

It is known that a Template:Mvar-chromatic graph can be Template:Mvar-colored in the deterministic LOCAL model, in O(n1/α). rounds, with α=c1χ1. A matching lower bound of Ω(n1/α) rounds is also known. This lower bound holds even if quantum computers that can exchange quantum information, possibly with a pre-shared entangled state, are allowed.

In the field of distributed algorithms, graph coloring is closely related to the problem of symmetry breaking. The current state-of-the-art randomized algorithms are faster for sufficiently large maximum degree Δ than deterministic algorithms. The fastest randomized algorithms employ the multi-trials technique by Schneider and Wattenhofer.Template:Sfnp

In a symmetric graph, a deterministic distributed algorithm cannot find a proper vertex coloring. Some auxiliary information is needed in order to break symmetry. A standard assumption is that initially each node has a unique identifier, for example, from the set Template:Mset. Put otherwise, we assume that we are given an n-coloring. The challenge is to reduce the number of colors from n to, e.g., Δ + 1. The more colors are employed, e.g. O(Δ) instead of Δ + 1, the fewer communication rounds are required.Template:Sfnp

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.

The simplest interesting case is an n-cycle. Richard Cole and Uzi Vishkin[8] show that there is a distributed algorithm that reduces the number of colors from n to O(log n) in one synchronous communication step. By iterating the same procedure, it is possible to obtain a 3-coloring of an n-cycle in O(Template:Log-star n) communication steps (assuming that we have unique node identifiers).

The function Template:Log-star, iterated logarithm, is an extremely slowly growing function, "almost constant". 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. Script error: No such module "Footnotes". showed that this is not possible: any deterministic distributed algorithm requires Ω(Template:Log-star n) communication steps to reduce an n-coloring to a 3-coloring in an n-cycle.

The technique by Cole and Vishkin can be applied in arbitrary bounded-degree graphs as well; the running time is poly(Δ) + O(Template:Log-star n).Template:Sfnp The technique was extended to unit disk graphs by Schneider and Wattenhofer.Template:Sfnp The fastest deterministic algorithms for (Δ + 1)-coloring for small Δ are due to Leonid Barenboim, Michael Elkin and Fabian Kuhn.[9] The algorithm by Barenboim et al. runs in time O(Δ) + Template:Log-star(n)/2, which is optimal in terms of n since the constant factor 1/2 cannot be improved due to Linial's lower bound. Script error: No such module "Footnotes". use network decompositions to compute a Δ+1 coloring in time 2O(logn).

The problem of edge coloring has also been studied in the distributed model. Script error: No such module "Footnotes". achieve a (2Δ − 1)-coloring in O(Δ + Template:Log-star n) time in this model. The lower bound for distributed vertex coloring due to Script error: No such module "Footnotes". applies to the distributed edge coloring problem as well.

Decentralized algorithms

Decentralized algorithms are ones where no message passing is allowed (in contrast to distributed algorithms where local message passing takes place), and efficient decentralized algorithms exist that will color a graph if a proper coloring exists. 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. 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). This sensing information is sufficient to allow algorithms based on learning automata to find a proper graph coloring with probability one.[10]

Computational complexity

Graph coloring is computationally hard. It is NP-complete to decide if a given graph admits a k-coloring for a given k except for the cases kTemplate:Brace. In particular, it is NP-hard to compute the chromatic number.[11] The 3-coloring problem remains NP-complete even on 4-regular planar graphs.Template:Sfnp On graphs with maximal degree 3 or less, however, Brooks' theorem implies that the 3-coloring problem can be solved in linear time. Further, 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. However, finding the lexicographically smallest 4-coloring of a planar graph is NP-complete.Template:Sfnp

The best known approximation algorithm computes a coloring of size at most within a factor O(n(log log n)2(log n)−3) of the chromatic number.Template:Sfnp For all ε > 0, approximating the chromatic number within n1−ε is NP-hard.Template:Sfnp

It is also NP-hard to color a 3-colorable graph with 5 colors,Template:Sfnp 4-colorable graph with 7 colours,Template:Sfnp and a k-colorable graph with (kk/2)1 colors for k ≥ 5.Template:Sfnp

Computing the coefficients of the chromatic polynomial is #P-hard. In fact, even computing the value of χ(G,k) is #P-hard at any rational point k except for k = 1 and k = 2.Template:Sfnp There is no FPRAS for evaluating the chromatic polynomial at any rational point k ≥ 1.5 except for k = 2 unless NP = RP.Template:Sfnp

For edge coloring, the proof of Vizing's result gives an algorithm that uses at most Δ+1 colors. However, deciding between the two candidate values for the edge chromatic number is NP-complete.Template:Sfnp 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. These are among the oldest results in the literature of approximation algorithms, even though neither paper makes explicit use of that notion.Template:Sfnp

Applications

Scheduling

Vertex coloring models to a number of scheduling problems.Template:Sfnp In the cleanest form, a given set of jobs need to be assigned to time slots, each job requires one such slot. 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. The corresponding graph contains a vertex for every job and an edge for every conflicting pair of jobs. The chromatic number of the graph is exactly the minimum makespan, the optimal time to finish all jobs without conflicts.

Details of the scheduling problem define the structure of the graph. For example, when assigning aircraft to flights, the resulting conflict graph is an interval graph, so the coloring problem can be solved efficiently. In bandwidth allocation to radio stations, the resulting conflict graph is a unit disk graph, so the coloring problem is 3-approximable.

Register allocation

Script error: No such module "Labelled list hatnote".

A compiler is a computer program that translates one computer language into another. 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. Ideally, values are assigned to registers so that they can all reside in the registers when they are used.

The textbook approach to this problem is to model it as a graph coloring problem.Template:Sfnp The compiler constructs an interference graph, where vertices are variables and an edge connects two vertices if they are needed at the same time. 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.

Other applications

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

Other colorings

Ramsey theory

Script error: No such module "Labelled list hatnote".

An important class of improper coloring problems is studied in Ramsey theory, where the graph's edges are assigned to colors, and there is no restriction on the colors of incident edges. A simple example is the theorem on friends and strangers, which states that in any coloring of the edges of K6, the complete graph of six vertices, there will be a monochromatic triangle; often illustrated by saying that any group of six people either has three mutual strangers or three mutual acquaintances. Ramsey theory is concerned with generalisations of this idea to seek regularity amid disorder, finding general conditions for the existence of monochromatic subgraphs with given structure.

Modular Coloring

Modular coloring is a type of graph coloring in which the color of each vertex is the sum of the colors of its adjacent vertices.

Let k ≥ 2Script error: No such module "Check for unknown parameters". be a number of colors where k is the set of integers modulo k consisting of the elements (or colors) 0,1,2, ..., k-2, k-1Script error: No such module "Check for unknown parameters".. First, we color each vertex in G using the elements of k, allowing two adjacent vertices to be assigned the same color. In other words, we want c to be a coloring such that c: V(G) → k where adjacent vertices can be assigned the same color.

For each vertex v in G, the color sum of v, σ(v)Script error: No such module "Check for unknown parameters"., is the sum of all of the adjacent vertices to v mod k. The color sum of v is denoted by

σ(v) = ∑u ∈ N(v) c(u),Script error: No such module "Check for unknown parameters".

where u is an arbitrary vertex in the neighborhood of v, N(v). We then color each vertex with the new coloring determined by the sum of the adjacent vertices. The graph G has a modular k-coloring if, for every pair of adjacent vertices a,b, σ(a) ≠ σ(b). The modular chromatic number of G, mc(G), is the minimum value of k such that there exists a modular k-coloring of G.<

For example, let there be a vertex v adjacent to vertices with the assigned colors 0, 1, 1, and 3 mod 4 (k=4). The color sum would be σ(v) = 0 + 1 + 1+ 3 mod 4 = 5 mod 4 = 1. This would be the new color of vertex v. We would repeat this process for every vertex in G. If two adjacent vertices have equal color sums, G does not have a modulo 4 coloring. If none of the adjacent vertices have equal color sums, G has a modulo 4 coloring.

Other colorings

<templatestyles src="Col-begin/styles.css"/>

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

See also

Notes

<templatestyles src="Reflist/styles.css" />

  1. Script error: No such module "citation/CS1".
  2. M. Kubale, History of graph coloring, in Script error: No such module "Footnotes"..
  3. Script error: No such module "citation/CS1".
  4. Script error: No such module "citation/CS1".
  5. Script error: No such module "Footnotes".
  6. Script error: No such module "Footnotes".
  7. Script error: No such module "Footnotes".
  8. Script error: No such module "Footnotes"., see also Script error: No such module "Footnotes"..
  9. Script error: No such module "Footnotes".; Script error: No such module "Footnotes"..
  10. E.g. see Script error: No such module "Footnotes". and Script error: No such module "Footnotes"..
  11. Script error: No such module "Footnotes".; Script error: No such module "Footnotes"..

Script error: No such module "Check for unknown parameters".

References

<templatestyles src="Refbegin/styles.css" />

  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1". (= Indag. Math. 13)
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".. Translated into English in Amer. Math. Soc. Translation, 1952, MRTemplate:Catalog lookup link.

External links

Template:Sister project

Template:Authority control