小编典典

关于无向图上的KSPA的建议

algorithm

KSPA有一个自定义实现,需要重新编写。当前的实现使用改进的Dijkstra算法,其伪代码在下面进行了简要说明。我认为使用边缘删除策略通常被称为KSPA。(我是图论的新手)。

Step:-1.  Calculate the shortest path between any given pair of nodes using the Dijkstra algorithm. k = 0 here.
Step:-2.   Set k = 1
Step:-3.   Extract all the edges from all the ‘k-1’ shortest path trees. Add the same to a linked list Edge_List.
Step:-4.  Create a combination of ‘k’ edges from Edge_List to be deleted at once such that each edge belongs to a different SPT (Shortest Path Tree). This can be done by inspecting the ‘k’ value for each edge of the combination considered. The ‘k’ value has to be different for each of the edge of the chosen combination.
Step:-5.   Delete the combination of edges chosen in the above step temporarily from the graph in memory.
Step:-6.   Re-run Dijkstra for the same pair of nodes as in Step:-1.
Step:-7.   Add the resulting path into a temporary list of paths. Paths_List.
Step:-8.   Restore the deleted edges back into the graph.
Step:-9.   Go to Step:-4 to get another combination of edges for deletion until all unique combinations are exhausted. This is nothing but choosing ‘r’ edges at a time among ‘n’ edges => nCr.
Step:-10. The ‘k+1’ th shortest path is = Minimum(Paths_List).
Step:-11. k = k + 1 Go to Step:-3, until k < N.
Step:-12. STOP

据我了解的算法,要获得第k条最短路径,将在每个源-目标对之间找到“ k-1”个SPT,并且对于每个组合,将同时删除每个SPT的“
k-1”个边。显然,该算法具有组合复杂性,并且会在大型图形上阻塞服务器。人们向我建议了Eppstein的算法(http://www.ics.uci.edu/~eppstein/pubs/Epp-
SJC-98.pdf)。但是本白皮书引用了一个“有向图”,但我没有提到它仅适用于有向图。我只是想问一下这里的人们是否有人在无向图上使用了该算法?

如果不是,是否有好的算法(在时间复杂度方面)在无向图上实现KSPA?

提前致谢,


阅读 382

收藏
2020-07-28

共1个答案

小编典典

时间复杂度:O(K *(E * log(K)+ V * log(V)))

O(K * V)的存储复杂度(用于存储输入的+ O(E))。

我们执行修改后的Djikstra,如下所示:

  • 对于每个节点,与其保持从起始节点开始的路由的当前最佳已知成本,不然。我们保留从起始节点出发的最佳K条路线
  • 在更新节点的邻居时,我们不检查它是否改善了当前已知的最佳路径(就像Djikstra所做的那样),我们不检查它是否改善了K’当前已知的最差路径。
  • 在我们已经处理完一个节点的K条最佳路由之后,我们不需要找到K条最佳路由,而只剩下K-1条,之后又有K-2条。那就是我所说的K’。
  • 对于每个节点,我们将为K’当前最好的已知路径长度保留两个优先级队列。
    • 在一个优先级队列中,最短路径在最上面。我们使用此优先级队列来确定哪个K’最好,并将在常规Djikstra的优先级队列中用作节点的代表。
    • 在另一个优先级队列中,最长的路径在最上面。我们用这个比较候选路径和最差的K’路径。
2020-07-28