Connection to Prim's

Nearly identical to Prim's MST algorithm:


\begin{algorithm}
{Relax-Prim}{u,v,w}
 \begin{IF}
{d[v]\gt w(u,v)}
 d[v] \= w(u,v) \  \pi[v] \= u
 \end{IF}\end{algorithm}

In Dijkstra, distance to ``outside'' node is the total distance from source instead of just the minimum length edge from the current tree.


next up previous
Next: Correctness Up: DIJKSTRA'S ALGORITHM Previous: Algorithm