We present an $O(nm)$ algorithm for all-pairs shortest paths computations in a directed graph with $n$ nodes, $m$ arcs, and nonnegative integer arc costs. This matches the complexity bound attained by Thorup \cite{Thorup1999} for the all-pairs problems in undirected graphs. The main insight is that shortest paths problems with approximately balanced directed cost functions can be solved similarly to the undirected case. The algorithm finds an approximately balanced reduced cost function in an $O(m\sqrt{n}\log n)$ preprocessing step. Using these reduced costs, every shortest path query can be solved in $O(m)$ time using an adaptation of Thorup's component hierarchy method. The balancing result can also be applied to the $\ell_\infty$-matrix balancing problem.
翻译:我们提出了一个用于所有最短路径的$O(nm) 算法, 用于所有最短路径的计算, 其方向图中含有n美元节点、 $m 弧值和非负整弧值的成本。 这与Thorup\ cite{Torup1999} 在未定向图表中所有路径问题所绑定的复杂程度相符。 主要的洞察力是, 与非定向案例一样, 具有大致平衡的直接成本函数的最短路径问题可以得到解决。 该算法在前处理步骤中找到一个略微平衡的降低成本功能。 使用这些降低的成本, 每一个最短路径查询都可以在时间里用 $(m) 来解决 。 平衡结果也可以用于 $\ inty$- matrix 平衡问题 。