Skip to main content
QUICK REVIEW

[论文解读] A fast algorithm for All-Pairs-Shortest-Paths suitable for neural networks

Zeyu Jing, Markus Meister|PubMed|Aug 6, 2023
Data Management and AlgorithmsComputer Science被引用 3
一句话总结

该论文提出了一种新颖的、可微分的算法,用于通过加权邻接矩阵的矩阵求逆来计算所有点对最短路径(APSP),其中最短路径距离通过重构矩阵的对数变换获得。该方法实现了快速、可扩展且神经上合理的图距离计算,特别适用于模拟和神经网络实现,在适当选择 γ 的情况下可保证结果的精确性。

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 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:msub><mml:mi>A</mml:mi> <mml:mrow><mml:mi>i</mml:mi> <mml:mi>j</mml:mi></mml:mrow> </mml:msub> </mml:math> then with a suitably small value of <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>γ</mml:mi></mml:math> the shortest path distances are <DispFormula> <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"> <mml:mrow><mml:msub><mml:mi>D</mml:mi> <mml:mrow><mml:mi>i</mml:mi> <mml:mi>j</mml:mi></mml:mrow> </mml:msub> <mml:mo>=</mml:mo> <mml:mtext>ceil</mml:mtext> <mml:mrow><mml:mo>(</mml:mo> <mml:mrow> <mml:msub><mml:mrow><mml:mi>log</mml:mi></mml:mrow> <mml:mi>γ</mml:mi></mml:msub> <mml:msub> <mml:mrow><mml:mrow><mml:mo>[</mml:mo> <mml:mrow> <mml:msup><mml:mrow><mml:mo>(</mml:mo> <mml:mstyle><mml:mi>I</mml:mi></mml:mstyle> <mml:mo>-</mml:mo> <mml:mi>γ</mml:mi> <mml:mstyle><mml:mi>A</mml:mi></mml:mstyle> <mml:mo>)</mml:mo></mml:mrow> <mml:mrow><mml:mo>-</mml:mo> <mml:mn>1</mml:mn></mml:mrow> </mml:msup> </mml:mrow> <mml:mo>]</mml:mo></mml:mrow> </mml:mrow> <mml:mrow><mml:mi>i</mml:mi> <mml:mi>j</mml:mi></mml:mrow> </mml:msub> </mml:mrow> <mml:mo>)</mml:mo></mml:mrow> </mml:mrow> </mml:math> </DispFormula> We derive several graph-theoretic bounds on the value of <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>γ</mml:mi></mml:math> , 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.

研究动机与目标

  • 开发一种适用于神经网络架构的可微分、快速且可扩展的所有点对最短路径(APSP)计算算法。
  • 证明对 (I - γA)⁻¹ 进行矩阵求逆并结合对数变换,即使在有向加权图中也能得到准确的最短路径距离。
  • 表明该方法在密集图上比传统 APSP 算法计算更快,且适用于模拟或神经形态硬件。
  • 建立一种生物上合理的机制,用于大脑中的路径寻找,通过循环神经电路计算 R-距离。
  • 提供一个实用的 γ 选择框架,以确保距离估计的局部和全局准确性。

提出的方法

  • 该方法使用 R-距离公式:R_ij(γ) = log[(I - γA)⁻¹]_ij / log(γ),其中 A 为邻接矩阵,γ 为一个较小的正标量。
  • 对于无权图,当 γ 足够小时,R-距离会四舍五入到真实的最短路径距离 D_ij,满足 γ < 1/N_ij^(k)(对所有路径成立)。
  • 通过将 A 替换为 γ^W_ij,该方法可推广至加权图,从而在矩阵幂运算中编码正整数权重。
  • 该方法利用重构矩阵 (I - γA)⁻¹ 的幂级数展开:(I - γA)⁻¹ = I + γA + γ²A² + ...,其和对所有路径按 γ^k 加权求和。
  • 该算法天然适用于模拟或神经网络硬件,其中矩阵求逆和对数运算可通过连续时间动力学实现。
  • 该网络具有动态响应性:改变边权重或输入节点会立即更新输出,从而实现实时路径寻找。
Figure 1: Performance of the R-distance. Each row represents a family of graphs illustrated by the icon on the left, with node numbers given in the legend. Global: Global performance: fraction of distances between nodes predicted correctly by Eqn 10 , as a function of the gain parameter $\gamma$ . L
Figure 1: Performance of the R-distance. Each row represents a family of graphs illustrated by the icon on the left, with node numbers given in the legend. Global: Global performance: fraction of distances between nodes predicted correctly by Eqn 10 , as a function of the gain parameter $\gamma$ . L

实验结果

研究问题

  • RQ1对修改后的邻接矩阵进行矩阵求逆,是否能在有向加权图中得到准确的最短路径距离?
  • RQ2为确保 R-距离近似在局部和全局均准确,γ 的最优范围是什么?
  • RQ3与 Floyd-Warshall 等经典 APSP 算法相比,该方法在密集图上的计算性能如何?
  • RQ4该方法是否能在模拟或神经网络硬件中高效实现,以支持实时导航?
  • RQ5R-距离函数是否提供了一种生物上合理的机制,用于动物大脑中的路径寻找?

主要发现

  • 当 γ 满足对所有路径均有 γ < 1/N_ij^(k) 时,R-距离公式 R_ij(γ) = log[(I - γA)⁻¹]_ij / log(γ) 能精确得到最短路径距离 D_ij,此时 ceil(R_ij(γ)) = D_ij。
  • 对于包含数千个节点的密集图,该方法的运行速度超过 Floyd-Warshall 的朴素实现及其他传统 APSP 算法。
  • 即使在全局精度因机器精度限制而失效时,该方法仍保持局部精度,因此在动态环境中具有鲁棒性。
  • 通过在矩阵幂运算中将 A 替换为 γ^W_ij,该方法可推广至具有正整数权重的加权图。
  • 该算法天然适用于模拟和神经形态计算,硬件上的潜在收敛时间可达微秒级。
  • 该方法提供了一种生物上合理的路径寻找机制,因其底层电路结构与动物大脑中发现的循环神经电路相匹配。
Figure 2: The R-distance on weighted graphs. Results on a dense graph (as in Fig 1 D,I) with random positive edge weights. A: The R-distance plotted against the true graph distance. $V=1000$ vertices, $p=0.5$ edge probability, edge weights range from 1 to 100 with log-uniform distribution. $\gamma=1
Figure 2: The R-distance on weighted graphs. Results on a dense graph (as in Fig 1 D,I) with random positive edge weights. A: The R-distance plotted against the true graph distance. $V=1000$ vertices, $p=0.5$ edge probability, edge weights range from 1 to 100 with log-uniform distribution. $\gamma=1

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。