Boosting the Cycle Counting Power of Graph Neural Networks with I2-GNNs

Yinan Huang, Xingang Peng, Jianzhu Ma, Muhan Zhang

Introduction

Most modern Graph Neural Networks (GNNs) are categorized as Message Passing Neural Networks (MPNNs). Despite their popularity, MPNNs are mathematically constrained by the Weisfeiler-Lehman (WL) test, which limits their ability to distinguish between certain graph substructures, such as 3-cycles (triangles) versus 4-cycles (squares). This limitation is particularly problematic in organic chemistry, where 5-membered and 6-membered (benzene) rings are essential components of life and medicine. While recent "Subgraph GNNs" have attempted to address this by labeling root nodes, they remain unable to count cycles longer than four.

The $I^2$-GNN Architecture

Presented at ICLR 2023, $I^2$-GNNs (Inter-node Identifier GNNs) introduce a novel labeling strategy to break these symmetries. The core innovation involves assigning a unique identifier not just to a root node $i$ within a subgraph, but also to one of its neighbors $j$, known as the "branching node."

The $I^2$-GNN pipeline: from raw graph to subgraph extraction, neighbor labeling, and hierarchical pooling.

By iterating over all possible neighbors as branching nodes, the model effectively "orients" itself, allowing it to track longer paths and close loops that were previously anonymous. This approach transforms a global cycle-counting problem into a simpler local path-counting problem. Despite this increased power, $I^2$-GNNs maintain computational efficiency. On sparse graphs, the complexity is $O(N \cdot s \cdot d^2)$, where $N$ is the number of nodes, $s$ is the subgraph size, and $d$ is the node degree, ensuring linear scalability for large datasets.

Empirical Evaluation and Key Results

The authors evaluated $I^2$-GNNs on synthetic isomorphism tests (EXP and SR25), substructure counting tasks, and standard molecular benchmarks (QM9, ZINC, ogbg-molhiv).

A standout result is the model's performance on the SR25 dataset, which contains pairs of non-isomorphic graphs that are notoriously difficult for standard GNNs to distinguish. $I^2$-GNN achieved 100% accuracy on this benchmark, a feat that most GNNs—including those equivalent to the 3-WL test—fail to accomplish.

Comparison of $I^2$-GNN against other GNN variants on the EXP and SR25 isomorphism benchmarks.

Furthermore, $I^2$-GNN demonstrated "Perfect Counting" on cycle tasks, achieving a Mean Absolute Error (MAE) of less than 0.01 for 5- and 6-cycles. In contrast, previous state-of-the-art models like ID-GNN and NGNN saw errors spike by 30x to 50x on the same tasks. On the ZINC molecular benchmark, $I^2$-GNN outperformed previous models by approximately 20%, nearing the performance of more computationally expensive simplicial complex networks.

Conclusion and Future Directions

$I^2$-GNNs represent a significant advancement in the representational power of GNNs, specifically for cycle counting. By breaking symmetry with inter-node identifiers, the model achieves theoretical guarantees for counting 6-cycles while remaining efficient for real-world applications. Future work may explore branch node sampling to mitigate complexity in dense graphs and investigate methods to count cycles longer than six.

Summary updated

BibTeX
@inproceedings{huang2023boosting,
  author = {Yinan Huang and Xingang Peng and Jianzhu Ma and Muhan Zhang},
  title = {{Boosting the Cycle Counting Power of Graph Neural Networks with I2-GNNs}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=kDSmxOspsXQ},
}
Figure