A fast algorithm for All-Pairs-Shortest-Paths suitable for neural networks
Zeyu Jing, Markus Meister
TL;DR
This work introduces the R-distance, a resolvent-based proxy for all-pairs shortest-path distances on directed graphs, defined as $R_{ij}(\gamma)=\log_{\gamma}\big[(\mathbf{I}-\gamma\mathbf{A})^{-1}\big]_{ij}$, which converges to the true distance $D_{ij}$ as $\gamma\to 0$. It shows how this quantity naturally arises from an analog neural network with recurrent feedback and derives rigorous bounds on the gain $\gamma$ that separate global accuracy from local usefulness, extending the approach to weighted graphs with positive weights. The authors provide both asymptotic results and finite-gain analyses, including sufficient conditions and bounds for trees and general graphs, and demonstrate that the R-distance can guide greedy descent even when not globally exact. They discuss digital-implementation considerations, including precision limitations and computational complexity, arguing that the method offers a practical speedup on dense graphs and a compelling neuromorphic interpretation, while acknowledging limitations due to finite precision and path redundancy. Overall, the paper presents a novel, resolvent-based APSP method with theoretical guarantees and potential neuromorphic applications, bridging matrix inversion, graph distances, and neural-network-inspired computation.
Abstract
Given a directed graph of nodes and edges connecting them, a common problem is to find the shortest path between any two nodes. Here we show that the shortest path distances can be found by a simple matrix inversion: If the edges are given by the adjacency matrix $A_{ij}$ then with a suitably small value of $γ$ the shortest path distances are $$ D_{ij} = \operatorname{ceil} \left( \log_γ {\left[ {\left({\mathbf{I}}-γ{\mathbf{A}}\right)^{-1}} \right]}_{ij} \right)$$ We derive several graph-theoretic bounds on the value of $γ$, and explore its useful range with numerics on different graph types. Even when the distance function is not globally accurate across the entire graph, it still works locally to instruct pursuit of the shortest path. In this mode, it also extends to weighted graphs with positive edge weights. For a wide range of dense graphs this distance function is computationally faster than the best available alternative. Finally we show that this method leads naturally to a neural network solution of the all-pairs-shortest-path problem.
