matlab 穆尔,贝尔曼 - 福特 - 穆尔最短路径算法

The Bellman-Ford-Moore Shortest Path Algorithm

Over the years I have looked at many Shortest Path FEX submissions. Most,if not all of these, were implementations of Dijkstra's algorithm for dense adjacency matrices.

These submissions had very limited usefulness because most real graph problems are sparse and most can be solved much more efficiently by a variant of the Bellman-Ford-Moore (BFM) algorithm which predates Dijkstra by 4 or 5 years. Better still, BFM is robust in the sense that it can handle negative arc-weights and detect and find negative cycles. Dijkstra cannot do this and for this reason is not considered robust.

It was for these reasons and others that I decided to (try) to write the simplest possible Matlab function for shortest paths. This forced me to use the simplest possible data structures to represent the problem and its solution, in Matlab: the graph G is represented by a list of m arcs (head, tail, weight) or (u,v,duv); the solution is represented by a tree p which is an n-vector of parent "pointers"; the n-vector D is the shortest path distances. Thus the path from node u to the root r is u,p(u),p(p(u)), ... , p(r). The length of this shortest path is D(u). We can see that the space used is S = No. of arcs = m (nnz) + 2*n fixed-sized boxes. You can't get lower than that.

The latest version of the notes on this algorithm is available at:

http://www.scribd.com/derekroconnor4276

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值