Introduction
Measuring the similarity between two graphs is a fundamental task in fields ranging from bioinformatics to social network analysis. The most intuitive measure of graph similarity is the chemical distance, which seeks the optimal node permutation that minimizes edge discrepancies between two adjacency matrices. However, calculating the chemical distance is computationally intractable for large graphs, as it requires searching through $n!$ possible permutations—a problem closely related to the Graph Isomorphism problem.
To circumvent this complexity, researchers often rely on heuristics. While these methods are fast, they frequently fail to satisfy the triangle inequality, a core requirement for a mathematical metric. Without the triangle inequality, standard data science algorithms like K-means clustering and nearest-neighbor search lose their theoretical guarantees, often leading to inconsistent or nonsensical results. This paper introduces a new family of "tractable" graph metrics that are both polynomial-time computable and mathematically rigorous.
Methodology
The authors propose a generalized distance framework defined as:
$$d_S(A, B) = \min_{P \in S} \|AP - PB\|$$
Where $A$ and $B$ are the adjacency matrices of the graphs being compared, and $S$ is a set of matrices. The innovation lies in the relaxation of the set $S$ from strict permutation matrices to sets that allow for efficient optimization:
- Convex Relaxation (Doubly Stochastic Matrices): By allowing $P$ to be a doubly stochastic matrix (where rows and columns sum to one), the problem is transformed into a convex optimization task. This ensures that the global minimum can be found efficiently using standard solvers.
- Spectral Relaxation (Orthogonal Matrices): By restricting $P$ to the set of orthogonal matrices, the distance can be computed via spectral decomposition. This approach compares the eigenvalues and eigenvectors of the graphs, offering extreme computational speed.
- Incorporating Node Attributes: The framework is extended to include node-level features (e.g., atom types in a molecule). The authors prove that adding these constraints—whether "soft" (as a penalty term) or "hard" (restricting the search space)—preserves the metric properties of the distance.
- Scalability via ADMM: To handle massive datasets, the algorithms were implemented using the Alternating Direction Method of Multipliers (ADMM) on a distributed Apache Spark cluster, allowing for the comparison of graphs with thousands of nodes.
Experimental Evaluation
The proposed metrics were evaluated against synthetic graphs (e.g., Barabasi-Albert, Erdos-Renyi) and real-world benchmarks.
Clustering Accuracy
In a classification task involving six distinct graph classes, the tractable metrics (DSL1, DSL2, and ORTHOP) achieved near-perfect accuracy. In stark contrast, popular heuristics such as IsoRank and NetAlignBP exhibited error rates as high as 60%. This failure is attributed to the heuristics' inability to maintain a consistent geometric relationship between graphs, a direct consequence of violating the triangle inequality.
Triangle Inequality Violations (TIVs)
On a benchmark of 835 small connected graphs, the authors tested for triangle inequality violations. While standard heuristics violated the inequality in up to 8% of tested triplets, the proposed tractable metrics showed zero violations, confirming their status as true mathematical metrics.
Computational Efficiency
Interestingly, the inclusion of node attributes (such as those derived from the Weisfeiler-Lehman algorithm) was found to significantly accelerate computation. By restricting which nodes can be matched, the search space for the optimal $P$ is reduced. In one experiment, these constraints provided a 110x speedup compared to the unconstrained version.
Conclusion
This work bridges the gap between computationally expensive "exact" distances and mathematically flawed heuristics. By providing a family of metrics that are both tractable and rigorous, the authors enable more reliable graph-based machine learning. Future work aims to extend these metrics to compare graphs of different sizes more robustly and to explore "multi-metrics" for simultaneous comparison of multiple graph structures.
Summary updated