next up previous
Next: DIJKSTRA's ALGORITHM Up: One-to-all Shortest Paths Previous: One-to-all Shortest Paths

Bellman-Ford Algorithm

  1. For each tex2html_wrap_inline316 , tex2html_wrap_inline640
    d(s) = 0
  2. for tex2html_wrap_inline644 to |V|-1
    for each edge tex2html_wrap_inline646
    if d[v]>d[u]+w(u,v)
    then tex2html_wrap_inline652
  3. for each edge tex2html_wrap_inline646
    if d[v]>d[u]+w(u,v)
    then no solution

Lemma: tex2html_wrap_inline658 always.
First part of Lemma 25.5, section 25.1

Initially true.
Let v be first vertex for which tex2html_wrap_inline662 , and let u be vertex that cause d[v] to change: d[v]=d[u]+w(u,v)
Then
tex2html_wrap_inline662
tex2html_wrap_inline672 (Triangle inequality)
tex2html_wrap_inline672 (v is first violation)

contradicts d[v]=d[u]+w(u,v) (above).

Lemma: Bellman-Ford Algorithm is correct.



Sushil Prasad
Thu Nov 4 14:09:59 EST 1999