算法像贝尔曼 - 福特,只为多重启动,单一目的地是哪里? [英] Algorithm like Bellman-Ford, only for multiple start, single destination?

查看:205
本文介绍了算法像贝尔曼 - 福特,只为多重启动,单一目的地是哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

像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.

这篇关于算法像贝尔曼 - 福特,只为多重启动,单一目的地是哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆