Counting Graph Substructures with Graph Neural Networks
Charilaos I. Kanatsoulis, Alejandro Ribeiro
Abstract
Graph Neural Networks (GNNs) are powerful representation learning tools that have achieved remarkable performance in various downstream tasks. However, there are still open questions regarding their ability to count and list substructures, which play a crucial role in biological and social networks. In this work, we fill this gap and characterize the representation and generalization power of GNNs in terms of their ability to produce powerful representations that count substructures. In particular, we study the message-passing operations of GNNs with random node input in a novel fashion, and show how they can produce equivariant representations that are associated with high-order statistical moments. Using these representations, we prove that GNNs can learn how to count cycles, cliques, quasi-cliques, and the number of connected components in a graph. We also provide new insights into the generalization capacity of GNNs. Our analysis is constructive and enables the design of a generic GNN architecture that shows remarkable performance in four distinct tasks: cycle detection, cycle counting, graph classification, and molecular property prediction.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext e118dfa2-7ca2-4f4e-83ba-cfd3249f27ccCited by top-tier papers11
- Relational Graph TransformerVijay Prakash Dwivedi, Sri Jaladi, Yangyi Shen, Federico Lopez et al.ICLR 2026 · 35 citations
- GeoDynamics: A Geometric State-Space Neural Network for Understanding Brain Dynamics on Riemannian ManifoldsTingting Dan, Jiaqi Ding, Guorong WuNeurIPS 2025 · 4 citations
- What Expressivity Theory Misses: Message Passing Complexity for GNNsNiklas Kemper, Tom Wollschläger, Stephan GünnemannNeurIPS 2025 · 3 citations
- Graph Self-Supervised Learning with Learnable Structural and Positional EncodingsAsiri Wijesinghe, Hao Zhu, Piotr KoniuszWWW 2025 · 3 citations
- Efficient and Accurate Subgraph Counting: A Bottom-up Flow-learning based ApproachQiuyu Guo, Jianye Yang, Wenjie Zhang, Hanchen Wang et al.VLDB 2025 · 3 citations
Builds on19
- Recipe for a General, Powerful, Scalable Graph TransformerLadislav Rampásek, Michael Galkin, Vijay Prakash Dwivedi, Anh Tuan Luu et al.NeurIPS 2022 · 1,216 citations
- Principal Neighbourhood Aggregation for Graph NetsGabriele Corso, Luca Cavalleri, Dominique Beaini, Pietro Liò et al.NeurIPS 2020 · 914 citations
- What graph neural networks cannot learn: depth vs widthAndreas LoukasICLR 2020 · 336 citations
- Weisfeiler and Lehman Go Cellular: CW NetworksCristian Bodnar, Fabrizio Frasca, Nina Otter, Yuguang Wang et al.NeurIPS 2021 · 330 citations
- Identity-aware Graph Neural NetworksJiaxuan You, Jonathan Michael Gomes Selman, Rex Ying, Jure LeskovecAAAI 2021 · 316 citations
Related papers
- Can Graph Neural Networks Count Substructures?Zhengdao Chen, Lei Chen, Soledad Villar, Joan BrunaNeurIPS 2020 · 392 citations
- Boosting the Cycle Counting Power of Graph Neural Networks with I-GNNsYinan Huang, Xingang Peng, Jianzhu Ma, Muhan ZhangICLR 2023 · 3 citations
- Graph Neural Networks Can (Often) Count SubstructuresPaolo Pellizzoni, Till Hendrik Schulz, Karsten M. BorgwardtICLR 2025
- Distance-Restricted Folklore Weisfeiler-Leman GNNs with Provable Cycle Counting PowerJunru Zhou, Jiarui Feng, Xiyuan Wang, Muhan ZhangNeurIPS 2023 · 15 citations
- Learning to Count Isomorphisms with Graph Neural NetworksXingtong Yu, Zemin Liu, Yuan Fang, Xinming ZhangAAAI 2023 · 24 citations
