The all pairs shortest path problem is a fundamental optimization problem in graph theory. We deal with re-calculating the all-pairs shortest path (APSP) matrix after a minor modification of a weighted dense graph, e.g., adding a node, removing a node, or updating an edge. We assume the APSP matrix for the original graph is already known. The graph can be directed or undirected. A cold-start calculation of the new APSP matrix by traditional algorithms, like the Floyd-Warshall algorithm or Dijkstra's algorithm, needs $ O(n^3) $ time. We propose two algorithms for warm-start calculation of the new APSP matrix. The best case complexity for a warm-start calculation is $ O(n^2) $, the worst case complexity is $ O(n^3) $. We implemented the algorithms and tested their performance with experiments. The result shows a warm-start calculation can save a great portion of calculation time, compared with cold-start calculation.
翻译:全源最短路径问题是图论中的基础优化问题。本文研究在加权稠密图发生微小修改(如添加节点、删除节点或更新边权)后,如何重新计算全源最短路径矩阵。我们假设原始图的全源最短路径矩阵已知,且图可为有向图或无向图。若采用传统算法(如Floyd-Warshall算法或Dijkstra算法)进行冷启动计算,需要 $ O(n^3) $ 时间复杂度。本文提出两种热启动计算新全源最短路径矩阵的算法,其最优情况复杂度为 $ O(n^2) $,最坏情况复杂度为 $ O(n^3) $。我们实现了所提算法并通过实验测试其性能,结果表明相较于冷启动计算,热启动计算能显著节省计算时间。