VLDB2024
Fast Local Subgraph Counting
Qiyan Li, Jeffrey Xu Yu
4 citations
Abstract
We study local subgraph counting queries, Q = ( p, o ), to count how many times a given k -node pattern graph p appears around every node υ in a data graph G when the given center node o in p maps to υ. Such local subgraph counting becomes important in GNNs (Graph Neural Networks), where incorporating such counts for every node in G into the GNN architecture enhances the model's ability to capture complex relationships within the graph G. It is challenging to count by subgraph isomorphism, which is known to be NP-hard. In this paper, we propose a novel approach by tree-decomposition-based counting. For a complex pattern graph p in Q , we find its best tree decomposition T , where a node in T represents a subgraph of p , and a node in p may appear in multiple nodes in T. Let p ( T ) be the pattern represented by T. Our approach is to count p ( T ) by homomorphism with a constraint to count the subgraph in every tree node by subgraph isomorphism. We apply symmetry-breaking rules to reduce the cost of counting by subgraph isomorphism for every node in T , and we develop a new multi-join algorithm to compute such counts. We confirm that our approach on a single machine using a single core can outperform the others significantly.