next up previous
Next: Up: Previous:

Shortest Paths in DAGs



DAG-SS(G, w, s)
$\;\;\;\;\;$Topologically sort V $\;\;\;\;\;$ $\;\;\;\;\;$; $\Theta(V+E)$
$\;\;\;\;\;$Init-SS(G, s) $\;\;\;\;\;$ $\;\;\;\;\;$ $\;\;\;\;\;$ $\;\;\;\;\;$; $\Theta(V)$
$\;\;\;\;\;$foreach u in V in order $\;\;\;\;\;$; $\Theta(E)$
$\;\;\;\;\;$ $\;\;\;\;\;$foreach v in Adj(u)
$\;\;\;\;\;$ $\;\;\;\;\;$ $\;\;\;\;\;$Relax(u, v, w)



Running Time: $\Theta(V+E)$



Application: PERT chart


next up previous
Next: Up: Previous: