# Distinguishing coloring

In graph theory, a distinguishing coloring or distinguishing labeling of a graph is an assignment of colors or labels to the vertices of the graph that destroys all of the nontrivial symmetries of the graph. The coloring does not need to be a proper coloring: adjacent vertices are allowed to be given the same color. For the colored graph, there should not exist any one-to-one mapping of the vertices to themselves that preserves both adjacency and coloring. The minimum number of colors in a distinguishing coloring is called the distinguishing number of the graph.
Distinguishing colorings and distinguishing numbers were introduced by Albertson & Collins (1996), who provided the following motivating example, based on a puzzle previously formulated by Frank Rubin: "Suppose you have a ring of keys to different doors; each key only opens one door, but they all look indistinguishable to you. How few colors do you need, in order to color the handles of the keys in such a way that you can uniquely identify each key?" This example is solved by using a distinguishing coloring for a cycle graph. With such a coloring, each key will be uniquely identified by its color and the sequence of colors surrounding it.

## Examples

A graph has distinguishing number one if and only if it is asymmetric. For instance, the Frucht graph has a distinguishing coloring with only one color.
In a complete graph, the only distinguishing colorings assign a different color to each vertex. For, if two vertices were assigned the same color, there would exist a symmetry that swapped those two vertices, leaving the rest in place. Therefore, the distinguishing number of the complete graph K$_n$ is n. However, the graph obtained from K$_n$ by attaching a degree-one vertex to each vertex of K$_n$ has a significantly smaller distinguishing number, despite having the same symmetry group: it has a distinguishing coloring with $\lceil {\sqrt {n}}\rceil$ colors, obtained by using a different ordered pair of colors for each pair of a vertex K$_n$ and its attached neighbor.
For a cycle graph of three, four, or five vertices, three colors are needed to construct a distinguishing coloring. For instance, every two-coloring of a five-cycle has a reflection symmetry. In each of these cycles, assigning a unique color to each of two adjacent vertices and using the third color for all remaining vertices results in a three-color distinguishing coloring. However, cycles of six or more vertices have distinguishing colorings with only two colors. That is, Frank Rubin's keyring puzzle requires three colors for rings of three, four or five keys, but only two colors for six or more keys or for two keys. For instance, in the ring of six keys shown, each key can be distinguished by its color and by the length or lengths of the adjacent blocks of oppositely-colored keys: there is only one key for each combination of key color and adjacent block lengths.
Hypercube graphs exhibit a similar phenomenon to cycle graphs. The two- and three-dimensional hypercube graphs (the 4-cycle and the graph of a cube, respectively) have distinguishing number three. However, every hypercube graph of higher dimension has distinguishing number only two.
The Petersen graph has distinguishing number 3. However other than this graph and the complete graphs, all Kneser graphs have distinguishing number 2. Similarly, among the generalized Petersen graphs, only the Petersen graph itself and the graph of the cube have distinguishing number 3; the rest have distinguishing number 2.

## Computational complexity

The distinguishing numbers of trees, planar graphs, and interval graphs can be computed in polynomial time.
The exact complexity of computing distinguishing numbers is unclear, because it is closely related to the still-unknown complexity of graph isomorphism. However, it has been shown to belong to the complexity class AM. Additionally, testing whether the distinguishing chromatic number is at most three is NP-hard, and testing whether it is at most two is "at least as hard as graph automorphism, but no harder than graph isomorphism".

## Additional properties

A coloring of a given graph is distinguishing for that graph if and only if it is distinguishing for the complement graph. Therefore, every graph has the same distinguishing number as its complement.
For every graph G, the distinguishing number of G is at most proportional to the logarithm of the number of automorphisms of G. If the automorphisms form a nontrivial abelian group, the distinguishing number is two, and if it forms a dihedral group then the distinguishing number is at most three.
For every finite group, there exists a graph with that group as its group of automorphisms, with distinguishing number two. This result extends Frucht's theorem that every finite group can be realized as the group of symmetries of a graph.

## Variations

A proper distinguishing coloring is a distinguishing coloring that is also a proper coloring: each two adjacent vertices have different colors. The minimum number of colors in a proper distinguishing coloring of a graph is called the distinguishing chromatic number of the graph.