Iterator for DFS traversal. More...
#include <graph.hpp>
Iterator for DFS traversal.
Definition at line 201 of file graph.hpp.
GraphDfsIter | ( | const Graph< T > | s | ) | [inline] |
gNode<T>* currentItem | ( | ) | [inline] |
Definition at line 300 of file graph.hpp.
Referenced by voronoi2dimpl< C, V >::run(), and voronoi2d< C, V >::run().
void first | ( | ) | [inline] |
Definition at line 214 of file graph.hpp.
References gNode< T >::status().
Referenced by voronoi2dimpl< C, V >::run(), and voronoi2d< C, V >::run().
bool isDone | ( | ) | [inline] |
Definition at line 295 of file graph.hpp.
Referenced by voronoi2dimpl< C, V >::run(), and voronoi2d< C, V >::run().
bool isLast | ( | ) | [inline] |
Definition at line 228 of file graph.hpp.
00229 { 00230 if ( !q.empty() ) 00231 return false; 00232 00233 while( next_start!=NULL) 00234 { 00235 if ( next_start->status()==-1) 00236 { 00237 next_start->status(0); 00238 q.push(next_start); 00239 next_start=next_start->vlist; 00240 break; 00241 } 00242 next_start=next_start->vlist; 00243 } 00244 00245 if (q.empty() && next_start==NULL) 00246 return true; 00247 else 00248 return false; 00249 }
void next | ( | ) | [inline] |
Definition at line 251 of file graph.hpp.
Referenced by voronoi2dimpl< C, V >::run(), and voronoi2d< C, V >::run().
00252 { 00253 00254 if ( q.empty() ) 00255 { 00256 00257 while( next_start!=NULL) 00258 { 00259 if ( next_start->status()==-1) 00260 { 00261 next_start->status(0); 00262 q.push(next_start); 00263 next_start=next_start->vlist; 00264 break; 00265 } 00266 next_start=next_start->vlist; 00267 } 00268 00269 if (q.empty() && next_start==NULL)// Finished 00270 { 00271 current= NULL; //isDone 00272 return; 00273 } 00274 00275 } 00276 00277 // q not empty 00278 current= q.top(); 00279 q.pop(); 00280 00281 gNode<T>* t=current; 00282 while(t->next!=NULL) 00283 { 00284 if ( t->next->status() == -1 ) 00285 { 00286 t->next->status(0); // mark as visited 00287 q.push(t->next->start); 00288 } 00289 t=t->next; 00290 } 00291 00292 return; 00293 }