Professional Documents
Culture Documents
15
As usual, if G is directed,
Example all theand
edgesAnalysis
of the path should be traversed in
the forward direction.
In16our
The running example
phrase “unit (Figurein8.6),
edge lengths” the firststatement
the problem iterationrefers
of theto while
the as-
sumption that each
loop discovers theedge of G acontributes
vertices 1 to thes length
and b. Because of atheir
triggered path.discovery
Chapter 9
generalizes BFS to compute shortest paths in graphs in which each edge has its
and l(s) = 0, the algorithm reassigns l(a) and l(b) from +1 to 1:
own nonnegative length.
the frontier
l(a)=1 l(e)=+∞
a e
l(s)=0
already removed