Changeset 577:e8703f0a6e2f in lemon-0.x for src/work/marci/bfsit_vs_byhand.cc
- Timestamp:
- 05/07/04 13:57:34 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@753
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/bfsit_vs_byhand.cc
r555 r577 20 20 typedef Graph::OutEdgeIt OutEdgeIt; 21 21 22 Graph G;22 Graph g; 23 23 Node s, t; 24 Graph::EdgeMap<int> cap(G); 25 readDimacsMaxFlow(std::cin, G, s, t, cap); 26 Graph::NodeMap<OutEdgeIt> pred(G); 24 Graph::EdgeMap<int> cap(g); 25 //readDimacsMaxFlow(std::cin, g, s, t, cap); 26 readDimacs(std::cin, g); 27 28 Graph::NodeMap<OutEdgeIt> pred(g); 27 29 Timer ts; 28 30 { 29 31 ts.reset(); 30 Graph::NodeMap<bool> reached( G);32 Graph::NodeMap<bool> reached(g); 31 33 reached.set(s, true); 32 34 pred.set(s, INVALID); … … 37 39 bfs_queue.pop(); 38 40 OutEdgeIt e; 39 for( G.first(e,v); G.valid(e); G.next(e)) {40 Node w= G.head(e);41 for(g.first(e,v); g.valid(e); g.next(e)) { 42 Node w=g.head(e); 41 43 if (!reached[w]) { 42 44 bfs_queue.push(w); … … 52 54 { 53 55 ts.reset(); 54 BfsIterator< Graph, Graph::NodeMap<bool> > bfs( G);56 BfsIterator< Graph, Graph::NodeMap<bool> > bfs(g); 55 57 bfs.pushAndSetReached(s); 56 58 pred.set(s, INVALID); 57 59 while (!bfs.finished()) { 58 60 ++bfs; 59 if ( G.valid(bfs) && bfs.isBNodeNewlyReached())61 if (g.valid(bfs) && bfs.isBNodeNewlyReached()) 60 62 pred.set(bfs.bNode(), bfs); 61 63 }
Note: See TracChangeset
for help on using the changeset viewer.