Changeset 777:a82713ed19f3 in lemon-0.x for src/work/marci/iterator_bfs_demo.cc
- Timestamp:
- 08/31/04 19:54:22 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1070
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/iterator_bfs_demo.cc
r774 r777 10 10 11 11 using namespace hugo; 12 12 13 using std::cout; 13 14 using std::endl; … … 73 74 cout << " \\--> -------------> "<< endl; 74 75 75 // typedef TrivGraphWrapper<const Graph> CGW;76 // CGW gw(G);77 78 // cout << "bfs and dfs demo on the directed graph" << endl;79 // for(CGW::NodeIt n=gw.first<CGW::NodeIt>(); n.valid(); ++n) {80 // cout << n << ": ";81 // cout << "out edges: ";82 // for(CGW::OutEdgeIt e=gw.first<CGW::OutEdgeIt>(n); e.valid(); ++e)83 // cout << e << " ";84 // cout << "in edges: ";85 // for(CGW::InEdgeIt e=gw.first<CGW::InEdgeIt>(n); e.valid(); ++e)86 // cout << e << " ";87 // cout << endl;88 // }89 90 76 { 91 77 EdgeNameMap< Graph, Graph::NodeMap<string> > edge_name(G, node_name); … … 108 94 while (!bfs.finished()) { 109 95 //cout << "edge: "; 110 if (Graph::Edge( Graph::OutEdgeIt(bfs))!=INVALID) {96 if (Graph::Edge(bfs)!=INVALID) { 111 97 cout << edge_name[bfs] << /*endl*/", " << 112 98 node_name[G.tail(bfs)] << … … 117 103 } else { 118 104 cout << "invalid" << /*endl*/", " << 119 node_name[bfs. aNode()] <<105 node_name[bfs.tail()] << 120 106 (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 121 107 … … 142 128 ++dfs; 143 129 //cout << "edge: "; 144 if (Graph::Edge( Graph::OutEdgeIt(dfs))!=INVALID) {130 if (Graph::Edge(dfs)!=INVALID) { 145 131 cout << edge_name[dfs] << /*endl*/", " << 146 132 node_name[G.tail(dfs)] << … … 151 137 } else { 152 138 cout << "invalid" << /*endl*/", " << 153 node_name[dfs. aNode()] <<139 node_name[dfs.tail()] << 154 140 (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 155 141 … … 184 170 while (!bfs.finished()) { 185 171 //cout << "edge: "; 186 if (GW::Edge( GW::OutEdgeIt(bfs))!=INVALID) {187 cout << edge_name[GW:: OutEdgeIt(bfs)] << /*endl*/", " <<172 if (GW::Edge(bfs)!=INVALID) { 173 cout << edge_name[GW::Edge(bfs)] << /*endl*/", " << 188 174 node_name[gw.tail(bfs)] << 189 175 (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << … … 193 179 } else { 194 180 cout << "invalid" << /*endl*/", " << 195 node_name[bfs. aNode()] <<181 node_name[bfs.tail()] << 196 182 (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 197 183 … … 218 204 ++dfs; 219 205 //cout << "edge: "; 220 if (GW:: OutEdgeIt(dfs)!=INVALID) {221 cout << edge_name[GW:: OutEdgeIt(dfs)] << /*endl*/", " <<206 if (GW::Edge(dfs)!=INVALID) { 207 cout << edge_name[GW::Edge(dfs)] << /*endl*/", " << 222 208 node_name[gw.tail(dfs)] << 223 209 (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << … … 227 213 } else { 228 214 cout << "invalid" << /*endl*/", " << 229 node_name[dfs. aNode()] <<215 node_name[dfs.tail()] << 230 216 (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 231 217 … … 347 333 while (!bfs.finished()) { 348 334 //cout << "edge: "; 349 if (GW:: OutEdgeIt(bfs)!=INVALID) {350 cout << edge_name[GW:: OutEdgeIt(bfs)] << /*endl*/", " <<335 if (GW::Edge(bfs)!=INVALID) { 336 cout << edge_name[GW::Edge(bfs)] << /*endl*/", " << 351 337 node_name[gw.tail(bfs)] << 352 338 (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << … … 356 342 } else { 357 343 cout << "invalid" << /*endl*/", " << 358 node_name[bfs. aNode()] <<344 node_name[bfs.tail()] << 359 345 (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 360 346 … … 381 367 ++dfs; 382 368 //cout << "edge: "; 383 if (GW:: OutEdgeIt(dfs)!=INVALID) {384 cout << edge_name[GW:: OutEdgeIt(dfs)] << /*endl*/", " <<369 if (GW::Edge(dfs)!=INVALID) { 370 cout << edge_name[GW::Edge(dfs)] << /*endl*/", " << 385 371 node_name[gw.tail(dfs)] << 386 372 (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << … … 390 376 } else { 391 377 cout << "invalid" << /*endl*/", " << 392 node_name[dfs. aNode()] <<378 node_name[dfs.tail()] << 393 379 (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 394 380
Note: See TracChangeset
for help on using the changeset viewer.