Ingraph theory andtheoretical computer science, thecolour refinement algorithm also known as thenaive vertex classification, or the1-dimensional version of theWeisfeiler-Leman algorithm, is a routine used for testing whether two graphs areisomorphic.[1] While it solves graph isomorphism on almost all graphs, there are graphs such as all regular graphs that cannot be distinguished using colour refinement.
The algorithm takes as an input a graph with vertices. It proceeds in iterations and in each iteration produces a new colouring of the vertices. Formally a "colouring" is a function from the vertices of this graph into some set (of "colours"). In each iteration, we define a sequence of vertex colourings as follows:
In other words, the new colour of the vertex is the pair formed from the previous colour and themultiset of the colours of its neighbours.This algorithm keeps refining the current colouring. At some point it stabilises, i.e., if and only if. This final colouring is called thestable colouring.
Colour refinement can be used as a subroutine for an importantcomputational problem:graph isomorphism. In this problem we have as input two graphs and our task is to determine whether they areisomorphic. Informally, this means that the two graphs are the same up to relabelling of vertices.
To test if and are isomorphic we could try the following. Run colour refinement on both graphs. If the stable colourings produced are different we know that the two graphs are not isomorphic. However, it could be that the same stable colouring is produced despite the two graphs not being isomorphic; see below.
It is easy to see that if colour refinement is given a vertex graph as input, a stable colouring is produced after at most iterations. Conversely, there exist graphs where this bound is realised.[2] This leads to a implementation where is the number of vertices and the number of edges.[3] This complexity has been proven to be optimal under reasonable assumptions.[4]
We say that two graphs and aredistinguished by colour refinement if the algorithm yields a different output on as on. There are simple examples of graphs that are not distinguished by colour refinement. For example, it does not distinguish a cycle of length 6 from a pair of triangles (example V.1 in[5]). Despite this, the algorithm is very powerful in that arandom graph will be identified by the algorithm asymptotically almost surely.[6] Even stronger, it has been shown that as increases, the proportion of graphs that arenot identified by colour refinement decreases exponentially in order.[7]
For two graphs and, the following conditions are equivalent:
![]() | This section is empty. You can help byadding to it.(September 2022) |