Geodesic Distance Between Graphs: A Spectral Metric for Assessing the Stability of Graph Neural Networks

Soumen Sikder Shuvo, Ali Aghdaei, Zhuo Feng · DOI

Abstract

Comparing graphs is a fundamental task in machine learning, yet traditional metrics often struggle with global structural changes or rely excessively on node attributes. This paper introduces Graph Geodesic Distance (GGD), a novel spectral metric that treats graphs as points on a curved Riemannian manifold of Laplacian matrices. By leveraging spectral graph theory, GGD captures deep structural differences that traditional metrics miss. Our evaluation shows that GGD outperforms state-of-the-art methods in graph classification and GNN stability analysis while being up to 9x faster.

Introduction

The challenge of comparing two graphs typically falls into two categories: local heuristics like Graph Edit Distance (GED), which fail to capture global structural shifts, or feature-heavy metrics like Tree Mover’s Distance (TMD), which are sensitive to noisy or missing node attributes. Moreover, many existing metrics are computationally intensive, often relying on expensive Optimal Transport (OT) calculations.

GGD provides a mathematically rigorous "true" metric that is computationally efficient and capable of capturing intrinsic structural properties—such as connectivity, bottlenecks, and mixing time—even in the absence of node features.

Methods

The GGD framework follows a two-phase pipeline designed to align and then measure the distance between graph structures.

1. Spectral Graph Matching

Before comparison, node correspondence must be established. The authors utilize GRAMPA, a method that aligns the eigenvectors of the graphs' adjacency matrices to determine the optimal node-to-node mapping.

2. Geodesic Distance Calculation

Matched graphs are represented by their Laplacian matrices. By adding a small regularization term ($\epsilon$) to the diagonal, these matrices become Symmetric Positive Definite (SPD), allowing them to be mapped onto a Riemannian manifold. GGD is defined as the length of the shortest path (the geodesic) between these two points on the manifold, computed via the generalized eigenvalues of the matrix pair.

The GGD pipeline: from input graphs of different sizes to geodesic distance calculation on a Riemannian manifold.

Spectral Coarsening

To handle graphs of varying sizes, a resistance-based coarsening scheme is introduced. This process reduces the size of the larger graph while preserving its "spectral signature," ensuring that key structural properties remain intact during comparison.

Key Insights and Results

The authors evaluated GGD across biological, chemical, and image-based datasets (e.g., MUTAG, BZR, MNIST-to-graph).

Robustness and Efficiency

A significant advantage of GGD is its reliance on the graph's "skeleton" (the Laplacian) rather than node features. In tests where 80% of node attributes were deleted, GGD's performance remained stable, while competing metrics like TMD saw significant accuracy drops. Furthermore, GGD demonstrated a 6x to 9x runtime speedup over TMD on larger datasets.

GNN Stability and Correlation

GGD serves as a powerful diagnostic tool for Graph Neural Network (GNN) stability. It shows a much stronger correlation with GNN output embeddings ($r \approx 0.77$) compared to TMD ($r \approx 0.53-0.61$). This suggests that GGD better captures the structural features that neural networks actually utilize for representation.

Correlation between graph metrics (GGD and TMD) and GNN output embeddings, showing GGD's superior alignment with neural network representations.

Conclusion

GGD introduces a robust, spectral approach to graph comparison that excels in efficiency and structural awareness. While the current $O(n^3)$ complexity poses challenges for massive graphs, the use of "extreme" eigenvalues offers a viable path for approximation. Future work will explore extending GGD to directed and multi-relational graph structures.

Summary updated

BibTeX
@misc{shuvo2024geodesic,
  author = {Soumen Sikder Shuvo and Ali Aghdaei and Zhuo Feng},
  title = {{Geodesic Distance Between Graphs: A Spectral Metric for Assessing the Stability of Graph Neural Networks}},
  year = {2024},
  eprint = {2406.10500},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.10500},
}
Figure