算法像贝尔曼 - 福特,只为多重启动,单一目的地是哪里?贝尔、福特、只为、算法

由网友(孤独的人容易醉)分享简介:像Bellman-Ford算法​​和Dijkstra算法的算法存在上找到的图中每个顶点由单一的起始顶点的最短路径。然而,在我写的程序,开始顶点往往比目标顶点确实改变了很多。有什么算法,做相反的工作 - 也就是说,给定一个目标的顶点,找到最短路径从每一个的启动的顶点Algorithms like the Bellman...

像Bellman-Ford算法​​和Dijkstra算法的算法存在上找到的图中每个顶点由单一的起始顶点的最短路径。然而,在我写的程序,开始顶点往往比目标顶点确实改变了很多。有什么算法,做相反的工作 - 也就是说,给定一个目标的顶点,找到最短路径从每一个的启动的顶点

Algorithms like the Bellman-Ford algorithm and Dijkstra's algorithm exist to find the shortest path from a single starting vertex on a graph to every other vertex. However, in the program I'm writing, the starting vertex changes a lot more often than the destination vertex does. What algorithm is there that does the reverse--that is, given a single destination vertex, to find the shortest path from every starting vertex?

推荐答案

刚刚扭转所有的边缘,并处理目的地开始节点。问题解决了。

Just reverse all the edges, and treated destination as start node. Problem solved.

阅读全文

相关推荐

最新文章