Efficient Graph Similarity Computation with Alignment Regularization

Wei Zhuo, Guang Tan

Overview

Comparing the structural similarity between two graphs is a fundamental task in domains ranging from drug discovery (identifying similar molecular structures) to social network analysis. The gold standard metric for this is Graph Edit Distance (GED), which measures the minimum number of edits required to transform one graph into another. However, calculating exact GED is an NP-hard problem, making it computationally prohibitive for large datasets.

To address this, researchers increasingly rely on Graph Neural Networks (GNNs) to approximate GED. While state-of-the-art GNN models achieve high accuracy, they typically rely on a "matching module" that compares every node in Graph A to every node in Graph B. This creates a massive computational bottleneck, as the cost grows quadratically ($O(N^2)$) with the number of nodes.

This paper introduces ERIC (Efficient gRaph sImilarity Computation), a framework that significantly speeds up Graph Similarity Computation (GSC) by shifting the expensive node-matching process from the inference stage to a training-only regularization term. By utilizing Alignment Regularization (AReg) and a multi-scale discriminator, ERIC achieves state-of-the-art accuracy while operating orders of magnitude faster than traditional cross-graph matching models.

Comparison of traditional joint matching versus the proposed separated structure.

The Core Innovation: Alignment Regularization

The central challenge in GSC is capturing fine-grained, node-level interactions without incurring the heavy computational cost of a matching module during inference. The authors propose a paradigm shift: matching is for training, not testing.

Instead of explicitly matching nodes during a search query (inference), ERIC uses Alignment Regularization (AReg) as a "teacher" during the training phase. AReg forces the GNN encoder to implicitly learn node-graph correspondences. Because this is strictly a regularization term, it is entirely discarded during inference. This allows the model to compute similarity scores directly from the learned graph-level embeddings, bypassing the $O(N^2)$ bottleneck entirely.

Furthermore, AReg is a "plug-and-play" module. The authors demonstrate that adding AReg to other existing GSC models (such as SimGNN or EGSC) consistently improves their performance, proving its versatility as a model-agnostic enhancement.

The ERIC Framework

Beyond AReg, the ERIC framework introduces a robust architecture designed to maximize the expressive power of the learned embeddings.

The ERIC framework architecture featuring multi-scale representations and Alignment Regularization.

Most traditional models use a single head to predict similarity from the final layer of a GNN. ERIC, however, extracts representations from every layer of the GNN, creating a multi-scale view of the graph. These multi-scale embeddings are then fed into a dual GED Discriminator that combines two distinct distance metrics:

  1. Neural Tensor Network (NTN): Excels at modeling complex feature relationships and tightening clusters of similar graphs.
  2. Exponential $p$-order Minkowski distance ($\ell_p$): Acts as a corrective force that better captures structural dissimilarities, pulling similar graphs closer to the query while pushing dissimilar ones further away.

Visualizations in the paper using t-SNE plots confirm that combining these two metrics yields a much more accurate and discriminative embedding space than using either alone.

Key Results and Performance

The model was rigorously evaluated on four widely used benchmark datasets: AIDS700 and LINUX (smaller graphs with exact GEDs), and IMDB and NCI109 (larger graphs with approximated GEDs).

  • Superior Accuracy: ERIC consistently outperformed state-of-the-art models (including SimGNN, GMN, and GraphSim) across almost all metrics, including Mean Squared Error (MSE) and ranking correlations (Spearman’s $\rho$).
  • Massive Speedup: The efficiency gains are dramatic due to the removal of the inference-time matching module. On the complex NCI109 dataset, ERIC completed inference in just 1,763 seconds, whereas the popular GMN model took over 10,000 seconds.
  • Effective Ranking: In visual search tests, ERIC’s predicted similarity rankings closely matched the "ground truth" rankings produced by exact, computationally heavy combinatorial algorithms.

Limitations and Future Directions

While ERIC presents a major leap forward in GSC efficiency, it does have limitations. Like all learning-based GSC methods, it requires ground-truth GEDs for training. For exceptionally large graphs where even approximate GED is difficult to compute, generating sufficient training data remains a hurdle. Additionally, the model introduces new hyperparameters (such as the regularization weight $\lambda$ and the Minkowski order $p$) that may require tuning for unseen datasets.

Looking forward, the authors suggest that this "separated structure"—moving complex matching operations to the training phase via regularization—could be applied to other complex graph tasks, such as graph alignment or subgraph isomorphism, opening new avenues for efficient graph representation learning.

Summary updated

BibTeX
@inproceedings{zhuo2022efficient,
  author = {Wei Zhuo and Guang Tan},
  title = {{Efficient Graph Similarity Computation with Alignment Regularization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=lblv6NGI7un},
}
Figure