Tiefensuche (iterativ)

dfs (x) {
  push (NULL, x); 
     // evtl. Vorgänger und Knoten
  while ( stack nicht leer ) {
    (x', x) := pop (); 
    if (not besucht [x]) {
      besucht[x] = true; b[x] = ++counter;
      // (x', x) heißt Baumkante
      for ( y in Nachbarn von x ) {
        push (xy); 
} } } }



Johannes Waldmann 2005-01-25