Weisfeiler-Leman Graph Isomorphism Test

[[concept]]
Weisfeiler-Leman Graph Isomorphism Test

The Weisfeiler-Leman graph isomorphism test consists of running the color refinement algorithm for two graphs.

Motivation

Since the eigenvalue-based heuristic doesn't work for some graphs, a simple heuristic that does work is counting degrees. Then the problem amounts to comparing the multisets of node degree counts.

If the outputs of the algorithm are not the same, then the two graphs are not isomorphic.

Caution

If the outputs of the algorithm for the two graphs are the same, this is not an indicator that the two graphs are isomorphic! It means the test is inconclusive

In this example, the two graphs have different outputs. Thus, we may conclude that they are not isomorphic.

Example

2025-02-19-graph-2.png

Color refinement for G1

No node features, so assume all 1. First, Assign colors based on node features.

step t=0:
c1(0)=c2(0)=c3(0)=f(,1)=k1

step t=1:
c1(1)=f(k1,{k1})=k1c3(1)=f(k1,{k1})=k1c2(1)=f(k1,{k1,k1})=k2
Evaluate: did the colors change?

  • Yes: continue!

step t=2:
c1(2)=f(k1,{k1})=k1c3(2)=f(k1,{k1})=k1c2(2)=f(k2,{k1,k1})=k2
Evaluate: did the colors change?

  • No - so we are done!
  • This is the final coloring.

return {k1,k1,k2}

Color refinement for G2

Again, there are no node features, so we assume the signals are all 1.

step t=0: assign colors based on node features:
c1(0)=c2(0)=c3(0)=f(,1)=k1
step t=1:
c1(1)=c2(1)=c3(1)=f(,{k1,k1})=k1

evaluate: did the colors change?

  • No - so we are done
  • This is the final coloring

return {k1,k1,k1}

Mentions

File
graph isomorphism
injective GNNs are as powerful as the WL test
the WL test is at least as powerful as a GNN for detecting graph non-isomorphism
2025-02-19 graphs lecture 9
2025-02-24 graphs lecture 10
2025-03-03 graphs lecture 11
2025-03-05 graphs lecture 12
2025-02-25 equivariant lecture 4
2025-03-04 equivariant lecture 6