Negative weights using Dijkstra's Algorithm
来源:互联网 发布:luxsens 人工智能 编辑:程序博客网 时间:2024/06/03 17:43
expand过的才不expand!!! 定了T的就一定是expand过的,不用更新它,因为它已经最短了
The algorithm you have suggested will indeed find the shortest path in this graph, but not all graphs in general. For example, consider this graph:
Assume the edges are directed from left to right as in your example,
Your algorithm will work as follows. First, you set d(A) to zero and the other distances to infinity. You then expand out node A, setting d(B) to 1, d(C) to zero, and d(D) to 99. Next, you expand out C, with no net changes. You then expand out B, which has no effect. Finally, you expand D, which changes d(B) to -201.
Notice that at the end of this, though, that d(C) is still 0, even though the shortest path to C has length -200. Your algorithm thus fails to accurately compute distances in some cases. Moreover, even if you were to store back pointers saying how to get from each node to the start node A, you'd end taking the wrong path back from C to A.
- Negative weights using Dijkstra's Algorithm
- Dijkstra算法(Dijkstra's algorithm)
- Dijkstra\'s Algorithm
- Dijkstra's Algorithm
- Dijkstra's algorithm
- Dijkstra's Algorithm
- 算法学习 - Dijkstra's Algorithm
- 算法学习 - Dijkstra's Algorithm
- Dijkstra's shortest path algorithm
- Dijkstra’s shortest path algorithm
- 迪克斯特拉算法-- Dijkstra's Algorithm
- Dijkstra's Algorithm(迪杰斯特拉算法)
- 单源最短路Dijkstra's algorithm径
- Dijkstra's Algorithm of shortest path
- Dijkstra's Shortest-Path Algorithm Implementation(TODO)
- 图算法(1):Dijkstra's algorithm
- Use python to implement Dijkstra's algorithm
- Dijkstra's Algorithm分析以及其优化
- java中从键盘输入数据
- java代码中100-1000中的水仙花数
- Oracle translate() 详解+实例
- linux网络编程之socket(一):socket概述和字节序、地址转换函数
- V4L2
- Negative weights using Dijkstra's Algorithm
- 基于多重特征的双行车牌检测(论文摘要)
- service mysql start出错,mysql启动不了,解决mysql: unrecognized service错误
- Webkit简介
- WCF常见问题
- 在Centos下用yum安装Mysql时遇到的问题
- oracle job详解
- redhat网易yum源的配置
- OpenCV的susan角点检测