Skip to main content
QUICK REVIEW

[Paper Review] GREED: A Neural Framework for Learning Graph Distance Functions

Rishabh Ranjan, Siddharth Grover|arXiv (Cornell University)|Dec 24, 2021
Advanced Graph Neural NetworksComputer Science17 citations
TL;DR

GREED is a siamese graph neural network framework that learns graph edit distance (Ged) and subgraph edit distance (Sed) in polynomial time while preserving key metric properties like the triangle inequality. It achieves state-of-the-art accuracy and up to 3 orders of magnitude faster inference than exact methods, with indexable embeddings enabling 50x speedups in CPU-only graph retrieval compared to GPU-based baselines.

ABSTRACT

Among various distance functions for graphs, graph and subgraph edit distances (GED and SED respectively) are two of the most popular and expressive measures. Unfortunately, exact computations for both are NP-hard. To overcome this computational bottleneck, neural approaches to learn and predict edit distance in polynomial time have received much interest. While considerable progress has been made, there exist limitations that need to be addressed. First, the efficacy of an approximate distance function lies not only in its approximation accuracy, but also in the preservation of its properties. To elaborate, although GED is a metric, its neural approximations do not provide such a guarantee. This prohibits their usage in higher order tasks that rely on metric distance functions, such as clustering or indexing. Second, several existing frameworks for GED do not extend to SED due to SED being asymmetric. In this work, we design a novel siamese graph neural network called GREED, which through a carefully crafted inductive bias, learns GED and SED in a property-preserving manner. Through extensive experiments across 10 real graph datasets containing up to 7 million edges, we establish that GREED is not only more accurate than the state of the art, but also up to 3 orders of magnitude faster. Even more significantly, due to preserving the triangle inequality, the generated embeddings are indexable and consequently, even in a CPU-only environment, GREED is up to 50 times faster than GPU-powered baselines for graph / subgraph retrieval.

Motivation & Objective

  • To address the lack of metric-preserving neural approximations for graph edit distance (Ged) and subgraph edit distance (Sed), which limits their use in higher-order tasks like clustering and indexing.
  • To design a neural framework that generalizes across unseen query distributions and sizes, especially given the high computational cost of exact Ged and Sed computation.
  • To enable indexable graph embeddings by eliminating pair-dependent computations, thus allowing pre-computation and sub-linear query time via standard indexing structures.
  • To extend neural learning to Sed, which is asymmetric and has not been previously addressed by existing neural frameworks.
  • To improve generalization and scalability by learning from smaller training graphs and generalizing to larger, unseen query sizes.

Proposed method

  • Proposes a siamese GNN architecture with a custom prediction head that enforces metric properties (e.g., triangle inequality) through inductive bias.
  • Uses a Siamese encoder to embed both graphs independently, followed by a learnable distance head that computes the predicted distance from the pair of embeddings.
  • Employs a sum-pooling layer and GIN-based message passing to capture structural and feature-level graph representations.
  • Introduces a novel sampling strategy (shaDow, BFS, Rw, Rwr) to generate diverse, realistic query distributions for training and evaluation.
  • Enables indexing by ensuring that graph embeddings are independent of query pairs—allowing pre-computation and efficient k-NN or range queries.
  • Trains on synthetic and real graph pairs with known edit distances, using a loss function that minimizes prediction error while preserving theoretical properties.

Experimental results

Research questions

  • RQ1Can a neural framework learn graph edit distance (Ged) and subgraph edit distance (Sed) in polynomial time while preserving metric properties such as the triangle inequality?
  • RQ2To what extent can a neural model generalize to unseen query distributions (e.g., random walks, shaDow) not seen during training?
  • RQ3Can the model generalize to larger, unseen query sizes when trained on smaller graphs, and how does performance degrade?
  • RQ4Can the learned embeddings be indexed to enable sub-linear query time, and how does this affect retrieval speed compared to non-indexed or GPU-based baselines?
  • RQ5Does the siamese architecture with a custom prediction head outperform dual-branch or MLP-based alternatives in terms of accuracy and inductive bias?

Key findings

  • GREED achieves state-of-the-art performance on 10 real-world graph datasets, with RMSE values significantly lower than existing baselines like H2MN and MIP-F2.
  • GREED is up to 3 orders of magnitude faster than exact Ged/Sed computation, enabling efficient inference on large-scale graphs with up to 7 million edges.
  • Due to metric-preserving property, GREED's embeddings are indexable, allowing CPU-only retrieval systems to be up to 50x faster than GPU-powered baselines.
  • GREED generalizes well to unseen query distributions: RMSE on random walk (Rw) and random walk with restart (Rwr) queries is lower than on the training distribution (BFS), indicating strong generalization.
  • When trained on queries up to size 25, Greed shows significant performance degradation on queries of size 25–50, but remains superior to MIP-F2 even with a 60-second time limit.
  • The Greed-NN variant (with Siamese inductive bias) outperforms Greed-Dual (with custom prediction head), suggesting the Siamese architecture provides stronger inductive bias than the prediction head alone.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.