diff -r c11f84e3da21 -r be43902fadb7 src/work/iterator_bfs_demo.cc --- a/src/work/iterator_bfs_demo.cc Fri Apr 02 18:31:19 2004 +0000 +++ b/src/work/iterator_bfs_demo.cc Sat Apr 03 14:22:33 2004 +0000 @@ -33,11 +33,6 @@ typedef Graph::Node Node; typedef Graph::Edge Edge; - //typedef Graph::NodeIt NodeIt; - //typedef Graph::EdgeIt EdgeIt; - //typedef Graph::OutEdgeIt OutEdgeIt; - //typedef Graph::InEdgeIt InEdgeIt; - //typedef Graph::SymEdgeIt SymEdgeIt; Graph G; @@ -99,15 +94,13 @@ EdgeNameMap< GW, Graph::NodeMap > edge_name(gw, node_name); cout << "bfs and dfs iterator demo on the directed graph" << endl; - for(GW::NodeIt n=gw.first(); - gw.valid(n); - gw.next(n)) { + for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) { cout << node_name.get(n) << ": "; cout << "out edges: "; - for(GW::OutEdgeIt e=gw.first(n); gw.valid(e); gw.next(e)) + for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e)) cout << edge_name.get(e) << " "; cout << "in edges: "; - for(GW::InEdgeIt e=gw.first(n); gw.valid(e); gw.next(e)) + for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e)) cout << edge_name.get(e) << " "; cout << endl; } @@ -177,13 +170,13 @@ EdgeNameMap< GW, Graph::NodeMap > edge_name(gw, node_name); cout << "bfs and dfs iterator demo on the reversed directed graph" << endl; - for(GW::NodeIt n=gw.first(); gw.valid(n); gw.next(n)) { + for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) { cout << node_name.get(n) << ": "; cout << "out edges: "; - for(GW::OutEdgeIt e=gw.first(n); gw.valid(e); gw.next(e)) + for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e)) cout << edge_name.get(e) << " "; cout << "in edges: "; - for(GW::InEdgeIt e=gw.first(n); gw.valid(e); gw.next(e)) + for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e)) cout << edge_name.get(e) << " "; cout << endl; } @@ -253,13 +246,13 @@ EdgeNameMap< GW, Graph::NodeMap > edge_name(gw, node_name); cout << "bfs and dfs iterator demo on the undirected graph" << endl; - for(GW::NodeIt n=gw.first(); gw.valid(n); gw.next(n)) { + for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) { cout << node_name.get(n) << ": "; cout << "out edges: "; - for(GW::OutEdgeIt e=gw.first(n); gw.valid(e); gw.next(e)) + for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e)) cout << edge_name.get(e) << " "; cout << "in edges: "; - for(GW::InEdgeIt e=gw.first(n); gw.valid(e); gw.next(e)) + for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e)) cout << edge_name.get(e) << " "; cout << endl; }