Weisfeiler-Lehman Test

The Weisfeiler-Lehman test is a graph-color refinement procedure used as a reference point for the expressive power of message-passing graph neural networks.

For the common 1-dimensional WL test, each node starts with an initial color:

At iteration , the node color is updated from its previous color and the multiset of neighbor colors:

Two graphs are distinguishable by 1-WL if their color histograms differ at some iteration.

Why It Matters For GNNs

Many message-passing GNNs have the same recursive shape:

This makes 1-WL a useful ceiling for standard message passing. If the aggregation/update cannot distinguish two WL color refinement states, the GNN usually cannot separate the corresponding graphs either.

The key design question is:

If aggregation collapses distinct multisets into the same vector, expressive power is lost before the learned MLP even sees the neighborhood.

Multiset Aggregation

A set ignores multiplicity. A multiset preserves how many times an element appears:

For graph neighborhoods, multiplicity matters because repeated neighbor labels encode degree and local structure.

Common aggregators behave differently:

AggregatorMultiset SensitivityTypical Issue
sumcan preserve counts when followed by expressive mapsscale grows with degree
meannormalizes degree awaydifferent counts can collapse
maxkeeps strongest feature onlyrepeated or weaker evidence disappears

Example:

but the multisets are different.

Connection To GIN

Graph Isomorphism Network uses sum aggregation and an MLP update to approximate an injective multiset function:

The paper’s durable claim is not that every graph problem needs maximum WL power. The useful reading is:

Limits

1-WL is not a complete graph isomorphism test. Some non-isomorphic graphs remain indistinguishable.

For ML reading, this means:

  • matching 1-WL is a useful baseline for message-passing expressivity;
  • exceeding 1-WL usually requires higher-order tensors, subgraph features, positional encodings, random features, structural encodings, or non-local attention;
  • higher expressivity can increase compute, overfitting risk, and leakage risk if graph construction uses hidden target information.

Reading Checks

QuestionWhy
What is the node color or feature at initialization?WL power depends on initial labels/features
Is aggregation injective over multisets?non-injective aggregation collapses structures
Does the readout preserve graph-level multiplicity?graph classification also needs invariant but expressive pooling
Does the task require structure beyond 1-WL?cycles, motifs, and long-range patterns may need stronger bias
Is stronger expressivity actually measured?benchmark gains may come from features, splits, or training budget