"},"label6":{"wt":"Complexity"},"data6":{"wt":"[[NPcomplete]]"},"label7":{"wt":"Reduction from"},"data7":{"wt":"[[3SAT3Satisfiability]]"},"label8":{"wt":"Garey–Johnson"},"data8":{"wt":"GT4"},"header9":{"wt":"Optimisation"},"label10":{"wt":"Name"},"data10":{"wt":"Chromatic number"},"label11":{"wt":"Input"},"data11":{"wt":"Graph ''G'' with ''n'' vertices."},"label12":{"wt":"Output"},"data12":{"wt":"χ(''G'')"},"label13":{"wt":"Complexity"},"data13":{"wt":"[[NPhard]]"},"label14":{"wt":"Approximability"},"data14":{"wt":"O(''n'' (log ''n'')−3(log log ''n'')2)"},"label15":{"wt":"Inapproximability"},"data15":{"wt":"O(''n''1−ε) unless [[P = NP]]"},"header16":{"wt":"Counting problem"},"label17":{"wt":"Name"},"data17":{"wt":"Chromatic polynomial"},"label19":{"wt":"Input"},"data19":{"wt":"Graph ''G'' with ''n'' vertices. Integer ''k''"},"label20":{"wt":"Output"},"data20":{"wt":"The number ''P'' (''G'',''k'') of proper ''k''colorings of ''G''"},"label21":{"wt":"Running time"},"data21":{"wt":"O(2 ''n''''n'')"},"label22":{"wt":"Complexity"},"data22":{"wt":"[[SharpPcomplete#Pcomplete]]"},"label23":{"wt":"Approximability"},"data23":{"wt":"[[FPRAS]] for restricted cases"},"label24":{"wt":"Inapproximability"},"data24":{"wt":"No [[Polynomialtime approximation schemePTAS]] unless P = NP"}},"i":0}}]}" id="mwAdE">
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 breadthfirst search or depthfirst 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 polynomial are known for many classes of graphs, such as forests, chordal graphs, cycles, wheels, and ladders, so these can be evaluated in polynomial time.
If the graph is planar and has low branchwidth (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 branchwidth.
Bruteforce search for a kcoloring considers each of the 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 , impractical for all but the smallest input graphs.
Using dynamic programming and a bound on the number of maximal independent sets, kcolorability can be decided in time and space .^{ [11] } Using the principle of inclusion–exclusion and Yates’s algorithm for the fast zeta transform, kcolorability can be decided in time ^{ [10] } for any k. Faster algorithms are known for 3 and 4colorability, which can be decided in time ^{ [12] } and ,^{ [13] } respectively.
The contraction 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. This operation plays a major role in the analysis of graph coloring.
The chromatic number satisfies the recurrence relation:
due to Zykov (1949), where u and v are nonadjacent vertices, and is the graph with the edge uv 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
where u and v are adjacent vertices, and is the graph with the edge uv removed. 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 for n vertices and m edges.^{ [14] } The analysis can be improved to within a polynomial factor of the number of spanning trees of the input graph.^{ [15] } 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.
The greedy algorithm considers the vertices in a specific order ,…, and assigns to the smallest available color not used by ’s neighbours among ,…,, 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 colors. On the other hand, greedy colorings can be arbitrarily bad; for example, the crown graph on n vertices can be 2colored, but has an ordering that leads to a greedy coloring with 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 NPhard to find a perfect ordering of these graphs.
If the vertices are ordered according to their degrees, the resulting greedy coloring uses at most colors, at most one more than the graph’s maximum degree. This heuristic is sometimes called the Welsh–Powell algorithm.^{ [16] } 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.^{ [17] } 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.
In the field of distributed algorithms, graph coloring is closely related to the problem of symmetry breaking. The current stateoftheart randomized algorithms are faster for sufficiently large maximum degree Δ than deterministic algorithms. The fastest randomized algorithms employ the multitrials technique by Schneider et al.^{ [18] }
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 {1, 2, ..., n}. Put otherwise, we assume that we are given an ncoloring. 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.^{ [18] }
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 ncycle. Richard Cole and Uzi Vishkin ^{ [19] } 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 3coloring of an ncycle in O(log* n) communication steps (assuming that we have unique node identifiers).
The function log*, 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 constanttime distributed algorithm for 3coloring an ncycle. Linial (1992) showed that this is not possible: any deterministic distributed algorithm requires Ω(log* n) communication steps to reduce an ncoloring to a 3coloring in an ncycle.
The technique by Cole and Vishkin can be applied in arbitrary boundeddegree graphs as well; the running time is poly(Δ) + O(log* n).^{ [20] } The technique was extended to unit disk graphs by Schneider et al.^{ [21] } The fastest deterministic algorithms for (Δ + 1)coloring for small Δ are due to Leonid Barenboim, Michael Elkin and Fabian Kuhn.^{ [22] } The algorithm by Barenboim et al. runs in time O(Δ) + log*(n)/2, which is optimal in terms of n since the constant factor 1/2 cannot be improved due to Linial's lower bound. Panconesi & Srinivasan (1996) use network decompositions to compute a Δ+1 coloring in time .
The problem of edge coloring has also been studied in the distributed model. Panconesi & Rizzi (2001) achieve a (2Δ − 1)coloring in O(Δ + log* n) time in this model. The lower bound for distributed vertex coloring due to Linial (1992) applies to the distributed edge coloring problem as well.
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.^{ [23] }
Graph coloring is computationally hard. It is NPcomplete to decide if a given graph admits a kcoloring for a given k except for the cases k ∈ {0,1,2} . In particular, it is NPhard to compute the chromatic number.^{ [24] } The 3coloring problem remains NPcomplete even on 4regular planar graphs.^{ [25] } However, for every k > 3, a kcoloring of a planar graph exists by the four color theorem, and it is possible to find such a coloring in polynomial time.
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.^{ [26] } For all ε > 0, approximating the chromatic number within n^{1−ε} is NPhard.^{ [27] }
It is also NPhard to color a 3colorable graph with 4 colors^{ [28] } and a kcolorable graph with k^{(log k ) / 25} colors for sufficiently large constant k.^{ [29] }
Computing the coefficients of the chromatic polynomial is #Phard. In fact, even computing the value of is #Phard at any rational point k except for k = 1 and k = 2.^{ [30] } There is no FPRAS for evaluating the chromatic polynomial at any rational point k ≥ 1.5 except for k = 2 unless NP = RP.^{ [31] }
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 NPcomplete.^{ [32] } 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.^{ [33] }
Vertex coloring models to a number of scheduling problems.^{ [34] } 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 3approximable.
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.^{ [35] } 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 problem of coloring a graph arises in many practical areas such as pattern matching, sports scheduling, designing seating plans, exam timetabling, the scheduling of taxis, and solving Sudoku puzzles.^{ [36] }
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 friendship theorem, which states that in any coloring of the edges of , 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.


Coloring can also be considered for signed graphs and gain graphs.
In graph theory, an edge coloring of a graph is an assignment of "colors" to the edges of the graph so that no two incident edges have the same color. For example, the figure to the right shows an edge coloring of a graph by the colors red, blue, and green. Edge colorings are one of several different types of graph coloring. The edgecoloring problem asks whether it is possible to color the edges of a given graph using at most k different colors, for a given value of k, or with the fewest possible colors. The minimum required number of colors for the edges of a given graph is called the chromatic index of the graph. For example, the edges of the graph in the illustration can be colored by three colors but cannot be colored by two colors, so the graph shown has chromatic index three.
In graph theory, a branch of mathematics, list coloring is a type of graph coloring where each vertex can be restricted to a list of allowed colors. It was first studied in the 1970s in independent papers by Vizing and by Erdős, Rubin, and Taylor.
In graph theory, total coloring is a type of graph 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 edges, no adjacent vertices and no edge and either endvertex are assigned the same color. The total chromatic number χ″(G) of a graph G is the fewest colors needed in any total coloring of G.
Fractional coloring is a topic in a young branch of graph theory known as fractional graph theory. It is a generalization of ordinary graph coloring. In a traditional graph coloring, each vertex in a graph is assigned some color, and adjacent vertices — those connected by edges — must be assigned different colors. In a fractional coloring however, a set of colors is assigned to each vertex of a graph. The requirement about adjacent vertices still holds, so if two vertices are joined by an edge, they must have no colors in common.
The chromatic polynomial is a graph polynomial studied in algebraic graph theory, a branch of mathematics. It counts the number of graph colorings as a function of the number of colors and was originally defined by George David Birkhoff to study the four color problem. It was generalised to the Tutte polynomial by Hassler Whitney and W. T. Tutte, linking it to the Potts model of statistical physics.
In graph theory, the Hadwiger conjecture states that if G is loopless and has no minor then its chromatic number satisfies . It is known to be true for . The conjecture is a generalization of the fourcolor theorem and is considered to be one of the most important and challenging open problems in the field.
The Tutte polynomial, also called the dichromate or the Tutte–Whitney polynomial, is a graph polynomial. It is a polynomial in two variables which plays an important role in graph theory. It is defined for every undirected graph and contains information about how the graph is connected. It is denoted by .
In graph theory, Vizing's theorem states that every simple undirected graph may be edge colored using a number of colors that is at most one larger than the maximum degree Δ of the graph. At least Δ colors are always necessary, so the undirected graphs may be partitioned into two classes: "class one" graphs for which Δ colors suffice, and "class two" graphs for which Δ + 1 colors are necessary. A more general version of Vizing's theorem states that every undirected multigraph without loops can be colored with at most Δ+µ colors, where µ is the multiplicity of the multigraph. The theorem is named for Vadim G. Vizing who published it in 1964.
In graph theory, a nowherezero flow or NZ flow is a network flow that is nowhere zero. It is intimately connected to coloring planar graphs.
In graphtheoretic mathematics, a star coloring of a graph G is a (proper) vertex coloring in which every path on four vertices uses at least three distinct colors. Equivalently, in a star coloring, the induced subgraphs formed by the vertices of any two colors has connected components that are star graphs. Star coloring has been introduced by Grünbaum (1973). The star chromatic number of G is the fewest colors needed to star color G.
In the study of graph coloring problems in mathematics and computer science, a greedy coloring or sequential coloring is a coloring of the vertices of a graph formed by a greedy algorithm that considers the vertices of the graph in sequence and assigns each vertex its first available color. Greedy colorings can be found in linear time, but they do not in general use the minimum number of colors possible.
In graph theory, an area of mathematics, an equitable coloring is an assignment of colors to the vertices of an undirected graph, in such a way that
In the mathematical field of graph theory, the Chvátal graph is an undirected graph with 12 vertices and 24 edges, discovered by Václav Chvátal (1970).
In graph theory, a mathematical discipline, coloring refers to an assignment of colours or labels to vertices, edges and faces of a graph. Defective coloring is a variant of proper vertex coloring. In a proper vertex coloring, the vertices are coloured such that no adjacent vertices have the same colour. In defective coloring, on the other hand, vertices are allowed to have neighbours of the same colour to a certain extent.
In graph theory, an acyclic orientation of an undirected graph is an assignment of a direction to each edge that does not form any directed cycle and therefore makes it into a directed acyclic graph. Every graph has an acyclic orientation.
In graph theory, a branch of mathematics, the kth powerG^{k} of an undirected graph G is another graph that has the same set of vertices, but in which two vertices are adjacent when their distance in G is at most k. Powers of graphs are referred to using terminology similar to that of exponentiation of numbers: G^{2} is called the square of G, G^{3} is called the cube of G, etc.
A mixed graphG = is a mathematical object consisting of a set of vertices V, a set of (undirected) edges E, and a set of directed edges A.
In graph theory, a branch of mathematics, the Erdős–Hajnal conjecture states that families of graphs defined by forbidden induced subgraphs have either large cliques or large independent sets. It is named for Paul Erdős and András Hajnal.
The graph coloring game is a mathematical game related to graph theory. Coloring game problems arose as gametheoretic versions of wellknown graph coloring problems. In a coloring game, two players use a given set of colors to construct a coloring of a graph, following specific rules depending on the game we consider. One player tries to successfully complete the coloring of the graph, when the other one tries to prevent him from achieving it.
In graph theory, the act of coloring generally implies the assignment of labels to vertices, edges or faces in a graph. The incidence coloring is a special graph labeling where each incidence of an edge with a vertex is assigned a color under certain constraints.
Wikimedia Commons has media related to Graph coloring . 