Computing Optimal Assignments in Linear Time for Graph Matching

Nils M. Kriege, Pierre-Louis Giscard, Franka Bause, Richard C. WilsonarXiv 2019

Abstract

The optimal assignment problem is a fundamental challenge in graph matching and machine learning, traditionally constrained by $O(n^3)$ complexity. This paper introduces a novel algorithm that achieves linear-time complexity ($O(n + t)$) by restricting the cost function to a tree metric. This advancement makes large-scale graph classification and comparison feasible, providing a significant speedup over standard bipartite matching methods while maintaining competitive accuracy.

Introduction

Finding the "best fit" or optimal assignment between two sets of objects is essential for tasks ranging from computer vision to natural language processing. In the context of graph theory, this problem is frequently used to approximate the Graph Edit Distance (GED)—the minimum cost required to transform one graph into another. However, the standard Hungarian algorithm's $O(n^3)$ runtime creates a significant bottleneck for large datasets. Furthermore, computing the exact GED is NP-hard. This research identifies a specific class of cost functions—tree metrics—that allow for exact assignment solutions in linear time.

Methodology: The Tree Metric Approach

The core innovation lies in the assumption that matching costs are defined by distances within a weighted tree. This "tree metric" allows for an efficient bottom-up matching strategy.

An example of a tree metric and the corresponding assignment indices used to calculate costs.

The algorithm proceeds as follows:

  1. Bottom-Up Matching: Starting at the leaves, objects are matched at the lowest possible common ancestor.
  2. Residual Propagation: Unmatched objects are passed up to the parent node until the root is reached.
  3. Graph Integration: To apply this to graphs, the authors utilize Weisfeiler-Lehman (WL) refinement for discrete labels and hierarchical clustering (bisecting k-means) for continuous attributes.

A key theoretical insight is that optimal assignment costs under a tree metric can be embedded into an $\ell_1$ vector space. This allows a graph to be represented as a single vector, where the Manhattan distance between vectors corresponds to the optimal assignment cost, facilitating rapid nearest-neighbor searches.

Experimental Evaluation

The "Linear" approach was tested against standard benchmarks, including the IAM Graph Database (AIDS, Letter, Mutagenicity) and the NCI1 chemical compound dataset. Synthetic Erdős–Rényi graphs were also used to evaluate scaling behavior.

Key Results

The empirical results demonstrate a transformative improvement in computational efficiency. On the Mutagenicity dataset, the proposed Linear method completed classification in 3 seconds, compared to 1 hour and 21 minutes for the standard Bipartite (BP) approach.

Runtime scaling as a function of graph size (a) and dataset size (b), showing the linear efficiency of the proposed method.

As shown in the scaling plots, the Linear method maintains a flat runtime trajectory relative to graph and dataset size, whereas Exact, Greedy, and BP methods exhibit exponential or polynomial growth. Remarkably, this speed does not come at the cost of accuracy; in several benchmarks, the Linear approach outperformed BP by capturing richer structural information through the WL tree hierarchy.

Conclusion and Future Work

While the algorithm requires costs to follow a tree metric—a potential limitation for some data types—it provides a powerful tool for large-scale graph analysis. Future research may leverage the $\ell_1$ embedding for locality-sensitive hashing (LSH) to enable even faster similarity searches in massive graph databases.

Summary updated

BibTeX
@misc{kriege2019computing,
  author = {Nils M. Kriege and Pierre-Louis Giscard and Franka Bause and Richard C. Wilson},
  title = {{Computing Optimal Assignments in Linear Time for Graph Matching}},
  year = {2019},
  eprint = {1901.10356},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1901.10356},
}
Figure