1.1 --- a/src/work/marci/bipartite_graph_wrapper.h Fri Apr 30 17:10:01 2004 +0000
1.2 +++ b/src/work/marci/bipartite_graph_wrapper.h Fri Apr 30 17:48:50 2004 +0000
1.3 @@ -46,8 +46,9 @@
1.4 bool T_CLASS;
1.5
1.6 BipartiteGraphWrapper(Graph& _graph, SFalseTTrueMap& _s_false_t_true_map)
1.7 - : GraphWrapper<Graph>(_graph), s_false_t_true_map(&_s_false_t_true_map),
1.8 - S_CLASS(false), T_CLASS(true) { }
1.9 + : GraphWrapper<Graph>(_graph),
1.10 + s_false_t_true_map(&_s_false_t_true_map),
1.11 + S_CLASS(false), T_CLASS(true) { }
1.12 typedef typename GraphWrapper<Graph>::Node Node;
1.13 //using GraphWrapper<Graph>::NodeIt;
1.14 typedef typename GraphWrapper<Graph>::Edge Edge;
1.15 @@ -197,7 +198,7 @@
1.16 typedef typename Parent::Node Node;
1.17 typedef typename Parent::Edge Edge;
1.18 BipartiteGraph() : BipartiteGraphWrapper<Graph>(),
1.19 - gr(), bipartite_map(gr),
1.20 + gr(), bipartite_map(gr, -1),
1.21 s_false_t_true_map(bipartite_map) {
1.22 Parent::setGraph(gr);
1.23 Parent::setSFalseTTrueMap(s_false_t_true_map);
2.1 --- a/src/work/marci/bipartite_matching_try_2.cc Fri Apr 30 17:10:01 2004 +0000
2.2 +++ b/src/work/marci/bipartite_matching_try_2.cc Fri Apr 30 17:48:50 2004 +0000
2.3 @@ -63,7 +63,7 @@
2.4 std::cout << "number of edges=";
2.5 std::cin >> m;
2.6
2.7 -
2.8 + std::cout << "Generatig a random bipartite graph..." << std::endl;
2.9 for (int i=0; i<a; ++i) s_nodes.push_back(g.addNode(false));
2.10 for (int i=0; i<b; ++i) t_nodes.push_back(g.addNode(true));
2.11
2.12 @@ -76,24 +76,44 @@
2.13 FOR_EACH_LOC(EdgeIt, e, g) std::cout << e << " ";
2.14 std::cout << std::endl;
2.15
2.16 + std::cout << "Nodes in T:" << std::endl;
2.17 + FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.T_CLASS) std::cout << v << " ";
2.18 + std::cout << std::endl;
2.19 + std::cout << "Nodes in S:" << std::endl;
2.20 + FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.S_CLASS) std::cout << v << " ";
2.21 + std::cout << std::endl;
2.22 +
2.23 + std::cout << "Erasing the first node..." << std::endl;
2.24 + NodeIt n;
2.25 + g.first(n);
2.26 + g.erase(n);
2.27 + std::cout << "Nodes of the bipartite graph:" << std::endl;
2.28 + FOR_EACH_GLOB(n, g) std::cout << n << " ";
2.29 + std::cout << std::endl;
2.30 +
2.31 + std::cout << "Nodes in T:" << std::endl;
2.32 + FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.T_CLASS) std::cout << v << " ";
2.33 + std::cout << std::endl;
2.34 + std::cout << "Nodes in S:" << std::endl;
2.35 + FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.S_CLASS) std::cout << v << " ";
2.36 + std::cout << std::endl;
2.37 +
2.38 typedef stGraphWrapper<Graph> stGW;
2.39 stGW stgw(g);
2.40 ConstMap<stGW::Edge, int> const1map(1);
2.41
2.42 -
2.43 -
2.44 -
2.45 Timer ts;
2.46 ts.reset();
2.47 stGW::EdgeMap<int> flow(stgw);
2.48 MaxFlow<stGW, int, ConstMap<stGW::Edge, int>, stGW::EdgeMap<int> >
2.49 max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow);
2.50 + max_flow_test.run();
2.51 // while (max_flow_test.augmentOnShortestPath()) { }
2.52 - typedef ListGraph MutableGraph;
2.53 +// typedef ListGraph MutableGraph;
2.54 // while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) {
2.55 - while (max_flow_test.augmentOnBlockingFlow2()) {
2.56 - std::cout << max_flow_test.flowValue() << std::endl;
2.57 - }
2.58 +// while (max_flow_test.augmentOnBlockingFlow2()) {
2.59 +// std::cout << max_flow_test.flowValue() << std::endl;
2.60 +// }
2.61 std::cout << "max flow value: " << max_flow_test.flowValue() << std::endl;
2.62 std::cout << "elapsed time: " << ts << std::endl;
2.63 FOR_EACH_LOC(stGW::EdgeIt, e, stgw) {
2.64 @@ -101,17 +121,5 @@
2.65 }
2.66 std::cout << std::endl;
2.67
2.68 - ts.reset();
2.69 - stGW::EdgeMap<int> pre_flow(stgw);
2.70 - MaxFlow<stGW, int, ConstMap<stGW::Edge, int>, stGW::EdgeMap<int> >
2.71 - pre_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, pre_flow/*, true*/);
2.72 - pre_flow_test.run();
2.73 - std::cout << "pre flow value: " << max_flow_test.flowValue() << std::endl;
2.74 - std::cout << "elapsed time: " << ts << std::endl;
2.75 -// FOR_EACH_LOC(stGW::EdgeIt, e, stgw) {
2.76 -// std::cout << e << ": " << pre_flow[e] << "\n";
2.77 -// }
2.78 -// std::cout << "\n";
2.79 -
2.80 return 0;
2.81 }