Introduction
Graph Neural Networks (GNNs) have become the standard for learning on graph-structured data. However, most modern GNNs are limited by the 1-Weisfeiler-Leman (1-WL) test, which prevents them from distinguishing certain non-isomorphic graphs, most notably those containing cycles. This paper introduces $r$-loopy Weisfeiler-Leman ($r$-$\ell$WL), a new hierarchy of graph isomorphism tests designed to count cycles and complex substructures like "cactus graphs" while maintaining computational efficiency on sparse data.
The Limitation of Message Passing
Standard Message Passing Neural Networks (MPNNs) are "blind" to loops. In domains like drug discovery, the presence of rings (cycles) is crucial for determining chemical properties. While higher-order WL tests ($k$-WL) offer greater expressivity, they are often computationally prohibitive because they do not respect the natural sparsity of real-world graphs, treating every possible tuple of nodes as connected. The $r$-$\ell$WL framework bridges the gap between scalable message-passing and expensive higher-order methods.
Methodology: $r$-loopy Weisfeiler-Leman
The core innovation is the $r$-neighborhood definition. Instead of aggregating information only from immediate neighbors, the $r$-$\ell$WL algorithm considers the multiset of colors found along all simple paths of length up to $r$ that connect any two neighbors of a node.
The $r$-$\ell$GIN Architecture
To implement this theory practically, the authors propose $r$-$\ell$GIN. The model follows a two-stage pipeline: a preprocessing step to extract $r$-neighborhoods by identifying simple paths between neighbors, followed by a training phase where a Path-wise GIN (Graph Isomorphism Network) processes these paths to generate node and graph embeddings.
Theoretically, $r$-$\ell$WL can count homomorphisms of cactus graphs—graphs where every edge belongs to at most one cycle. Furthermore, $r$-$\ell$WL is proved to be incomparable to the standard $k$-WL hierarchy, meaning it can distinguish certain graphs that even 3-WL or 4-WL cannot.
Experimental Evaluation
The model was evaluated across a diverse set of benchmarks, including synthetic expressivity tests (GRAPH8C, EXP_ISO, COSPECTRAL10, SR16622, and the BREC dataset), subgraph counting tasks, and real-world molecular datasets like ZINC and QM9. It was also tested on the Long-Range Graph Benchmark (PEPTIDES).
Results and Discussion
The $r$-$\ell$GIN model demonstrated significant improvements in both expressivity and predictive performance. On the BREC dataset, $4$-$\ell$GIN distinguished 257 out of 400 pairs, vastly outperforming 3-WL, which only distinguished 60 pairs.
Key performance highlights include:
- ZINC12K: Achieved a State-of-the-Art Mean Absolute Error (MAE) of 0.072, surpassing domain-agnostic baselines and specialized models.
- Long-Range Tasks: Improved Average Precision on PEPTIDES-func from ~59% to 65.7%, indicating better capture of global structural information.
- Efficiency: Despite path processing, $r$-$\ell$GIN remains roughly 30x faster than 3-WL GNNs on the ZINC dataset, scaling linearly with the number of paths in sparse graphs.
Conclusion and Future Work
The $r$-$\ell$WL hierarchy provides a powerful yet efficient way to incorporate cycle-counting into GNNs. While the complexity $O(N d^r)$ can be high for dense graphs, it is highly effective for the sparse graphs common in chemistry and biology. Future work will focus on characterizing the full class of distinguishable graphs and optimizing path-finding for denser structures.
Summary updated