Convolutional Set Matching for Graph Similarity

Yunsheng Bai, Hao Ding, Yizhou Sun, Wei WangarXiv 2018

Introduction: The Graph Similarity Challenge

Measuring the similarity between two graphs is a cornerstone of various computational tasks, from chemical compound search to software vulnerability detection. The standard metric for this task is Graph Edit Distance (GED), which quantifies the minimum number of operations—insertions, deletions, or relabeling—required to transform one graph into another. However, computing exact GED is NP-hard, making it computationally prohibitive for large-scale applications.

Traditional approximations, such as the Hungarian algorithm or Beam search, often face a trade-off between speed and accuracy. Neural network approaches have attempted to bridge this gap, but many early models simplified graphs into single vectors, losing the fine-grained node-to-node structural details necessary for precise comparison. GSimCNN (Graph Similarity Computation via Convolutional Neural Networks) addresses these limitations by reframing graph similarity as a pattern recognition problem.

Methodology: The GSimCNN Framework

The GSimCNN architecture processes graph pairs through a three-stage pipeline designed to preserve and analyze structural relationships at multiple scales:

  1. Multi-Scale Graph Convolution (GCN): The model generates node embeddings across multiple layers. Early layers capture local neighborhood information, while deeper layers encode broader structural context.
  2. Graph Interaction Layers: This stage computes the inner product between every pair of nodes from the two input graphs, resulting in a similarity matrix. To ensure consistency across varying graph sizes, the model employs BFS node ordering and bilinear interpolation to produce fixed-size matrices.
  3. CNN-based Pattern Recognition: Standard 2D CNNs are applied to these matrices, treating them as images. The CNNs learn to recognize the visual signatures of structural alignments, effectively acting as a "set matcher."
The GSimCNN architecture transforms graph pairs into multi-scale similarity matrices processed by 2D CNNs.

Experimental Setup and Datasets

The model's performance was evaluated on three diverse real-world datasets:

  • AIDS: 700 chemical compound graphs where nodes represent atoms.
  • LINUX: 1000 Program Dependence Graphs (PDGs) where nodes represent code statements.
  • IMDB: 1500 ego-networks of movie actors, representing dense social structures.

Key Insights: Similarity as a Visual Pattern

The core innovation of GSimCNN is treating the node-to-node interaction matrix as an image. This allows the model to leverage the power of CNNs to identify optimal matching patterns without explicitly solving complex combinatorial optimization problems.

Similarity matrices for different graph pairs (A-A, A-B, A-C) demonstrate how structural relationships are encoded as visual patterns.

By extracting features from every GCN layer, GSimCNN captures structural differences at every level of granularity—from a single node change to global branching variations. Furthermore, because GSimCNN learns the similarity function from data, it can adapt to the specific structural characteristics of different domains, such as the rigid rules of chemistry versus the fluid connections of social networks.

Results and Performance

GSimCNN demonstrated superior performance compared to both traditional combinatorial baselines and previous neural models:

  • Accuracy: On the AIDS dataset, GSimCNN achieved a Mean Squared Error (MSE) nearly five times lower than the leading neural baseline.
  • Ranking: The model excelled at ranking graphs by similarity, a critical requirement for search engines. Qualitative results show it successfully retrieves graphs that are structurally nearly identical to the query.
  • Efficiency: By utilizing GPU parallelization, GSimCNN maintains high processing speeds even as graph size increases, avoiding the exponential slowdown typical of exact GED algorithms.

Conclusion and Future Directions

GSimCNN represents a significant step forward in graph similarity computation by successfully combining graph neural networks with convolutional pattern recognition. While the model is highly effective at predicting similarity scores, it does not currently output the specific edit sequence required for graph transformation. Future research will focus on improving the interpretability of these predictions and exploring the model's scalability to even larger and more complex graph domains.

Summary updated

BibTeX
@misc{bai2018convolutional,
  author = {Yunsheng Bai and Hao Ding and Yizhou Sun and Wei Wang},
  title = {{Convolutional Set Matching for Graph Similarity}},
  year = {2018},
  eprint = {1810.10866},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1810.10866},
}
Figure