Bellman Ford Algorithm

Edward F. Moore also published the same algorithm in 1957, and for this reason it is also sometimes named the Bellman – Ford – Moore algorithm. The Bellman – Ford algorithm is an algorithm that calculates shortest paths from a individual source vertex to all of the other vertices in a weighted digraph.

Bellman Ford source code, pseudocode and analysis

However, Dijkstra's algorithm uses a priority queue to greedily choose the nearest vertex that has not yet been processed, and performs this relaxation procedure on all of its outgoing edges; by contrast, the Bellman – Ford algorithm simply relaxes all the edges, and makes this |V|-1 times where |V| are the number of vertices and edges respectively.