MATA*: Combining Learnable Node Matching with A* Algorithm for Approximate Graph Edit Distance Computation

Junfeng Liu, Min Zhou, Shuai Ma, Lujia Pan · DOI

Abstract

Calculating the Graph Edit Distance (GED) is a fundamental task in graph similarity analysis, yet its NP-complete nature poses significant challenges for scalability and accuracy. Traditional combinatorial methods like A provide exact solutions but suffer from factorial time complexity, while modern neural regression models offer speed at the cost of precision and interpretability. This paper presents MATA (Matching-based A), a hybrid framework that bridges this gap. By utilizing a structure-enhanced Graph Neural Network (GNN) to learn node-to-node correspondences rather than simple similarity scores, MATA effectively prunes the A search space. Experimental results across diverse datasets demonstrate that MATA achieves state-of-the-art accuracy, recovers the actual edit path, and scales to graphs significantly larger than those handled by previous hybrid approaches.

1. Introduction

Graph Edit Distance (GED) is widely considered the "gold standard" for measuring the similarity between two graphs. It is defined as the minimum cost of a sequence of edit operations—including node/edge additions, deletions, and relabelings—required to transform one graph into another. Despite its utility in fields ranging from chemoinformatics to social network analysis, computing exact GED is NP-complete.

Existing methodologies generally fall into two categories: combinatorial search and learning-based regression. Combinatorial algorithms, such as A, guarantee optimal solutions but are computationally prohibitive for graphs exceeding 16 nodes. Conversely, learning-based models using GNNs provide rapid approximations but often underestimate distances and fail to provide the "edit path" (the specific sequence of operations). MATA addresses these limitations by treating GED computation as a learning-guided search problem, focusing on node matching as the primary driver of distance calculation.

2. The MATA* Framework

MATA* integrates deep learning with classical search through three specialized modules designed to capture structural nuances and optimize the search process.

2.1 Structure-Enhanced GNN (SEGcn)

GED is inherently structure-dominant, as most edit operations involve the modification of edges. To capture this, MATA* employs a Structure-Enhanced GNN (SEGcn). Unlike vanilla GNNs, SEGcn incorporates:

  • Degree Encoding: To capture local connectivity patterns.
  • Position Encoding: Utilizing random walk probabilities with added noise to provide each node with a unique structural signature, allowing the model to distinguish between nodes in different parts of the graph.

2.2 Matching Module

Rather than regressing a single scalar value, the Matching Module learns to produce a similarity matrix between the nodes of two graphs. By employing a differentiable top-$k$ operation via Sinkhorn normalization, the model identifies the most likely candidate matches. This approach acknowledges that multiple "optimal" matchings may exist, providing the search algorithm with a flexible set of high-probability directions.

2.3 A* Integration and Refinement

During the inference phase, MATA utilizes the learned top-$k$ candidates to prune the search tree of the ALSa algorithm. By restricting the search to the "promising" node pairings suggested by the GNN, the framework avoids the combinatorial explosion of the standard A* algorithm while maintaining the ability to recover the specific edit path.

3. Experimental Evaluation

The authors evaluated MATA* against three real-world benchmarks representing different graph characteristics:

  • Aids: 700 small chemical compound graphs (up to 10 nodes).
  • IMDB: 1,500 ego-networks of movie actors (7 to 89 nodes). These graphs are non-attributed, placing the burden of matching entirely on structural topology.
  • Cancer: 800 carcinogenic molecule graphs (21 to 90 nodes), testing the model's scalability on complex structures.

4. Key Results and Insights

MATA* demonstrated superior performance across all metrics compared to combinatorial, learning-based, and existing hybrid baselines.

  • Accuracy: The model achieved significant improvements in GED accuracy, with gains of 39.0% on the Aids dataset, 21.6% on IMDB, and 11.7% on Cancer compared to the next best performing models.
  • Scalability and Efficiency: MATA successfully processed graphs with up to 90 nodes, whereas previous hybrid models like GENNA often encountered memory overflows or timeouts. Furthermore, MATA* proved to be approximately 10,000 times faster than prior hybrid approaches on small-scale graphs due to its highly efficient pruning mechanism.
  • The Power of Matching: A central insight of this work is that predicting node-to-node correspondence is a more robust and informative task than scalar distance regression. By prioritizing structural matching, the model inherently captures the logic of the edit distance.

5. Conclusion and Future Work

MATA represents a significant advancement in approximate GED computation by successfully combining the strengths of GNNs and A search. While the current framework focuses on uniform edit costs and requires supervised ground-truth data for training, it sets a new benchmark for accuracy and scalability. Future research directions include extending the framework to non-uniform cost functions and exploring self-supervised learning techniques to alleviate the need for expensive ground-truth GED labels.

Summary updated

BibTeX
@inproceedings{liu2023mata,
  author = {Junfeng Liu and Min Zhou and Shuai Ma and Lujia Pan},
  title = {{MATA*: Combining Learnable Node Matching with A* Algorithm for Approximate Graph Edit Distance Computation}},
  booktitle = {ACM International Conference on Information and Knowledge Management},
  year = {2023},
  url = {https://openreview.net/forum?id=iQa3w5Qysw},
}
Figure