src/work/iterator_bfs_demo.cc
changeset 271 951cd01495e7
parent 238 ad3bdd78f4f6
child 279 be43902fadb7
equal deleted inserted replaced
7:3a32f109930a 8:932404fd7c60
    97     GW gw(G);
    97     GW gw(G);
    98 
    98 
    99     EdgeNameMap< GW, Graph::NodeMap<string> > edge_name(gw, node_name);
    99     EdgeNameMap< GW, Graph::NodeMap<string> > edge_name(gw, node_name);
   100     
   100     
   101     cout << "bfs and dfs iterator demo on the directed graph" << endl;
   101     cout << "bfs and dfs iterator demo on the directed graph" << endl;
   102     for(GW::NodeIt n=gw.first<GW::NodeIt>(); gw.valid(n); gw.next(n)) { 
   102     for(GW::NodeIt n=gw.first<GW::NodeIt>(); 
       
   103 	gw.valid(n); 
       
   104 	gw.next(n)) { 
   103       cout << node_name.get(n) << ": ";
   105       cout << node_name.get(n) << ": ";
   104       cout << "out edges: ";
   106       cout << "out edges: ";
   105       for(GW::OutEdgeIt e=gw.first<GW::OutEdgeIt>(n); gw.valid(e); gw.next(e)) 
   107       for(GW::OutEdgeIt e=gw.first<GW::OutEdgeIt>(n); gw.valid(e); gw.next(e)) 
   106 	cout << edge_name.get(e) << " ";
   108 	cout << edge_name.get(e) << " ";
   107       cout << "in edges: ";
   109       cout << "in edges: ";