Rainbow coloring

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Rainbow coloring of a wheel graph, with three colors. Every two non-adjacent vertices can be connected by a rainbow path, either directly through the center vertex (bottom left) or by detouring around one triangle to avoid a repeated edge color (bottom right).

In graph theory, a path in an edge-colored graph is said to be rainbow if no color repeats on it. A graph is said to be rainbow-connected (or rainbow colored) if there is a rainbow path between each pair of its vertices. If there is a rainbow shortest path between each pair of vertices, the graph is said to be strongly rainbow-connected (or strongly rainbow colored).[1]

Definitions and bounds[edit]

The rainbow connection number of a graph is the minimum number of colors needed to rainbow-connect , and is denoted by . Similarly, the strong rainbow connection number of a graph is the minimum number of colors needed to strongly rainbow-connect , and is denoted by . Clearly, each strong rainbow coloring is also a rainbow coloring, while the converse is not true in general.

It is easy to observe that to rainbow-connect any connected graph , we need at least colors, where is the diameter of (i.e. the length of the longest shortest path). On the other hand, we can never use more than colors, where denotes the number of edges in . Finally, because each strongly rainbow-connected graph is rainbow-connected, we have that .

The following are the extremal cases:[1]

  • if and only if is a complete graph.
  • if and only if is a tree.

The above shows that in terms of the number of vertices, the upper bound is the best possible in general. In fact, a rainbow coloring using colors can be constructed by coloring the edges of a spanning tree of in distinct colors. The remaining uncolored edges are colored arbitrarily, without introducing new colors. When is 2-connected, we have that .[2] Moreover, this is tight as witnessed by e.g. odd cycles.

Exact rainbow or strong rainbow connection numbers[edit]

The rainbow or the strong rainbow connection number has been determined for some structured graph classes:

  • , for each integer , where is the cycle graph.[1]
  • , for each integer , and , for , where is the wheel graph.[1]


The problem of deciding whether for a given graph is NP-complete.[3] Because if and only if ,[1] it follows that deciding if is NP-complete for a given graph .

Variants and generalizations[edit]

Chartrand, Okamoto and Zhang[4] generalized the rainbow connection number as follows. Let be an edge-colored nontrivial connected graph of order . A tree is a rainbow tree if no two edges of are assigned the same color. Let be a fixed integer with . An edge coloring of is called a -rainbow coloring if for every set of vertices of , there is a rainbow tree in containing the vertices of . The -rainbow index of is the minimum number of colors needed in a -rainbow coloring of . A -rainbow coloring using colors is called a minimum -rainbow coloring. Thus is the rainbow connection number of .

Rainbow connection has also been studied in vertex-colored graphs. This concept was introduced by Krivelevich and Yuster.[5] Here, the rainbow vertex-connection number of a graph , denoted by , is the minimum number of colors needed to color such that for each pair of vertices, there is a path connecting them whose internal vertices are assigned distinct colors.

See also[edit]



  • Chartrand, Gary; Johns, Garry L.; McKeon, Kathleen A.; Zhang, Ping (2008), "Rainbow connection in graphs", Mathematica Bohemica, 133 (1).
  • Chartrand, Gary; Okamoto, Futaba; Zhang, Ping (2010), "Rainbow trees in graphs and generalized connectivity", Networks, 55 (4), doi:10.1002/net.20339.
  • Chakraborty, Sourav; Fischer, Eldar; Matsliah, Arie; Yuster, Raphael (2011), "Hardness and algorithms for rainbow connection", Journal of Combinatorial Optimization, 21 (3): 330–347, arXiv:0809.2493, doi:10.1007/s10878-009-9250-9.
  • Krivelevich, Michael; Yuster, Raphael (2010), "The Rainbow Connection of a Graph Is (at Most) Reciprocal to Its Minimum Degree", Journal of Graph Theory, 63 (3): 185–191, doi:10.1002/jgt.20418.
  • Li, Xueliang; Shi, Yongtang; Sun, Yuefang (2013), "Rainbow Connections of Graphs: A Survey", Graphs and Combinatorics, 29 (1): 1–38, arXiv:1101.5747, doi:10.1007/s00373-012-1243-2.
  • Li, Xueliang; Sun, Yuefang (2012), Rainbow connections of graphs, Springer, p. 103, ISBN 978-1-4614-3119-0.
  • Ekstein, Jan; Holub, Přemysl; Kaiser, Tomáš; Koch, Maria; Camacho, Stephan Matos; Ryjáček, Zdeněk; Schiermeyer, Ingo (2013), "The rainbow connection number of 2-connected graphs", Discrete Mathematics, 313 (19): 1884–1892, arXiv:1110.5736, doi:10.1016/j.disc.2012.04.022.