1.1 --- a/src/work/marci/bfsit_vs_byhand.cc Fri May 07 10:57:31 2004 +0000
1.2 +++ b/src/work/marci/bfsit_vs_byhand.cc Fri May 07 11:57:34 2004 +0000
1.3 @@ -19,15 +19,17 @@
1.4 typedef Graph::EdgeIt EdgeIt;
1.5 typedef Graph::OutEdgeIt OutEdgeIt;
1.6
1.7 - Graph G;
1.8 + Graph g;
1.9 Node s, t;
1.10 - Graph::EdgeMap<int> cap(G);
1.11 - readDimacsMaxFlow(std::cin, G, s, t, cap);
1.12 - Graph::NodeMap<OutEdgeIt> pred(G);
1.13 + Graph::EdgeMap<int> cap(g);
1.14 + //readDimacsMaxFlow(std::cin, g, s, t, cap);
1.15 + readDimacs(std::cin, g);
1.16 +
1.17 + Graph::NodeMap<OutEdgeIt> pred(g);
1.18 Timer ts;
1.19 {
1.20 ts.reset();
1.21 - Graph::NodeMap<bool> reached(G);
1.22 + Graph::NodeMap<bool> reached(g);
1.23 reached.set(s, true);
1.24 pred.set(s, INVALID);
1.25 std::queue<Node> bfs_queue;
1.26 @@ -36,8 +38,8 @@
1.27 Node v=bfs_queue.front();
1.28 bfs_queue.pop();
1.29 OutEdgeIt e;
1.30 - for(G.first(e,v); G.valid(e); G.next(e)) {
1.31 - Node w=G.head(e);
1.32 + for(g.first(e,v); g.valid(e); g.next(e)) {
1.33 + Node w=g.head(e);
1.34 if (!reached[w]) {
1.35 bfs_queue.push(w);
1.36 reached.set(w, true);
1.37 @@ -51,12 +53,12 @@
1.38
1.39 {
1.40 ts.reset();
1.41 - BfsIterator< Graph, Graph::NodeMap<bool> > bfs(G);
1.42 + BfsIterator< Graph, Graph::NodeMap<bool> > bfs(g);
1.43 bfs.pushAndSetReached(s);
1.44 pred.set(s, INVALID);
1.45 while (!bfs.finished()) {
1.46 ++bfs;
1.47 - if (G.valid(bfs) && bfs.isBNodeNewlyReached())
1.48 + if (g.valid(bfs) && bfs.isBNodeNewlyReached())
1.49 pred.set(bfs.bNode(), bfs);
1.50 }
1.51 std::cout << ts << std::endl;