src/lemon/dfs.h
changeset 1146 ebab0e5ec8b2
parent 946 c94ef40a22ce
child 1164 80bb73097736
equal deleted inserted replaced
1:2b152ac6ad52 2:400f05f25cd5
   204       Node n=s;
   204       Node n=s;
   205       Node m;
   205       Node m;
   206       OutEdgeIt e;
   206       OutEdgeIt e;
   207       do {
   207       do {
   208 	if((e=Q[Qh])!=INVALID)
   208 	if((e=Q[Qh])!=INVALID)
   209 	  if((m=G->head(e))!=s && (*predecessor)[m=G->head(e)]==INVALID) {
   209 	  if((m=G->target(e))!=s && (*predecessor)[m=G->target(e)]==INVALID) {
   210 	    predecessor->set(m,e);
   210 	    predecessor->set(m,e);
   211 	    pred_node->set(m,n);
   211 	    pred_node->set(m,n);
   212 	    Q[++Qh] = OutEdgeIt(*G, m);
   212 	    Q[++Qh] = OutEdgeIt(*G, m);
   213 	    distance->set(m,Qh);
   213 	    distance->set(m,Qh);
   214 	    n=m;
   214 	    n=m;
   215 	  }
   215 	  }
   216 	  else ++Q[Qh];
   216 	  else ++Q[Qh];
   217 	else if(--Qh>=0) n=G->tail(Q[Qh]);
   217 	else if(--Qh>=0) n=G->source(Q[Qh]);
   218       } while(Qh>=0);
   218       } while(Qh>=0);
   219     }
   219     }
   220     
   220     
   221     ///The distance of a node from the root on the %DFS tree.
   221     ///The distance of a node from the root on the %DFS tree.
   222 
   222