Repeated depth-first search

From Algowiki
Revision as of 15:33, 8 October 2014 by Weihe (talk | contribs) (Created page with "== General information == '''Algorithmic problem:''' Exhaustive graph traversal '''Type of algorithm:''' loop '''Additional output:''' cf. DFS '''Specific characte...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

General information

Algorithmic problem: Exhaustive graph traversal

Type of algorithm: loop

Additional output: cf. DFS

Specific characteristic: cf. DFS

Abstract View

While there are nodes not yet seen:

  1. Select a start node [math]\displaystyle{ s }[/math] from the unseen nodes.
  2. Apply aDFS starting at [math]\displaystyle{ S. }[/math]


Correctness

Obviously, all nodes are finished eventually. For two nodes [math]\displaystyle{ v,w\in V }[/math] that are finished in the same DFS, the specific characteristic follows from the fact that DFS fulfills it. So assume [math]\displaystyle{ v }[/math] is seen in an earlier DFS than [math]\displaystyle{ w }[/math]. Since [math]\displaystyle{ v }[/math] is also earlier finished than [math]\displaystyle{ w }[/math], the specific characteristic is fulfilled for [math]\displaystyle{ v }[/math] and [math]\displaystyle{ w }[/math] unless there is a path from [math]\displaystyle{ v }[/math] to [math]\displaystyle{ w }[/math]. However, if such a path existed, [math]\displaystyle{ w }[/math] had been seen in the same DFS as [math]\displaystyle{ v }[/math].