Bugfix: DFS crashed if the source did not have an outgoing edge.
authoralpar
Tue, 30 Aug 2005 13:48:40 +0000
changeset 166472f1f24b73c9
parent 1663 f6741cfab647
child 1665 fdeb961110ac
Bugfix: DFS crashed if the source did not have an outgoing edge.
lemon/dfs.h
     1.1 --- a/lemon/dfs.h	Mon Aug 29 18:21:02 2005 +0000
     1.2 +++ b/lemon/dfs.h	Tue Aug 30 13:48:40 2005 +0000
     1.3 @@ -511,7 +511,9 @@
     1.4  	  _reached->set(s,true);
     1.5  	  _pred->set(s,INVALID);
     1.6  	  // _predNode->set(u,INVALID);
     1.7 -	  _stack[++_stack_head]=OutEdgeIt(*G,s);
     1.8 +	  OutEdgeIt e(*G,s);
     1.9 +	  if(e!=INVALID) _stack[++_stack_head]=e;
    1.10 +	  else _processed->set(s,true);
    1.11  	  _dist->set(s,_stack_head);
    1.12  	}
    1.13      }