Next: DIJKSTRA's ALGORITHM
Up: One-to-all Shortest Paths
Previous: One-to-all Shortest Paths
- For each
,
d(s) = 0 - for
to |V|-1
- for each edge
- if d[v]>d[u]+w(u,v)
- then
- for each edge
- if d[v]>d[u]+w(u,v)
- then no solution
Lemma:
always.
First part of Lemma 25.5, section 25.1
- Initially true.
- Let v be first vertex for which
, and let u be
vertex that cause d[v] to change: d[v]=d[u]+w(u,v)
- Then
(Triangle inequality)
(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