1.1 --- a/src/work/marci/bipartite_graph_wrapper_test.cc Thu Apr 22 20:36:21 2004 +0000
1.2 +++ b/src/work/marci/bipartite_graph_wrapper_test.cc Fri Apr 23 07:41:48 2004 +0000
1.3 @@ -10,6 +10,8 @@
1.4 #include <for_each_macros.h>
1.5 #include <bfs_iterator.h>
1.6 #include <graph_wrapper.h>
1.7 +#include <maps.h>
1.8 +#include <edmonds_karp.h>
1.9
1.10 using namespace hugo;
1.11
1.12 @@ -41,44 +43,35 @@
1.13 FOR_EACH_LOC(BGW::EdgeIt, e, bgw) {
1.14 std::cout << bgw.tail(e) << "->" << bgw.head(e) << std::endl;
1.15 }
1.16 -// Graph::NodeMap<OutEdgeIt> pred(G);
1.17 -// Timer ts;
1.18 -// {
1.19 -// ts.reset();
1.20 -// Graph::NodeMap<bool> reached(G);
1.21 -// reached.set(s, true);
1.22 -// pred.set(s, INVALID);
1.23 -// std::queue<Node> bfs_queue;
1.24 -// bfs_queue.push(t);
1.25 -// while (!bfs_queue.empty()) {
1.26 -// Node v=bfs_queue.front();
1.27 -// bfs_queue.pop();
1.28 -// OutEdgeIt e;
1.29 -// for(G.first(e,v); G.valid(e); G.next(e)) {
1.30 -// Node w=G.head(e);
1.31 -// if (!reached[w]) {
1.32 -// bfs_queue.push(w);
1.33 -// reached.set(w, true);
1.34 -// pred.set(w, e);
1.35 -// }
1.36 -// }
1.37 -// }
1.38
1.39 -// std::cout << ts << std::endl;
1.40 -// }
1.41 + BGW::NodeMap<int> dbyj(bgw);
1.42 + BGW::EdgeMap<int> dbyxcj(bgw);
1.43
1.44 -// {
1.45 -// ts.reset();
1.46 -// BfsIterator< Graph, Graph::NodeMap<bool> > bfs(G);
1.47 -// bfs.pushAndSetReached(s);
1.48 -// pred.set(s, INVALID);
1.49 -// while (!bfs.finished()) {
1.50 -// ++bfs;
1.51 -// if (G.valid(bfs) && bfs.isBNodeNewlyReached())
1.52 -// pred.set(bfs.bNode(), bfs);
1.53 -// }
1.54 -// std::cout << ts << std::endl;
1.55 -// }
1.56 + typedef stGraphWrapper<BGW> stGW;
1.57 + stGW stgw(bgw);
1.58 + ConstMap<stGW::Edge, int> const1map(1);
1.59 + stGW::NodeMap<int> ize(stgw);
1.60 + stGW::EdgeMap<int> flow(stgw);
1.61 +
1.62 + BfsIterator< BGW, BGW::NodeMap<bool> > bfs(bgw);
1.63 + Graph::NodeIt si;
1.64 + Graph::Node s;
1.65 + s=g.first(si);
1.66 + bfs.pushAndSetReached(BGW::Node(s));
1.67 + while (!bfs.finished()) ++bfs;
1.68 +
1.69 + BGW::EdgeMap<bool> cap(bgw);
1.70 + BGW::EdgeMap<bool> flow1(bgw);
1.71 +
1.72 + typedef ResGraphWrapper< BGW, int, BGW::EdgeMap<bool>, BGW::EdgeMap<bool> >
1.73 + RBGW;
1.74 + RBGW rbgw(bgw, cap, flow1);
1.75 + RBGW::NodeMap<int> u(rbgw);
1.76 +
1.77 +
1.78 + MaxFlow<stGW, int, ConstMap<stGW::Edge, int>, stGW::EdgeMap<int> >
1.79 + max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow);
1.80 + max_flow_test.augmentOnShortestPath();
1.81
1.82 return 0;
1.83 }