previous | start | next

Shortest Paths in Digraphs

Assumptions

A necessary and sufficient condition for shortest path from a source vertex s to all reachable vertices w in a digraph applies to the array distTo no matter how it is calculated, provided it has these properties:

 distTo[v] = length of some path from s to v, or
 distTo[v] = Infinity if there is no directed path from s to v
   


previous | start | next