Abstract
Graph Edit Distance (GED) is the standard metric for measuring graph similarity, yet its computational complexity (NP-hard) necessitates efficient neural approximations. Existing neural models often assume uniform costs for edit operations, failing to capture the domain-specific nuances of real-world applications. We present GRAPHEDX, a novel neural estimator that explicitly incorporates non-uniform costs for node and edge additions and deletions. By reformulating GED as a differentiable "neural set divergence" problem with consistent node-edge alignments, GRAPHEDX significantly outperforms existing state-of-the-art methods across diverse real-world datasets.
Introduction
Graph Edit Distance (GED) calculates the minimum cost to transform one graph into another using four basic operations: adding/deleting nodes and adding/deleting edges. While it is the "gold standard" for similarity, calculating the exact GED is computationally prohibitive. Consequently, researchers have turned to Graph Neural Networks (GNNs) to estimate it.
However, most existing neural models simplify GED into a basic Euclidean distance between graph embeddings, assuming every edit operation costs the same (usually 1). In practical scenarios—such as comparing chemical molecules or social networks—deleting a specific functional group might be far more significant than adding a simple edge. GRAPHEDX addresses this by allowing for asymmetric, domain-specific costs within a differentiable framework.
Methodology
GRAPHEDX approaches GED through the lens of a Quadratic Assignment Problem (QAP). To make this tractable for deep learning, the model implements several key innovations:
- Neural Set Divergence Surrogates: Graphs are represented as sets of node and edge embeddings. The model uses continuous functions (surrogates) to estimate the cost of misalignments between these sets.
- Consistent Alignments: A common failure in neural graph matching is "hallucinating" contradictory alignments. GRAPHEDX uses a Gumbel-Sinkhorn network to generate a soft node-alignment matrix ($P$) and mathematically derives a consistent edge-alignment matrix ($S$) from it.
- XOR-DIFFALIGN: This specialized surrogate mimics GED logic by using an XOR operator on adjacency matrices, ensuring an "edge edit cost" is only triggered when mapping an existing edge to a non-existent one.
- Late Interaction: To maintain efficiency for retrieval, embeddings are computed independently and only interact at the final alignment stage, allowing for fast indexing and searching.
Experimental Setup
The model was evaluated on seven diverse real-world datasets, ranging from bio-informatics (Mutag, AIDS, Ogbg-Molhiv) to programming systems (Ogbg-Code2, Linux). Ground-truth GED values were generated using the exact F2 solver to provide a rigorous benchmark for the neural estimator.
Results and Discussion
GRAPHEDX demonstrates superior accuracy and flexibility compared to existing baselines. Key findings include:
- Accuracy Gains: In uniform cost settings, GRAPHEDX improved upon state-of-the-art (SOTA) results by approximately 15%. In non-uniform cost settings, the advantage was even more pronounced, outperforming baselines by up to 30% on the Code2 dataset.
- Informative Non-edges: By explicitly embedding "non-edges" (pairs of nodes with no connection), the model captures global structure and "empty space," which is crucial for accurate cost estimation.
- Symmetry Breaking: The model respects the property that $GED(G, G')$ may not equal $GED(G', G)$ when addition and deletion costs differ, a vital feature for tasks like subgraph detection.
Conclusion and Future Work
GRAPHEDX provides a robust framework for estimating GED with general costs, offering both high accuracy and computational efficiency. While the current model requires significant memory for large graphs ($N^2$ representations) and uses fixed costs per dataset, future work will focus on optimizing memory scaling and developing "richly-attributed" costs where edit weights depend on specific node attributes (e.g., atom types in chemistry).
Summary updated