diff -r f2994a2b10b2 -r a82713ed19f3 src/work/marci/iterator_bfs_demo.cc --- a/src/work/marci/iterator_bfs_demo.cc Tue Aug 31 13:40:07 2004 +0000 +++ b/src/work/marci/iterator_bfs_demo.cc Tue Aug 31 17:54:22 2004 +0000 @@ -9,6 +9,7 @@ #include using namespace hugo; + using std::cout; using std::endl; using std::string; @@ -72,21 +73,6 @@ cout << " \\ \\-> v2 <--/ \\-- v4 -/ "<< endl; cout << " \\--> -------------> "<< endl; -// typedef TrivGraphWrapper CGW; -// CGW gw(G); - -// cout << "bfs and dfs demo on the directed graph" << endl; -// for(CGW::NodeIt n=gw.first(); n.valid(); ++n) { -// cout << n << ": "; -// cout << "out edges: "; -// for(CGW::OutEdgeIt e=gw.first(n); e.valid(); ++e) -// cout << e << " "; -// cout << "in edges: "; -// for(CGW::InEdgeIt e=gw.first(n); e.valid(); ++e) -// cout << e << " "; -// cout << endl; -// } - { EdgeNameMap< Graph, Graph::NodeMap > edge_name(G, node_name); @@ -107,7 +93,7 @@ bfs.pushAndSetReached(s); while (!bfs.finished()) { //cout << "edge: "; - if (Graph::Edge(Graph::OutEdgeIt(bfs))!=INVALID) { + if (Graph::Edge(bfs)!=INVALID) { cout << edge_name[bfs] << /*endl*/", " << node_name[G.tail(bfs)] << (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << @@ -116,7 +102,7 @@ ": is not newly reached."); } else { cout << "invalid" << /*endl*/", " << - node_name[bfs.aNode()] << + node_name[bfs.tail()] << (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << "invalid."; @@ -141,7 +127,7 @@ while (!dfs.finished()) { ++dfs; //cout << "edge: "; - if (Graph::Edge(Graph::OutEdgeIt(dfs))!=INVALID) { + if (Graph::Edge(dfs)!=INVALID) { cout << edge_name[dfs] << /*endl*/", " << node_name[G.tail(dfs)] << (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << @@ -150,7 +136,7 @@ ": is not newly reached."); } else { cout << "invalid" << /*endl*/", " << - node_name[dfs.aNode()] << + node_name[dfs.tail()] << (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << "invalid."; @@ -183,8 +169,8 @@ bfs.pushAndSetReached(t); while (!bfs.finished()) { //cout << "edge: "; - if (GW::Edge(GW::OutEdgeIt(bfs))!=INVALID) { - cout << edge_name[GW::OutEdgeIt(bfs)] << /*endl*/", " << + if (GW::Edge(bfs)!=INVALID) { + cout << edge_name[GW::Edge(bfs)] << /*endl*/", " << node_name[gw.tail(bfs)] << (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << node_name[gw.head(bfs)] << @@ -192,7 +178,7 @@ ": is not newly reached."); } else { cout << "invalid" << /*endl*/", " << - node_name[bfs.aNode()] << + node_name[bfs.tail()] << (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << "invalid."; @@ -217,8 +203,8 @@ while (!dfs.finished()) { ++dfs; //cout << "edge: "; - if (GW::OutEdgeIt(dfs)!=INVALID) { - cout << edge_name[GW::OutEdgeIt(dfs)] << /*endl*/", " << + if (GW::Edge(dfs)!=INVALID) { + cout << edge_name[GW::Edge(dfs)] << /*endl*/", " << node_name[gw.tail(dfs)] << (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << node_name[gw.head(dfs)] << @@ -226,7 +212,7 @@ ": is not newly reached."); } else { cout << "invalid" << /*endl*/", " << - node_name[dfs.aNode()] << + node_name[dfs.tail()] << (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << "invalid."; @@ -346,8 +332,8 @@ bfs.pushAndSetReached(t); while (!bfs.finished()) { //cout << "edge: "; - if (GW::OutEdgeIt(bfs)!=INVALID) { - cout << edge_name[GW::OutEdgeIt(bfs)] << /*endl*/", " << + if (GW::Edge(bfs)!=INVALID) { + cout << edge_name[GW::Edge(bfs)] << /*endl*/", " << node_name[gw.tail(bfs)] << (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << node_name[gw.head(bfs)] << @@ -355,7 +341,7 @@ ": is not newly reached."); } else { cout << "invalid" << /*endl*/", " << - node_name[bfs.aNode()] << + node_name[bfs.tail()] << (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << "invalid."; @@ -380,8 +366,8 @@ while (!dfs.finished()) { ++dfs; //cout << "edge: "; - if (GW::OutEdgeIt(dfs)!=INVALID) { - cout << edge_name[GW::OutEdgeIt(dfs)] << /*endl*/", " << + if (GW::Edge(dfs)!=INVALID) { + cout << edge_name[GW::Edge(dfs)] << /*endl*/", " << node_name[gw.tail(dfs)] << (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << node_name[gw.head(dfs)] << @@ -389,7 +375,7 @@ ": is not newly reached."); } else { cout << "invalid" << /*endl*/", " << - node_name[dfs.aNode()] << + node_name[dfs.tail()] << (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << "invalid.";