本文介绍了算法像贝尔曼 - 福特,只为多重启动,单一目的地是哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
像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.
更多推荐
算法像贝尔曼
发布评论