The Bellman-Ford-Moore Shortest Path Algorithm

버전 1.11.0.0 (224 KB) 작성자: Derek O'Connor
A simple, efficient sparse implementation of the original Bellman-Ford-Moore Shortest Path Algorithm
다운로드 수: 3K
업데이트 날짜: 2012/9/18

라이선스 보기

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

인용 양식

Derek O'Connor (2024). The Bellman-Ford-Moore Shortest Path Algorithm (https://www.mathworks.com/matlabcentral/fileexchange/38129-the-bellman-ford-moore-shortest-path-algorithm), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2008a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Construction에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.11.0.0

Added a Scribd link for the notes on this algorithm.

1.10.0.0

Updated notes and results of tests.

1.9.0.0

Added an 11-page paper of notes and two test functions: one for random networks and one for real road networks

1.8.0.0

Minor code modification

1.7.0.0

Eliminated comments

1.4.0.0

Added a minor note.

1.3.0.0

Eliminated irrelevant comments

1.2.0.0

Corrected minor typos

1.0.0.0