Local Fragments, Global Gains: Subgraph Counting using Graph Neural Networks
- GNN
Subgraph counting is a fundamental task for analyzing structural patterns in graph-structured data, with important applications in domains such as computational biology and social network analysis, where recurring motifs reveal functional and organizational properties. In this paper, we propose localized versions of the Weisfeiler-Leman (WL) algorithms to improve both expressivity and computational efficiency for this task. We introduce Local -WL, which we prove to be more expressive than -WL and at most as expressive as -WL, and provide a characterization of patterns whose subgraph and induced subgraph counts are invariant under Local -WL equivalence. To enhance scalability, we present two variants -- Layer -WL and Recursive -WL -- that achieve greater time and space efficiency compared to applying -WL on the entire graph. Additionally, we propose a novel fragmentation technique that decomposes complex subgraphs into simpler subpatterns, enabling the exact count of all induced subgraphs of size at most using only -WL, with extensions possible for larger patterns when . Building on these ideas, we develop a three-stage differentiable learning framework that combines subpattern counts to compute counts of more complex motifs, bridging combinatorial algorithm design with machine learning approaches. We also compare the expressive power of Local -WL with existing GNN hierarchies and demonstrate that, under bounded time complexity, our methods are more expressive than prior approaches.
View on arXiv