Graph coloring

From Wikipedia, the free encyclopedia

A 3-coloring suits this graph, but fewer colors would result in adjacent vertices of the same color.  Finding the minimum number of colors for an arbitrary graph is NP-hard.
A 3-coloring suits this graph, but fewer colors would result in adjacent vertices of the same color. Finding the minimum number of colors for an arbitrary graph is NP-hard.

In graph theory, graph coloring is a special case of graph labeling; it is an assignment of labels traditionally called "colors" to elements of a graph subject to certain constraints. In its simplest form, it is a way of coloring the vertices of a graph such that no two adjacent vertices share the same color; this is called a vertex coloring. Similarly, an edge coloring assigns a color to each edge so that no two adjacent edges share the same color, and a face coloring of a planar graph assigns a color to each face or region so that no two faces that share a boundary have the same color.

Vertex coloring is the starting point of the subject, and other coloring problems can be transformed into a vertex version. For example, an edge coloring of a graph is just a vertex coloring of its line graph, and a face coloring of a planar graph is just a vertex coloring of its planar dual. However, non-vertex coloring problems are often stated and studied as is. That is partly for perspective, and partly because some problems are best studied in non-vertex form, as for instance is edge coloring.

The convention of using colors originates from coloring the countries of a map, where each face is literally colored. This was generalized to coloring the faces of a graph embedded in the plane. By planar duality it became coloring the vertices, and in this form it generalizes to all graphs. In mathematical and computer representations it is typical to use the first few positive or nonnegative integers as the "colors". In general one can use any finite set as the "color set". The nature of the coloring problem depends on the number of colors but not on what they are.

Graph coloring enjoys many practical applications as well as theoretical challenges. Beside the classical types of problems, different limitations can also be set on the graph, or on the way a color is assigned, or even on the color itself. It has even reached popularity with the general public in the form of the popular number puzzle Sudoku. Graph coloring is still a very active field of research.

Note: Many terms used in this article are defined in the glossary of graph theory.

Contents

[edit] Vertex coloring

When used without any qualification, a coloring of a graph is always assumed to be a vertex coloring, namely an assignment of colors to the vertices of the graph. Again, when used without any qualification, a coloring is nearly always assumed to be proper, meaning no two adjacent vertices are assigned the same color. Here, "adjacent" means sharing the same edge. A coloring using at most k colors is called a (proper) k-coloring and is equivalent to the problem of partitioning the vertex set into k or fewer independent sets.

The problem of coloring a graph has found a number of applications. Some of them are scheduling, register allocation in compilers, frequency assignment in mobile radios, and pattern matching.

[edit] Chromatic number

The least number of colors needed to color a graph G is called its chromatic number, χ(G). For example the chromatic number of a complete graph Kn of n vertices (a graph with an edge between every two vertices), is χ(Kn) = n. A graph that can be assigned a (proper) k-coloring is k-colorable, and it is k-chromatic if its chromatic number is exactly k.

The problem of finding the chromatic number is NP-hard. The corresponding decision problem (Is there a coloring which uses at most k colors?) is NP-complete, and in fact was one of Karp's 21 NP-complete problems. It remains NP-complete even on planar graphs of degree at most 4, as shown by Garey and Johnson in 1974[1]. There are however some efficient approximation algorithms that employ semidefinite programming.

Some properties of χ(G):

  1. χ(G) = 1 if and only if G is totally disconnected, i.e., it has no edges.
  2. χ(G) ≥ 3 if and only if G has an odd cycle (equivalently, if G is not bipartite).
  3. χ(G) ≥ ω(G), the clique number, i.e., the number of vertices of a largest clique in G.
  4. χ(G) ≤ Δ(G) + 1, 1 more than the maximum degree of a vertex.
  5. χ(G) ≤ Δ(G) for a connected, simple graph G, unless G is a complete graph or an odd cycle (Brooks' theorem).
  6. χ(G) ≤ 4, for any planar graph G. This famous result, called the four-color theorem, was stated by Augustus De Morgan in 1852, but remained unproven until 1976, when it was established by Kenneth Appel and Wolfgang Haken.

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

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

If all finite subgraphs of an infinite graph G are k-colorable, then so is G. (de Bruijn and Erdős 1951)

The chromatic number of the plane, where two points are adjacent if they have unit distance, is unknown, although it is one of 4, 5, 6, or 7. Other open problems concerning the chromatic number of graphs include the Hadwiger conjecture stating that every graph with chromatic number k has a complete graph on k vertices as a minor, and the Erdős–Faber–Lovász conjecture bounding the chromatic number of unions of complete graphs that have at exactly one vertex in common to each pair.

[edit] Algorithmic aspects

[edit] Optimal coloring

Vertex coloring in the general case is an NP-Complete problem. Instead of asking for the smallest number of colors needed to color the graph, we can ask easier questions of the form "Can we color the graph with at most k colors?"

The case k = 2 is equivalent to determining whether or not the graph is bipartite. This can be accomplished in polynomial time. For k >= 3 the problem is NP-Complete. By the gap theorem, this implies that the problem can not be approximated by a polynomial algorithm within a factor of 4/3 unless P=NP.

One consequence of the Strong Perfect Graph Theorem of Chudnovsky, Robertson, Seymour, and Thomas is that it is possible to determine the chromatic number of a perfect graph in polynomial time.

[edit] Existing algorithms

The coloring algorithms can be divided into two categories:

- The optimal coloring algorithms (for example the algorithm of Zykov, the method of branch and bound, etc.).

- The algorithms that do not ensure a result with the smallest possible number of colors. Here we can find the sequential algorithms (those that color one vertex at a time), heuristic algorithms, global randomized algorithms, metaheuristic algorithms (using simulated annealing, tabu search, etc.), and genetic algorithms, to name several types.

[edit] Algorithm of Welsh and Powell

The Welsh-Powell algorithm[2] for coloring a graph uses a simple heuristic improvement to a completely naive greedy algorithm. By processing the vertices in non-increasing order of degree, that is, ordering them so that d_1 \geq d_2 \geq \cdots \geq d_n, where di is the degree of the ith node, this algorithm uses α(G) colors where


  \alpha(G) \leq \max_i \min  \left\{
     \begin{array}{c}
         d_i + 1 ,\\
         i.
     \end{array}
     \right.

The algorithm is as follows:

  1. Sort the vertices in decreasing order of degree and initially have every vertex uncolored.
  2. Traverse the vertices in order, giving a vertex color 1 if it is uncolored and it does not yet have a neighbor with color 1.
  3. Repeat this process with colors 2, 3, etc. until no vertex is uncolored.

This algorithm does not necessarily find a χ(G) coloring.

[edit] Chromatic polynomial

This graph can be 3-colored in 12 different ways.
This graph can be 3-colored in 12 different ways.

The chromatic polynomial counts the number of ways a graph can be colored using no more than a given number of colors. For example, using three colors, the graph in the image to the right can be colored in 12 ways. With only two colors, it cannot be colored at all. With four colors, it can be colored in 24 + 4⋅12 = 72 ways: using all four colors, there are 4! = 24 valid colorings (every assignment of four colors to any 4-vertex graph is a proper coloring); and for every choice of three of the four colors, there are 12 valid 3-colorings. So, for the graph in the example, a table of the number of valid colorings would start like this:

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

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

The chromatic polynomial includes at least as much information about the colorability of G as does the chromatic number. Indeed, χ is the smallest positive integer that is not a root of the chromatic polynomial,

χ(G) = min{k:P(G,k) > 0}

It was first used by Birkhoff and Lewis in their attack on the four-color theorem. It remains an unsolved problem to characterize graphs which have the same chromatic polynomial and to determine precisely which polynomials are chromatic.

[edit] Examples

The Petersen graph has chromatic number 3.
The Petersen graph has chromatic number 3.
Chromatic polynomials for certain graphs
Triangle K3 t(t − 1)(t − 2)
Complete graph Kn t(t-1)(t-2) \cdots (t-(n-1))
Tree with n vertices t(t − 1)n − 1
Cycle Cn (t − 1)n + ( − 1)n(t − 1)
Petersen graph t(t − 1)(t − 2)(t7 − 12t6 + 67t5 − 230t4 + 529t3 − 814t2 + 775t − 352)

[edit] Properties

  • P(G,0) = 0
  • P(G,1) = 0 if G contains an edge
  • P(G,t) = 0, if t < χ(G).
  • ( − 1) | V(G) | P(G, − 1) is the number of acyclic orientations of G[3]
  • If G has n vertices, m edges, and k components G1,G2,…,Gk, then
    • P(G,t) has degree n.
    • The coefficient of tn in P(G,t) is 1.
    • The coefficient of tn − 1 in P(G,t) is m.
    • The coefficients of t^0, t^1, \dots, t^{k-1} are all zero.
    • The coefficient of tk is nonzero.
    • P(G, t) = P(G_1, t)P(G_2,t) \cdots P(G_k,t)
  • The coefficients of every chromatic polynomial alternate in signs.
  • A graph G with n vertices is a tree if and only if P(G,t) = t(t − 1)n − 1.
  • The derivative evaluated at unity, P'(G,1) is the chromatic invariant θ(G) up to sign

[edit] Computing the chromatic polynomial

Whenever G contains a loop, it cannot be legally colored at all, so:

P(G,t) = 0.

If e is not a loop, then the chromatic polynomial satisfies the recurrence relation:

P(G,t) = P(Ge,t) − P(G / e,t)

where Ge is the graph with the edge removed, and G / e is the graph with the edge's endpoints contracted into a single vertex.

The two expressions give rise to a recursive procedure, called the deletion–contraction algorithm. In the recursive step, the instance is transformed into two instances that are at least one edge smaller, so the running time comes within a polynomial factor of 2m, where m is the number of edges. The analysis can be improved to 1.62n + m.

Other algorithms are known, but all are exponential in the size of the graph. For some classes of graphs, polynomial-time algorithms are known. These include the empty and complete graphs, forests, chordal graphs, wheels, and ladders. In general, computing the chromatic polynomial is #P-complete, so it is unlikely that a polynomial time algorithm for all graphs will be found.

[edit] Other types of colorings

Not only can the idea of vertex coloring be extended to edges, but also be added with different conditions to form new structures and problems.

Edge coloring Edges are colored
List coloring Each vertex chooses from a list of colors
List edge-coloring Each edge chooses from a list of colors
Total coloring Vertices and edges are colored
Harmonious coloring Every pair of colors appears on at most one edge
Complete coloring Every pair of colors appears on at least one edge
Exact coloring Every pair of colors appears on exactly one edge
Acyclic coloring Every 2-chromatic subgraph is acyclic
Strong coloring Every color appears in every partition of equal size exactly once
Strong edge coloring Edges are colored such that each color class induces a matching (equivalent to coloring the square of the line graph)
On-line coloring The instance of the problem is not given in advance and its successive parts become known over time
Equitable coloring The sizes of color classes differ by at most one
Sum-coloring The criterion of minimalization is the sum of colors
T-coloring Distance between two colors of adjacent vertices must not belong to fixed set T
Rank coloring If two vertices have the same color i, then every path between them contain a vertex with color greater than i
Interval edge-coloring A color of edges meeting in a common vertex must be contiguous
Circular coloring Motivated by task systems in which production proceeds in a cyclic way
Path coloring Models a routing problem in graphs
Fractional coloring Vertices may have multiple colors, and on each edge the sum of the color parts of each vertex is not greater than one
Oriented coloring Takes into account orientation of edges of the graph

Some improper colorings:

Cocoloring Every color class induces an independent set or a clique
Subcoloring Every color class induces a union of cliques

[edit] Generalizations

Coloring can be considered for signed graphs and gain graphs. Similar questions arise.

[edit] References

  1. ^ M. R. Garey, D. S. Johnson, and L. Stockmeyer. Some simplified NP-complete problems. Proceedings of the sixth annual ACM symposium on Theory of computing, p.47-63. 1974.
  2. ^ D. J. A. Welsh and M. B. Powell (1967). "An upper bound for the chromatic number of a graph and its application to timetabling problems". The Computer Journal 10 (1): 85-86. doi:10.1093/comjnl/10.1.85. 
  3. ^ Stanley, 1973

[edit] Literature

[edit] See also

Wikimedia Commons has media related to:

[edit] External links