Changeset 500:1a45623b4796 in lemon-0.x for src
- Timestamp:
- 04/30/04 19:48:50 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@660
- Location:
- src/work/marci
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/bipartite_graph_wrapper.h
r499 r500 47 47 48 48 BipartiteGraphWrapper(Graph& _graph, SFalseTTrueMap& _s_false_t_true_map) 49 : GraphWrapper<Graph>(_graph), s_false_t_true_map(&_s_false_t_true_map), 50 S_CLASS(false), T_CLASS(true) { } 49 : GraphWrapper<Graph>(_graph), 50 s_false_t_true_map(&_s_false_t_true_map), 51 S_CLASS(false), T_CLASS(true) { } 51 52 typedef typename GraphWrapper<Graph>::Node Node; 52 53 //using GraphWrapper<Graph>::NodeIt; … … 198 199 typedef typename Parent::Edge Edge; 199 200 BipartiteGraph() : BipartiteGraphWrapper<Graph>(), 200 gr(), bipartite_map(gr ),201 gr(), bipartite_map(gr, -1), 201 202 s_false_t_true_map(bipartite_map) { 202 203 Parent::setGraph(gr); -
src/work/marci/bipartite_matching_try_2.cc
r499 r500 64 64 std::cin >> m; 65 65 66 66 std::cout << "Generatig a random bipartite graph..." << std::endl; 67 67 for (int i=0; i<a; ++i) s_nodes.push_back(g.addNode(false)); 68 68 for (int i=0; i<b; ++i) t_nodes.push_back(g.addNode(true)); … … 77 77 std::cout << std::endl; 78 78 79 std::cout << "Nodes in T:" << std::endl; 80 FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.T_CLASS) std::cout << v << " "; 81 std::cout << std::endl; 82 std::cout << "Nodes in S:" << std::endl; 83 FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.S_CLASS) std::cout << v << " "; 84 std::cout << std::endl; 85 86 std::cout << "Erasing the first node..." << std::endl; 87 NodeIt n; 88 g.first(n); 89 g.erase(n); 90 std::cout << "Nodes of the bipartite graph:" << std::endl; 91 FOR_EACH_GLOB(n, g) std::cout << n << " "; 92 std::cout << std::endl; 93 94 std::cout << "Nodes in T:" << std::endl; 95 FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.T_CLASS) std::cout << v << " "; 96 std::cout << std::endl; 97 std::cout << "Nodes in S:" << std::endl; 98 FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.S_CLASS) std::cout << v << " "; 99 std::cout << std::endl; 100 79 101 typedef stGraphWrapper<Graph> stGW; 80 102 stGW stgw(g); 81 103 ConstMap<stGW::Edge, int> const1map(1); 82 83 84 85 104 86 105 Timer ts; … … 89 108 MaxFlow<stGW, int, ConstMap<stGW::Edge, int>, stGW::EdgeMap<int> > 90 109 max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow); 110 max_flow_test.run(); 91 111 // while (max_flow_test.augmentOnShortestPath()) { } 92 typedef ListGraph MutableGraph;112 // typedef ListGraph MutableGraph; 93 113 // while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) { 94 while (max_flow_test.augmentOnBlockingFlow2()) {95 std::cout << max_flow_test.flowValue() << std::endl;96 }114 // while (max_flow_test.augmentOnBlockingFlow2()) { 115 // std::cout << max_flow_test.flowValue() << std::endl; 116 // } 97 117 std::cout << "max flow value: " << max_flow_test.flowValue() << std::endl; 98 118 std::cout << "elapsed time: " << ts << std::endl; … … 102 122 std::cout << std::endl; 103 123 104 ts.reset();105 stGW::EdgeMap<int> pre_flow(stgw);106 MaxFlow<stGW, int, ConstMap<stGW::Edge, int>, stGW::EdgeMap<int> >107 pre_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, pre_flow/*, true*/);108 pre_flow_test.run();109 std::cout << "pre flow value: " << max_flow_test.flowValue() << std::endl;110 std::cout << "elapsed time: " << ts << std::endl;111 // FOR_EACH_LOC(stGW::EdgeIt, e, stgw) {112 // std::cout << e << ": " << pre_flow[e] << "\n";113 // }114 // std::cout << "\n";115 116 124 return 0; 117 125 }
Note: See TracChangeset
for help on using the changeset viewer.