Finding a Path (cont)
Depth-first …
- favour following path rather than neighbours
- can be implemented recursively or iteratively (via stack)
- full traversal produces a depth-first spanning tree
Breadth-first …
- favour neighbours rather than path following
- can be implemented iteratively (via queue)
- full traversal produces a breadth-first spanning tree
|