[Lemon-commits] [lemon_svn] marci: r660 - hugo/trunk/src/work/marci
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:40:49 CET 2006
Author: marci
Date: Fri Apr 30 19:48:50 2004
New Revision: 660
Modified:
hugo/trunk/src/work/marci/bipartite_graph_wrapper.h
hugo/trunk/src/work/marci/bipartite_matching_try_2.cc
Log:
misc
Modified: hugo/trunk/src/work/marci/bipartite_graph_wrapper.h
==============================================================================
--- hugo/trunk/src/work/marci/bipartite_graph_wrapper.h (original)
+++ hugo/trunk/src/work/marci/bipartite_graph_wrapper.h Fri Apr 30 19:48:50 2004
@@ -46,8 +46,9 @@
bool T_CLASS;
BipartiteGraphWrapper(Graph& _graph, SFalseTTrueMap& _s_false_t_true_map)
- : GraphWrapper<Graph>(_graph), s_false_t_true_map(&_s_false_t_true_map),
- S_CLASS(false), T_CLASS(true) { }
+ : GraphWrapper<Graph>(_graph),
+ s_false_t_true_map(&_s_false_t_true_map),
+ S_CLASS(false), T_CLASS(true) { }
typedef typename GraphWrapper<Graph>::Node Node;
//using GraphWrapper<Graph>::NodeIt;
typedef typename GraphWrapper<Graph>::Edge Edge;
@@ -197,7 +198,7 @@
typedef typename Parent::Node Node;
typedef typename Parent::Edge Edge;
BipartiteGraph() : BipartiteGraphWrapper<Graph>(),
- gr(), bipartite_map(gr),
+ gr(), bipartite_map(gr, -1),
s_false_t_true_map(bipartite_map) {
Parent::setGraph(gr);
Parent::setSFalseTTrueMap(s_false_t_true_map);
Modified: hugo/trunk/src/work/marci/bipartite_matching_try_2.cc
==============================================================================
--- hugo/trunk/src/work/marci/bipartite_matching_try_2.cc (original)
+++ hugo/trunk/src/work/marci/bipartite_matching_try_2.cc Fri Apr 30 19:48:50 2004
@@ -63,7 +63,7 @@
std::cout << "number of edges=";
std::cin >> m;
-
+ std::cout << "Generatig a random bipartite graph..." << std::endl;
for (int i=0; i<a; ++i) s_nodes.push_back(g.addNode(false));
for (int i=0; i<b; ++i) t_nodes.push_back(g.addNode(true));
@@ -76,24 +76,44 @@
FOR_EACH_LOC(EdgeIt, e, g) std::cout << e << " ";
std::cout << std::endl;
- typedef stGraphWrapper<Graph> stGW;
- stGW stgw(g);
- ConstMap<stGW::Edge, int> const1map(1);
+ std::cout << "Nodes in T:" << std::endl;
+ FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.T_CLASS) std::cout << v << " ";
+ std::cout << std::endl;
+ std::cout << "Nodes in S:" << std::endl;
+ FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.S_CLASS) std::cout << v << " ";
+ std::cout << std::endl;
+ std::cout << "Erasing the first node..." << std::endl;
+ NodeIt n;
+ g.first(n);
+ g.erase(n);
+ std::cout << "Nodes of the bipartite graph:" << std::endl;
+ FOR_EACH_GLOB(n, g) std::cout << n << " ";
+ std::cout << std::endl;
+ std::cout << "Nodes in T:" << std::endl;
+ FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.T_CLASS) std::cout << v << " ";
+ std::cout << std::endl;
+ std::cout << "Nodes in S:" << std::endl;
+ FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, g.S_CLASS) std::cout << v << " ";
+ std::cout << std::endl;
+ typedef stGraphWrapper<Graph> stGW;
+ stGW stgw(g);
+ ConstMap<stGW::Edge, int> const1map(1);
Timer ts;
ts.reset();
stGW::EdgeMap<int> flow(stgw);
MaxFlow<stGW, int, ConstMap<stGW::Edge, int>, stGW::EdgeMap<int> >
max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow);
+ max_flow_test.run();
// while (max_flow_test.augmentOnShortestPath()) { }
- typedef ListGraph MutableGraph;
+// typedef ListGraph MutableGraph;
// while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) {
- while (max_flow_test.augmentOnBlockingFlow2()) {
- std::cout << max_flow_test.flowValue() << std::endl;
- }
+// while (max_flow_test.augmentOnBlockingFlow2()) {
+// std::cout << max_flow_test.flowValue() << std::endl;
+// }
std::cout << "max flow value: " << max_flow_test.flowValue() << std::endl;
std::cout << "elapsed time: " << ts << std::endl;
FOR_EACH_LOC(stGW::EdgeIt, e, stgw) {
@@ -101,17 +121,5 @@
}
std::cout << std::endl;
- ts.reset();
- stGW::EdgeMap<int> pre_flow(stgw);
- MaxFlow<stGW, int, ConstMap<stGW::Edge, int>, stGW::EdgeMap<int> >
- pre_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, pre_flow/*, true*/);
- pre_flow_test.run();
- std::cout << "pre flow value: " << max_flow_test.flowValue() << std::endl;
- std::cout << "elapsed time: " << ts << std::endl;
-// FOR_EACH_LOC(stGW::EdgeIt, e, stgw) {
-// std::cout << e << ": " << pre_flow[e] << "\n";
-// }
-// std::cout << "\n";
-
return 0;
}
More information about the Lemon-commits
mailing list