ArticleslgStudy

computer science

Colour refinement algorithm

Colour refinement algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Colour refinement algorithm rather than just read about it. In short: In graph theory and theoretical computer science, the colour refinement algorithm also known as the naive vertex classification, or the 1-dimensional version of the Weisfeiler-Leman algorithm, is a routine used for testing whether two graphs are isomorphic. While it solves graph isomorphism on almost all graphs, there are graphs such as all regular graphs that cannot be distinguished using colour refinement.

Key takeaways

  • Colour refinement algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Colour refinement algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Colour refinement algorithm from memory before moving on to harder problems.

Reference excerpt

In graph theory and theoretical computer science, the colour refinement algorithm also known as the naive vertex classification, or the 1-dimensional version of the Weisfeiler-Leman algorithm, is a routine used for testing whether two graphs are isomorphic. While it solves graph isomorphism on almost all graphs, there are graphs such as all regular graphs that cannot be distinguished using colour refinement.

History The first appearance of color refinement is in Stephen H. Unger's program GIT for graph isomorphism, where it is called the Extend method. It was described again, immediately after, in a chemistry paper.

Description The algorithm takes as an input a graph G with n 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 λi as follows:

λ0 is the initial colouring. If the graph is unlabelled, the initial colouring assigns a trivial colour λ0(v) to each vertex v. If the graph is labelled, λ0 is the label of vertex v. For all vertices v, we set λi+1(v)=(λi(v),{{λi(w)∣w is a neighbor of v}}). In other words, the new colour of the vertex v is the pair formed from the previous colour and the multiset of the colours of its neighbours. This algorithm keeps refining the current colouring. At some point it stabilises, i.e., λi+1(u)=λi+1(v) if and only if λi(u)=λi(v). This final colouring is called the stable colouring.

Graph Isomorphism Colour refinement can be used as a subroutine for an important computational problem: graph isomorphism. In this problem we have as input two graphs G,H and our task is to determine whether they are isomorphic. Informally, this means that the two graphs are the same up to relabelling of vertices. To test if G and H 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.

Complexity It is easy to see that if colour refinement is given a n vertex graph as input, a stable colouring is produced after at most n−1 iterations. Conversely, there exist graphs where this bound is realised. This leads to a O((n+m)log⁡n) implementation where n is the number of vertices and m the number of edges. This complexity has been proven to be optimal under reasonable assumptions.

Expressivity We say that two graphs G and H are distinguished by colour refinement if the algorithm yields a different output on G as on H. 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 ). Despite this, the algorithm is very powerful in that a random graph will be identified by the algorithm asymptotically almost surely. Even stronger, it has been shown that as n increases, the proportion of graphs that are not identified by colour refinement decreases exponentially in order n.

Equivalent Characterizations For two graphs G and H with the same number of vertices, the following conditions are equivalent:

G and H are indistinguishable by colour refinement. The minimum fibration bases of G and H are isomorphic. G and H are fractionally isomorphic. G and H have a common coarsest equitable partition. G and H have the same universal cover. For all trees T, there are an equal number of homomorphisms from T to G as there are from T to H. G and H cannot be distinguished by the two variable fragment of first order logic with counting. Any message passing graph neural network will map G and H to the same output, if the input node features are the initial colours λ0. Any synchronous anonymous algorithm with broadcast/mailbox message passing in which the input depends on the color only will generate an output that depends, again, on the initial color only.

References

Worked examples

Example 1 — a first encounter with Colour refinement algorithm

Start with the simplest possible case. Write down what Colour refinement algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Colour refinement algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Colour refinement algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Colour refinement algorithm

In research
Colour refinement algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Colour refinement algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Colour refinement algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Graph algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Colour refinement algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Colour refinement algorithm” →

How to study Colour refinement algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Colour refinement algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Colour refinement algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Colour refinement algorithm in simple terms?

In graph theory and theoretical computer science, the colour refinement algorithm also known as the naive vertex classification, or the 1-dimensional version of the Weisfeiler-Leman algorithm, is a routine used for testing whether two graphs are isomorphic. While it solves graph isomorphism on almo…

Why does Colour refinement algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Colour refinement algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Colour refinement algorithm.

Tags

  • Graph algorithms

Keep exploring