Index: src/work/marci/bipartite_matching_demo.cc
===================================================================
--- src/work/marci/bipartite_matching_demo.cc	(revision 771)
+++ src/work/marci/bipartite_matching_demo.cc	(revision 771)
@@ -0,0 +1,183 @@
+// -*- c++ -*-
+#include <iostream>
+#include <fstream>
+#include <vector>
+
+#include <sage_graph.h>
+//#include <smart_graph.h>
+//#include <dimacs.h>
+#include <hugo/time_measure.h>
+#include <for_each_macros.h>
+#include <bfs_dfs.h>
+#include <bipartite_graph_wrapper.h>
+#include <hugo/maps.h>
+#include <hugo/max_flow.h>
+#include <graph_gen.h>
+#include <max_bipartite_matching.h>
+
+using namespace hugo;
+
+using std::cin;
+using std::cout;
+using std::endl;
+
+int main() {
+  //typedef UndirListGraph Graph; 
+  typedef BipartiteGraph<SageGraph> Graph;
+  
+  typedef Graph::Node Node;
+  typedef Graph::NodeIt NodeIt;
+  typedef Graph::Edge Edge;
+  typedef Graph::EdgeIt EdgeIt;
+  typedef Graph::OutEdgeIt OutEdgeIt;
+
+  Graph g;
+
+  int a;
+  cout << "number of nodes in the first color class=";
+  cin >> a; 
+  int b;
+  cout << "number of nodes in the second color class=";
+  cin >> b; 
+  int m;
+  cout << "number of edges=";
+  cin >> m; 
+  
+  cout << "Generatig a random bipartite graph..." << endl;
+  random_init();
+  randomBipartiteGraph(g, a, b, m);
+
+//   cout << "Edges of the bipartite graph:" << endl;
+//   FOR_EACH_LOC(EdgeIt, e, g) cout << e << " ";
+//   cout << endl;
+
+//   cout << "Nodes:" << endl;
+//   FOR_EACH_LOC(Graph::NodeIt, v, g) cout << v << " ";
+//   cout << endl;
+//   cout << "Nodes in T:" << endl;
+//   FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, Graph::T_CLASS) cout << v << " ";
+//   cout << endl;
+//   cout << "Nodes in S:" << endl;
+//   FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, Graph::S_CLASS) cout << v << " ";
+//   cout << endl;
+
+//   cout << "Erasing the first node..." << endl;
+//   NodeIt n;
+//   g.first(n);
+//   g.erase(n);
+//   cout << "Nodes of the bipartite graph:" << endl;
+//   FOR_EACH_GLOB(n, g) cout << n << " ";
+//   cout << endl;
+
+//   cout << "Nodes in T:" << endl;
+//   FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, Graph::T_CLASS) cout << v << " ";
+//   cout << endl;
+//   cout << "Nodes in S:" << endl;
+//   FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, Graph::S_CLASS) cout << v << " ";
+//   cout << endl;
+
+  typedef stBipartiteGraphWrapper<Graph> stGW;
+  stGW stgw(g);
+  ConstMap<stGW::Edge, int> const1map(1);
+
+  Timer ts;
+  cout << "max bipartite matching with stGraphWrapper..." << endl;
+  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;
+//  while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) {
+//  while (max_flow_test.augmentOnBlockingFlow2()) {
+//   cout << max_flow_test.flowValue() << endl;
+//  }
+  cout << "matching value: " << max_flow_test.flowValue() << endl;
+  cout << "elapsed time: " << ts << endl;
+//   FOR_EACH_LOC(stGW::EdgeIt, e, stgw) { 
+//     if (flow[e]) cout << e << endl; 
+//   }
+  cout << endl;
+
+  typedef ConstMap<Graph::Edge, int> EdgeCap; 
+  EdgeCap ge1(1);
+  typedef ConstMap<Graph::Node, int> NodeCap;
+  NodeCap gn1(1);
+  typedef Graph::EdgeMap<int> EdgeFlow;
+  EdgeFlow gef(g); //0
+  typedef Graph::NodeMap<int> NodeFlow; 
+  NodeFlow gnf(g); //0 
+
+  typedef stGW::EdgeMapWrapper<EdgeCap, NodeCap> CapMap; 
+  typedef stGW::EdgeMapWrapper<EdgeFlow, NodeFlow> FlowMap; 
+  CapMap cm(ge1, gn1);
+  FlowMap fm(gef, gnf);
+
+  //Timer ts;
+  cout << "max bipartite matching with stGraphWrapper..." << endl;
+  ts.reset();
+  //stGW::EdgeMap<int> flow(stgw);
+  MaxFlow<stGW, int, CapMap, FlowMap> 
+    max_flow_test1(stgw, stgw.S_NODE, stgw.T_NODE, cm, fm);
+  max_flow_test1.run();
+//  while (max_flow_test.augmentOnShortestPath()) { }
+//  typedef ListGraph MutableGraph;
+//  while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) {
+//  while (max_flow_test.augmentOnBlockingFlow2()) {
+//   cout << max_flow_test.flowValue() << endl;
+//  }
+  cout << "matching value: " << max_flow_test1.flowValue() << endl;
+  cout << "elapsed time: " << ts << endl;
+//   FOR_EACH_LOC(Graph::EdgeIt, e, g) { 
+//     if (gef[e]) cout << e << endl; 
+//   }
+  cout << endl;
+
+  cout << "max bipartite matching with stGraphWrapper..." << endl;
+  ts.reset();
+  FOR_EACH_LOC(Graph::EdgeIt, e, g) gef.set(e, 0); 
+  FOR_EACH_LOC(Graph::NodeIt, n, g) gnf.set(n, 0); 
+  MaxBipartiteMatching<Graph, ConstMap<Graph::Edge, int>, ConstMap<Graph::Node, int>, 
+    Graph::EdgeMap<int>, Graph::NodeMap<int> > 
+    matching_test(g, ge1, gn1, gef, gnf);
+  matching_test.run();
+
+  cout << "matching value: " << matching_test.matchingValue() << endl;
+  cout << "elapsed time: " << ts << endl;
+//   FOR_EACH_LOC(Graph::EdgeIt, e, g) { 
+//     if (gef[e]) cout << e << endl; 
+//   }
+  cout << endl;
+
+  cout << "max bipartite matching with MaxBipartiteMatching..." << endl;
+  ts.reset();
+  FOR_EACH_LOC(Graph::EdgeIt, e, g) gef.set(e, 0); 
+  //FOR_EACH_LOC(Graph::NodeIt, n, g) gnf.set(n, 0); 
+  typedef MaxBipartiteMatching<Graph, ConstMap<Graph::Edge, int>, 
+    ConstMap<Graph::Node, int>, 
+    Graph::EdgeMap<int>, Graph::NodeMap<int> > MaxBipartiteMatching;
+  MaxBipartiteMatching matching_test_1(g, ge1, gn1, gef/*, gnf*/);
+  matching_test_1.run();
+
+  cout << "matching value: " << matching_test_1.matchingValue() << endl;
+  cout << "elapsed time: " << ts << endl;
+//   FOR_EACH_LOC(Graph::EdgeIt, e, g) { 
+//     if (gef[e]) cout << e << endl; 
+//   }
+  cout << endl;
+
+  cout << "testing optimality with MaxBipartiteMatching..." << endl;
+  ts.reset();
+  matching_test_1.run(MaxBipartiteMatching::GEN_MATCHING);
+  cout << "matching value: " << matching_test_1.matchingValue() << endl;
+  cout << "elapsed time: " << ts << endl;
+
+  cout << "testing optimality with MaxBipartiteMatching..." << endl;
+  ts.reset();
+  matching_test_1.run(MaxBipartiteMatching::GEN_MATCHING_WITH_GOOD_NODE_FLOW);
+  cout << "matching value: " << matching_test_1.matchingValue() << endl;
+  cout << "elapsed time: " << ts << endl;
+
+  return 0;
+}
Index: src/work/marci/bipartite_matching_try.cc
===================================================================
--- src/work/marci/bipartite_matching_try.cc	(revision 768)
+++ 	(revision )
@@ -1,195 +1,0 @@
-// -*- c++ -*-
-#include <iostream>
-#include <fstream>
-#include <vector>
-#include <cstdlib>
-
-#include <sage_graph.h>
-//#include <smart_graph.h>
-//#include <dimacs.h>
-#include <hugo/time_measure.h>
-#include <for_each_macros.h>
-#include <bfs_dfs.h>
-#include <hugo/graph_wrapper.h>
-#include <bipartite_graph_wrapper.h>
-#include <hugo/maps.h>
-#include <hugo/max_flow.h>
-#include <augmenting_flow.h>
-
-/**
- * Inicializalja a veletlenszamgeneratort.
- * Figyelem, ez nem jo igazi random szamokhoz,
- * erre ne bizzad a titkaidat!
- */
-void random_init()
-{
-	unsigned int seed = getpid();
-	seed |= seed << 15;
-	seed ^= time(0);
-
-	srand(seed);
-}
-
-/**
- * Egy veletlen int-et ad vissza 0 es m-1 kozott.
- */
-int random(int m)
-{
-  return int( double(m) * rand() / (RAND_MAX + 1.0) );
-}
-
-using namespace hugo;
-
-int main() {
-  typedef UndirSageGraph Graph; 
-  typedef Graph::Node Node;
-  typedef Graph::NodeIt NodeIt;
-  typedef Graph::Edge Edge;
-  typedef Graph::EdgeIt EdgeIt;
-  typedef Graph::OutEdgeIt OutEdgeIt;
-
-  Graph g;
-
-  std::vector<Graph::Node> s_nodes;
-  std::vector<Graph::Node> t_nodes;
-
-  int a;
-  std::cout << "number of nodes in the first color class=";
-  std::cin >> a; 
-  int b;
-  std::cout << "number of nodes in the second color class=";
-  std::cin >> b; 
-  int m;
-  std::cout << "number of edges=";
-  std::cin >> m; 
-  
-
-  for (int i=0; i<a; ++i) s_nodes.push_back(g.addNode());
-  for (int i=0; i<b; ++i) t_nodes.push_back(g.addNode());
-
-  random_init();
-  for(int i=0; i<m; ++i) {
-    g.addEdge(s_nodes[random(a)], t_nodes[random(b)]);
-  }
-
-  Graph::NodeMap<int> ref_map(g, -1);
-
-  IterableBoolMap< Graph::NodeMap<int> > bipartite_map(ref_map);
-  for (int i=0; i<a; ++i) bipartite_map.insert(s_nodes[i], false);
-  for (int i=0; i<b; ++i) bipartite_map.insert(t_nodes[i], true);
-
-//   Graph::Node u;
-//   std::cout << "These nodes will be in S:\n";
-//   //FIXME azert kellene ++, es invalid vizsgalat u-bol, hogy ezt le lehessen 
-//   //irni 1etlen FOR_EACH-csel.
-//   for (bipartite_map.first(u, false); g.valid(u); bipartite_map.next(u)) 
-//     std::cout << u << " ";
-//   std::cout << "\n";
-//   std::cout << "These nodes will be in T:\n";
-//   for (bipartite_map.first(u, true); g.valid(u); bipartite_map.next(u)) 
-//     std::cout << u << " ";
-//   std::cout << "\n";
-
-  typedef BipartiteGraphWrapper<Graph> BGW;
-  BGW bgw(g, bipartite_map);
-
-//   std::cout << "Nodes by NodeIt:\n";
-//   FOR_EACH_LOC(BGW::NodeIt, n, bgw) {
-//     std::cout << n << " ";
-//   }
-//   std::cout << "\n";
-//   std::cout << "Nodes in S by ClassNodeIt:\n";
-//   FOR_EACH_INC_LOC(BGW::ClassNodeIt, n, bgw, bgw.S_CLASS) {
-//     std::cout << n << " ";
-//   }
-//   std::cout << "\n";
-//   std::cout << "Nodes in T by ClassNodeIt:\n";
-//   FOR_EACH_INC_LOC(BGW::ClassNodeIt, n, bgw, bgw.T_CLASS) {
-//     std::cout << n << " ";
-//   }
-//   std::cout << "\n";
-//   std::cout << "Edges of the bipartite graph:\n";
-//   FOR_EACH_LOC(BGW::EdgeIt, e, bgw) {
-//     std::cout << bgw.tail(e) << "->" << bgw.head(e) << std::endl;
-//   }
-
-//  BGW::NodeMap<int> dbyj(bgw);
-//  BGW::EdgeMap<int> dbyxcj(bgw);
-
-  typedef stBipartiteGraphWrapper<BGW> stGW;
-  stGW stgw(bgw);
-  ConstMap<stGW::Edge, int> const1map(1);
-//  stGW::NodeMap<int> ize(stgw);
-
-//   BfsIterator< BGW, BGW::NodeMap<bool> > bfs(bgw);
-//   Graph::NodeIt si;
-//   Graph::Node s; 
-//   s=g.first(si);
-//   bfs.pushAndSetReached(BGW::Node(s));
-//   while (!bfs.finished()) { ++bfs; }
-
-//   FOR_EACH_LOC(stGW::NodeIt, n, stgw) { 
-//     std::cout << "out-edges of " << n << ":\n"; 
-//     FOR_EACH_INC_LOC(stGW::OutEdgeIt, e, stgw, n) { 
-//       std::cout << " " << e << "\n";
-//       std::cout << " aNode: " << stgw.aNode(e) << "\n";
-//       std::cout << " bNode: " << stgw.bNode(e) << "\n";      
-//     }
-//     std::cout << "in-edges of " << n << ":\n"; 
-//     FOR_EACH_INC_LOC(stGW::InEdgeIt, e, stgw, n) { 
-//       std::cout << " " << e << "\n";
-//       std::cout << " aNode: " << stgw.aNode(e) << "\n";
-//       std::cout << " bNode: " << stgw.bNode(e) << "\n";     
-//     }
-//   }
-//   std::cout << "Edges of the stGraphWrapper:\n"; 
-//   FOR_EACH_LOC(stGW::EdgeIt, n, stgw) { 
-//     std::cout << " " << n << "\n";
-//   }
-
-//   stGW::NodeMap<bool> b(stgw);
-//   FOR_EACH_LOC(stGW::NodeIt, n, stgw) { 
-//     std::cout << n << ": " << b[n] <<"\n";
-//   }
-
-//   std::cout << "Bfs from s: \n";
-//   BfsIterator< stGW, stGW::NodeMap<bool> > bfs_stgw(stgw);
-//   bfs_stgw.pushAndSetReached(stgw.S_NODE);
-//   while (!bfs_stgw.finished()) { 
-//     std::cout << " " << stGW::OutEdgeIt(bfs_stgw) << "\n";
-//     ++bfs_stgw; 
-//   }
-
-
-  Timer ts;
-  ts.reset();
-  stGW::EdgeMap<int> max_flow(stgw);
-  AugmentingFlow<stGW, int, ConstMap<stGW::Edge, int>, stGW::EdgeMap<int> > 
-    max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, max_flow);
-//  while (max_flow_test.augmentOnShortestPath()) { }
-  typedef SageGraph MutableGraph;
-//  while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) {
-  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) { 
-//     std::cout << e << ": " << max_flow[e] << "\n"; 
-//   }
-//   std::cout << "\n";
-
-  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;
-}
Index: src/work/marci/bipartite_matching_try_3.cc
===================================================================
--- src/work/marci/bipartite_matching_try_3.cc	(revision 768)
+++ 	(revision )
@@ -1,182 +1,0 @@
-// -*- c++ -*-
-#include <iostream>
-#include <fstream>
-#include <vector>
-
-#include <sage_graph.h>
-//#include <smart_graph.h>
-//#include <dimacs.h>
-#include <hugo/time_measure.h>
-#include <for_each_macros.h>
-#include <bfs_dfs.h>
-#include <bipartite_graph_wrapper.h>
-#include <hugo/maps.h>
-#include <hugo/max_flow.h>
-#include <graph_gen.h>
-#include <max_bipartite_matching.h>
-
-using namespace hugo;
-
-using std::cout;
-using std::endl;
-
-int main() {
-  //typedef UndirListGraph Graph; 
-  typedef BipartiteGraph<SageGraph> Graph;
-  
-  typedef Graph::Node Node;
-  typedef Graph::NodeIt NodeIt;
-  typedef Graph::Edge Edge;
-  typedef Graph::EdgeIt EdgeIt;
-  typedef Graph::OutEdgeIt OutEdgeIt;
-
-  Graph g;
-
-  int a;
-  cout << "number of nodes in the first color class=";
-  std::cin >> a; 
-  int b;
-  cout << "number of nodes in the second color class=";
-  std::cin >> b; 
-  int m;
-  cout << "number of edges=";
-  std::cin >> m; 
-  
-  cout << "Generatig a random bipartite graph..." << endl;
-  random_init();
-  randomBipartiteGraph(g, a, b, m);
-
-//   cout << "Edges of the bipartite graph:" << endl;
-//   FOR_EACH_LOC(EdgeIt, e, g) cout << e << " ";
-//   cout << endl;
-
-//   cout << "Nodes:" << endl;
-//   FOR_EACH_LOC(Graph::NodeIt, v, g) cout << v << " ";
-//   cout << endl;
-//   cout << "Nodes in T:" << endl;
-//   FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, Graph::T_CLASS) cout << v << " ";
-//   cout << endl;
-//   cout << "Nodes in S:" << endl;
-//   FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, Graph::S_CLASS) cout << v << " ";
-//   cout << endl;
-
-//   cout << "Erasing the first node..." << endl;
-//   NodeIt n;
-//   g.first(n);
-//   g.erase(n);
-//   cout << "Nodes of the bipartite graph:" << endl;
-//   FOR_EACH_GLOB(n, g) cout << n << " ";
-//   cout << endl;
-
-//   cout << "Nodes in T:" << endl;
-//   FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, Graph::T_CLASS) cout << v << " ";
-//   cout << endl;
-//   cout << "Nodes in S:" << endl;
-//   FOR_EACH_INC_LOC(Graph::ClassNodeIt, v, g, Graph::S_CLASS) cout << v << " ";
-//   cout << endl;
-
-  typedef stBipartiteGraphWrapper<Graph> stGW;
-  stGW stgw(g);
-  ConstMap<stGW::Edge, int> const1map(1);
-
-  Timer ts;
-  cout << "max bipartite matching with stGraphWrapper..." << endl;
-  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;
-//  while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) {
-//  while (max_flow_test.augmentOnBlockingFlow2()) {
-//   cout << max_flow_test.flowValue() << endl;
-//  }
-  cout << "matching value: " << max_flow_test.flowValue() << endl;
-  cout << "elapsed time: " << ts << endl;
-//   FOR_EACH_LOC(stGW::EdgeIt, e, stgw) { 
-//     if (flow[e]) cout << e << endl; 
-//   }
-  cout << endl;
-
-  typedef ConstMap<Graph::Edge, int> EdgeCap; 
-  EdgeCap ge1(1);
-  typedef ConstMap<Graph::Node, int> NodeCap;
-  NodeCap gn1(1);
-  typedef Graph::EdgeMap<int> EdgeFlow;
-  EdgeFlow gef(g); //0
-  typedef Graph::NodeMap<int> NodeFlow; 
-  NodeFlow gnf(g); //0 
-
-  typedef stGW::EdgeMapWrapper<EdgeCap, NodeCap> CapMap; 
-  typedef stGW::EdgeMapWrapper<EdgeFlow, NodeFlow> FlowMap; 
-  CapMap cm(ge1, gn1);
-  FlowMap fm(gef, gnf);
-
-  //Timer ts;
-  cout << "max bipartite matching with stGraphWrapper..." << endl;
-  ts.reset();
-  //stGW::EdgeMap<int> flow(stgw);
-  MaxFlow<stGW, int, CapMap, FlowMap> 
-    max_flow_test1(stgw, stgw.S_NODE, stgw.T_NODE, cm, fm);
-  max_flow_test1.run();
-//  while (max_flow_test.augmentOnShortestPath()) { }
-//  typedef ListGraph MutableGraph;
-//  while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) {
-//  while (max_flow_test.augmentOnBlockingFlow2()) {
-//   cout << max_flow_test.flowValue() << endl;
-//  }
-  cout << "matching value: " << max_flow_test1.flowValue() << endl;
-  cout << "elapsed time: " << ts << endl;
-//   FOR_EACH_LOC(Graph::EdgeIt, e, g) { 
-//     if (gef[e]) cout << e << endl; 
-//   }
-  cout << endl;
-
-  cout << "max bipartite matching with stGraphWrapper..." << endl;
-  ts.reset();
-  FOR_EACH_LOC(Graph::EdgeIt, e, g) gef.set(e, 0); 
-  FOR_EACH_LOC(Graph::NodeIt, n, g) gnf.set(n, 0); 
-  MaxBipartiteMatching<Graph, ConstMap<Graph::Edge, int>, ConstMap<Graph::Node, int>, 
-    Graph::EdgeMap<int>, Graph::NodeMap<int> > 
-    matching_test(g, ge1, gn1, gef, gnf);
-  matching_test.run();
-
-  cout << "matching value: " << matching_test.matchingValue() << endl;
-  cout << "elapsed time: " << ts << endl;
-//   FOR_EACH_LOC(Graph::EdgeIt, e, g) { 
-//     if (gef[e]) cout << e << endl; 
-//   }
-  cout << endl;
-
-  cout << "max bipartite matching with MaxBipartiteMatching..." << endl;
-  ts.reset();
-  FOR_EACH_LOC(Graph::EdgeIt, e, g) gef.set(e, 0); 
-  //FOR_EACH_LOC(Graph::NodeIt, n, g) gnf.set(n, 0); 
-  typedef MaxBipartiteMatching<Graph, ConstMap<Graph::Edge, int>, 
-    ConstMap<Graph::Node, int>, 
-    Graph::EdgeMap<int>, Graph::NodeMap<int> > MaxBipartiteMatching;
-  MaxBipartiteMatching matching_test_1(g, ge1, gn1, gef/*, gnf*/);
-  matching_test_1.run();
-
-  cout << "matching value: " << matching_test_1.matchingValue() << endl;
-  cout << "elapsed time: " << ts << endl;
-//   FOR_EACH_LOC(Graph::EdgeIt, e, g) { 
-//     if (gef[e]) cout << e << endl; 
-//   }
-  cout << endl;
-
-  cout << "testing optimality with MaxBipartiteMatching..." << endl;
-  ts.reset();
-  matching_test_1.run(MaxBipartiteMatching::GEN_MATCHING);
-  cout << "matching value: " << matching_test_1.matchingValue() << endl;
-  cout << "elapsed time: " << ts << endl;
-
-  cout << "testing optimality with MaxBipartiteMatching..." << endl;
-  ts.reset();
-  matching_test_1.run(MaxBipartiteMatching::GEN_MATCHING_WITH_GOOD_NODE_FLOW);
-  cout << "matching value: " << matching_test_1.matchingValue() << endl;
-  cout << "elapsed time: " << ts << endl;
-
-  return 0;
-}
Index: src/work/marci/leda/bipartite_matching_comparison.cc
===================================================================
--- src/work/marci/leda/bipartite_matching_comparison.cc	(revision 771)
+++ src/work/marci/leda/bipartite_matching_comparison.cc	(revision 771)
@@ -0,0 +1,152 @@
+// -*- c++ -*-
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <cstdlib>
+
+#include <LEDA/graph.h>
+#include <LEDA/mcb_matching.h>
+#include <LEDA/list.h>
+#include <LEDA/graph_gen.h>
+
+#include <leda_graph_wrapper.h>
+#include <sage_graph.h>
+//#include <smart_graph.h>
+//#include <dimacs.h>
+#include <hugo/time_measure.h>
+#include <for_each_macros.h>
+#include <hugo/graph_wrapper.h>
+#include <bipartite_graph_wrapper.h>
+#include <hugo/maps.h>
+#include <hugo/max_flow.h>
+
+using std::cin;
+using std::cout;
+using std::endl;
+
+using namespace hugo;
+
+int main() {
+  //for leda graph
+  leda::graph lg;
+  //lg.make_undirected();
+  typedef LedaGraphWrapper<leda::graph> Graph;
+  Graph g(lg);
+
+  //for UndirSageGraph
+  //typedef UndirSageGraph Graph; 
+  //Graph g;
+
+  typedef Graph::Node Node;
+  typedef Graph::NodeIt NodeIt;
+  typedef Graph::Edge Edge;
+  typedef Graph::EdgeIt EdgeIt;
+  typedef Graph::OutEdgeIt OutEdgeIt;
+
+  std::vector<Graph::Node> s_nodes;
+  std::vector<Graph::Node> t_nodes;
+
+  int a;
+  cout << "number of nodes in the first color class=";
+  cin >> a; 
+  int b;
+  cout << "number of nodes in the second color class=";
+  cin >> b; 
+  int m;
+  cout << "number of edges=";
+  cin >> m; 
+  int k;
+  cout << "A bipartite graph is a random group graph if the color classes \nA and B are partitiones to A_0, A_1, ..., A_{k-1} and B_0, B_1, ..., B_{k-1} \nas equally as possible \nand the edges from A_i goes to A_{i-1 mod k} and A_{i+1 mod k}.\n";
+  cout << "number of groups in LEDA random group graph=";
+  cin >> k; 
+  cout << endl;
+  
+  leda_list<leda_node> lS;
+  leda_list<leda_node> lT;
+  random_bigraph(lg, a, b, m, lS, lT, k);
+
+  Graph::NodeMap<int> ref_map(g, -1);
+  IterableBoolMap< Graph::NodeMap<int> > bipartite_map(ref_map);
+
+  //generating leda random group graph
+  leda_node ln;
+  forall(ln, lS) bipartite_map.insert(ln, false);
+  forall(ln, lT) bipartite_map.insert(ln, true);
+
+  //making bipartite graph
+  typedef BipartiteGraphWrapper<Graph> BGW;
+  BGW bgw(g, bipartite_map);
+
+
+  //st-wrapper
+  typedef stBipartiteGraphWrapper<BGW> stGW;
+  stGW stgw(bgw);
+  ConstMap<stGW::Edge, int> const1map(1);
+  stGW::EdgeMap<int> flow(stgw);
+
+  Timer ts;
+
+  ts.reset();
+  FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0);
+  MaxFlow<stGW, int, ConstMap<stGW::Edge, int>, stGW::EdgeMap<int> > 
+    max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow/*, true*/);
+  max_flow_test.run();
+  cout << "HUGO max matching algorithm based on preflow." << endl 
+	    << "Size of matching: " 
+	    << max_flow_test.flowValue() << endl;
+  cout << "elapsed time: " << ts << endl << endl;
+
+  ts.reset();  
+  leda_list<leda_edge> ml=MAX_CARD_BIPARTITE_MATCHING(lg);
+  cout << "LEDA max matching algorithm." << endl 
+	    << "Size of matching: " 
+	    << ml.size() << endl;
+  cout << "elapsed time: " << ts << endl << endl;
+
+//   ts.reset();
+//   FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0);
+//   typedef SageGraph MutableGraph;
+//   while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) { }
+//   cout << "HUGO max matching algorithm based on blocking flow augmentation." 
+// 	    << endl << "Matching size: " 
+// 	    << max_flow_test.flowValue() << endl;
+//   cout << "elapsed time: " << ts << endl << endl;
+
+  {
+  SageGraph hg;
+  SageGraph::Node s=hg.addNode();  
+  SageGraph::Node t=hg.addNode();
+  BGW::NodeMap<SageGraph::Node> b_s_nodes(bgw);  
+  BGW::NodeMap<SageGraph::Node> b_t_nodes(bgw);
+  
+  FOR_EACH_INC_LOC(BGW::ClassNodeIt, n, bgw, BGW::S_CLASS) {
+    b_s_nodes.set(n, hg.addNode());
+    hg.addEdge(s, b_s_nodes[n]);
+  }
+  FOR_EACH_INC_LOC(BGW::ClassNodeIt, n, bgw, BGW::T_CLASS) {
+    b_t_nodes.set(n, hg.addNode());
+    hg.addEdge(b_t_nodes[n], t);
+  }
+
+  FOR_EACH_LOC(BGW::EdgeIt, e, bgw) 
+    hg.addEdge(b_s_nodes[bgw.tail(e)], b_t_nodes[bgw.head(e)]);
+
+  ConstMap<SageGraph::Edge, int> cm(1);
+  SageGraph::EdgeMap<int> flow(hg); //0
+  
+  Timer ts;
+
+  ts.reset();
+  MaxFlow<SageGraph, int, ConstMap<SageGraph::Edge, int>, 
+    SageGraph::EdgeMap<int> > 
+    max_flow_test(hg, s, t, cm, flow);
+  max_flow_test.run();
+  cout << "HUGO max matching algorithm on SageGraph by copying the graph, based on preflow." 
+	    << endl 
+	    << "Size of matching: " 
+	    << max_flow_test.flowValue() << endl;
+  cout << "elapsed time: " << ts << endl << endl;
+  }
+
+  return 0;
+}
Index: src/work/marci/leda/comparison.cc
===================================================================
--- src/work/marci/leda/comparison.cc	(revision 770)
+++ 	(revision )
@@ -1,152 +1,0 @@
-// -*- c++ -*-
-#include <iostream>
-#include <fstream>
-#include <vector>
-#include <cstdlib>
-
-#include <LEDA/graph.h>
-#include <LEDA/mcb_matching.h>
-#include <LEDA/list.h>
-#include <LEDA/graph_gen.h>
-
-#include <leda_graph_wrapper.h>
-#include <sage_graph.h>
-//#include <smart_graph.h>
-//#include <dimacs.h>
-#include <hugo/time_measure.h>
-#include <for_each_macros.h>
-#include <hugo/graph_wrapper.h>
-#include <bipartite_graph_wrapper.h>
-#include <hugo/maps.h>
-#include <hugo/max_flow.h>
-
-using std::cin;
-using std::cout;
-using std::endl;
-
-using namespace hugo;
-
-int main() {
-  //for leda graph
-  leda::graph lg;
-  //lg.make_undirected();
-  typedef LedaGraphWrapper<leda::graph> Graph;
-  Graph g(lg);
-
-  //for UndirSageGraph
-  //typedef UndirSageGraph Graph; 
-  //Graph g;
-
-  typedef Graph::Node Node;
-  typedef Graph::NodeIt NodeIt;
-  typedef Graph::Edge Edge;
-  typedef Graph::EdgeIt EdgeIt;
-  typedef Graph::OutEdgeIt OutEdgeIt;
-
-  std::vector<Graph::Node> s_nodes;
-  std::vector<Graph::Node> t_nodes;
-
-  int a;
-  cout << "number of nodes in the first color class=";
-  cin >> a; 
-  int b;
-  cout << "number of nodes in the second color class=";
-  cin >> b; 
-  int m;
-  cout << "number of edges=";
-  cin >> m; 
-  int k;
-  cout << "A bipartite graph is a random group graph if the color classes \nA and B are partitiones to A_0, A_1, ..., A_{k-1} and B_0, B_1, ..., B_{k-1} \nas equally as possible \nand the edges from A_i goes to A_{i-1 mod k} and A_{i+1 mod k}.\n";
-  cout << "number of groups in LEDA random group graph=";
-  cin >> k; 
-  cout << endl;
-  
-  leda_list<leda_node> lS;
-  leda_list<leda_node> lT;
-  random_bigraph(lg, a, b, m, lS, lT, k);
-
-  Graph::NodeMap<int> ref_map(g, -1);
-  IterableBoolMap< Graph::NodeMap<int> > bipartite_map(ref_map);
-
-  //generating leda random group graph
-  leda_node ln;
-  forall(ln, lS) bipartite_map.insert(ln, false);
-  forall(ln, lT) bipartite_map.insert(ln, true);
-
-  //making bipartite graph
-  typedef BipartiteGraphWrapper<Graph> BGW;
-  BGW bgw(g, bipartite_map);
-
-
-  //st-wrapper
-  typedef stBipartiteGraphWrapper<BGW> stGW;
-  stGW stgw(bgw);
-  ConstMap<stGW::Edge, int> const1map(1);
-  stGW::EdgeMap<int> flow(stgw);
-
-  Timer ts;
-
-  ts.reset();
-  FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0);
-  MaxFlow<stGW, int, ConstMap<stGW::Edge, int>, stGW::EdgeMap<int> > 
-    max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow/*, true*/);
-  max_flow_test.run();
-  cout << "HUGO max matching algorithm based on preflow." << endl 
-	    << "Size of matching: " 
-	    << max_flow_test.flowValue() << endl;
-  cout << "elapsed time: " << ts << endl << endl;
-
-  ts.reset();  
-  leda_list<leda_edge> ml=MAX_CARD_BIPARTITE_MATCHING(lg);
-  cout << "LEDA max matching algorithm." << endl 
-	    << "Size of matching: " 
-	    << ml.size() << endl;
-  cout << "elapsed time: " << ts << endl << endl;
-
-//   ts.reset();
-//   FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0);
-//   typedef SageGraph MutableGraph;
-//   while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) { }
-//   cout << "HUGO max matching algorithm based on blocking flow augmentation." 
-// 	    << endl << "Matching size: " 
-// 	    << max_flow_test.flowValue() << endl;
-//   cout << "elapsed time: " << ts << endl << endl;
-
-  {
-  SageGraph hg;
-  SageGraph::Node s=hg.addNode();  
-  SageGraph::Node t=hg.addNode();
-  BGW::NodeMap<SageGraph::Node> b_s_nodes(bgw);  
-  BGW::NodeMap<SageGraph::Node> b_t_nodes(bgw);
-  
-  FOR_EACH_INC_LOC(BGW::ClassNodeIt, n, bgw, BGW::S_CLASS) {
-    b_s_nodes.set(n, hg.addNode());
-    hg.addEdge(s, b_s_nodes[n]);
-  }
-  FOR_EACH_INC_LOC(BGW::ClassNodeIt, n, bgw, BGW::T_CLASS) {
-    b_t_nodes.set(n, hg.addNode());
-    hg.addEdge(b_t_nodes[n], t);
-  }
-
-  FOR_EACH_LOC(BGW::EdgeIt, e, bgw) 
-    hg.addEdge(b_s_nodes[bgw.tail(e)], b_t_nodes[bgw.head(e)]);
-
-  ConstMap<SageGraph::Edge, int> cm(1);
-  SageGraph::EdgeMap<int> flow(hg); //0
-  
-  Timer ts;
-
-  ts.reset();
-  MaxFlow<SageGraph, int, ConstMap<SageGraph::Edge, int>, 
-    SageGraph::EdgeMap<int> > 
-    max_flow_test(hg, s, t, cm, flow);
-  max_flow_test.run();
-  cout << "HUGO max matching algorithm on SageGraph by copying the graph, based on preflow." 
-	    << endl 
-	    << "Size of matching: " 
-	    << max_flow_test.flowValue() << endl;
-  cout << "elapsed time: " << ts << endl << endl;
-  }
-
-  return 0;
-}
Index: src/work/marci/leda/makefile
===================================================================
--- src/work/marci/leda/makefile	(revision 617)
+++ src/work/marci/leda/makefile	(revision 771)
@@ -5,5 +5,5 @@
 LDFLAGS = -L$(LEDAROOT) -lG -lL -lm
 
-BINARIES = bipartite_matching_leda bipartite_matching_leda_gen comparison
+BINARIES = bipartite_matching_leda bipartite_matching_leda_gen bipartite_matching_comparison
 
 include ../../makefile
Index: src/work/marci/leda/max_bipartite_matching_demo.cc
===================================================================
--- src/work/marci/leda/max_bipartite_matching_demo.cc	(revision 771)
+++ src/work/marci/leda/max_bipartite_matching_demo.cc	(revision 771)
@@ -0,0 +1,218 @@
+// -*- c++ -*-
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <cstdlib>
+
+#include <LEDA/graph.h>
+#include <LEDA/mcb_matching.h>
+#include <LEDA/list.h>
+
+#include <leda_graph_wrapper.h>
+#include <sage_graph.h>
+#include <dimacs.h>
+#include <time_measure.h>
+#include <edmonds_karp.h>
+
+/**
+ * Inicializalja a veletlenszamgeneratort.
+ * Figyelem, ez nem jo igazi random szamokhoz,
+ * erre ne bizzad a titkaidat!
+ */
+void random_init()
+{
+	unsigned int seed = getpid();
+	seed |= seed << 15;
+	seed ^= time(0);
+
+	srand(seed);
+}
+
+/**
+ * Egy veletlen int-et ad vissza 0 es m-1 kozott.
+ */
+int random(int m)
+{
+	return int( double(m) * rand() / (RAND_MAX + 1.0) );
+}
+
+using namespace hugo;
+
+using std::cout; 
+using std::cin; 
+using std::endl;
+
+int main() {
+   leda::graph g;
+   typedef LedaGraphWrapper<leda::graph> Graph;
+   Graph G(g);
+//  typedef ListGraph Graph;
+//  Graph G;
+
+  typedef Graph::Node Node;
+  typedef Graph::NodeIt NodeIt;  
+  typedef Graph::Edge Edge;
+  typedef Graph::EdgeIt EdgeIt;
+  typedef Graph::OutEdgeIt OutEdgeIt;
+  typedef Graph::InEdgeIt InEdgeIt;
+
+  //Node s, t;
+  //Graph::EdgeMap<int> cap(G);
+  //readDimacsMaxFlow(std::cin, G, s, t, cap);
+  std::vector<Node> s_nodes;
+  std::vector<Node> t_nodes;
+
+  int a;
+  cout << "number of nodes in the first color class=";
+  cin >> a; 
+  int b;
+  cout << "number of nodes in the second color class=";
+  cin >> b; 
+  int m;
+  cout << "number of edges=";
+  cin >> m;   
+
+  for(int i=0; i<a; ++i) {
+    s_nodes.push_back(G.addNode());
+  }
+  for(int i=0; i<a; ++i) {
+    t_nodes.push_back(G.addNode());
+  }
+  random_init();
+  for(int i=0; i<m; ++i) {
+    G.addEdge(s_nodes[random(a)], t_nodes[random(b)]);
+  }
+  
+//   G.addEdge(s_nodes[1], t_nodes[5-4]);
+//   G.addEdge(s_nodes[1], t_nodes[5-4]);
+//   G.addEdge(s_nodes[1], t_nodes[4-4]);
+//   G.addEdge(s_nodes[1], t_nodes[4-4]);
+//   G.addEdge(s_nodes[2], t_nodes[4-4]);
+//   G.addEdge(s_nodes[3], t_nodes[4-4]);
+
+  leda_list<leda_node> A;
+  leda_list<leda_node> B;
+  Graph::NodeMap<bool> s_map(G); //false
+  Graph::NodeMap<bool> t_map(G); //false
+  
+  for(int i=0; i<a; ++i) { s_map.set(s_nodes[i], true); A+=s_nodes[i]; }
+  for(int i=0; i<b; ++i) { t_map.set(t_nodes[i], true); B+=t_nodes[i]; }
+
+//   cout << "bfs and dfs iterator demo on the directed graph" << endl;
+//   for(NodeIt n=G.first<NodeIt>(); G.valid(n); G.next(n)) { 
+//     cout << G.id(n) << ": ";
+//     cout << "out edges: ";
+//     for(OutEdgeIt e=G.first<OutEdgeIt>(n); G.valid(e); G.next(e)) 
+//       cout << G.id(G.tail(e)) << "->" << G.id(G.head(e)) << " ";
+//     cout << "in edges: ";
+//     for(InEdgeIt e=G.first<InEdgeIt>(n); G.valid(e); G.next(e)) 
+//       cout << G.id(G.tail(e)) << "->" << G.id(G.head(e)) << " ";
+//     cout << endl;
+//   }
+
+
+  {
+    std::cout << "on-the-fly max bipartite matching (Edmonds-Karp) demo on wrapped leda graph..." << std::endl;
+    Graph::EdgeMap<int> flow(G); //0 flow
+    Graph::EdgeMap<int> cap(G, 1);
+
+    Timer ts;
+    ts.reset();
+
+    MaxMatching<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s_map, t_map, flow, cap);
+    int i=0;
+    while (max_flow_test.augmentOnShortestPath()) { 
+//       for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
+// 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
+//       std::cout<<std::endl;
+      ++i; 
+    }
+
+//     std::cout << "maximum matching: "<< std::endl;
+//     for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
+//       if (flow.get(e))
+// 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
+//     std::cout<<std::endl;
+//     std::cout << "edges which are not in this maximum matching: "<< std::endl;
+//     for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
+//       if (!flow.get(e))
+// 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
+//     std::cout<<std::endl;
+    
+    std::cout << "elapsed time: " << ts << std::endl;
+    std::cout << "number of augmentation phases: " << i << std::endl; 
+    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
+  }
+
+//   {
+//     std::cout << "on-the-fly max bipartite matching demo (Hopcroft-Karp) on wrapped leda graph..." << std::endl;
+//     Graph::EdgeMap<int> flow(G); //0 flow
+//     Graph::EdgeMap<int> cap(G, 1);
+
+//     Timer ts;
+//     ts.reset();
+
+//     MaxMatching<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s_map, t_map, flow, cap);
+//     int i=0;
+//     while (max_flow_test.augmentOnBlockingFlow2()) { 
+// //       for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
+// // 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
+// //       std::cout<<std::endl;
+//       ++i; 
+//     }
+
+// //     std::cout << "maximum matching: "<< std::endl;
+// //     for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
+// //       if (flow.get(e))
+// // 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
+// //     std::cout<<std::endl;
+// //     std::cout << "edges which are not in this maximum matching: "<< std::endl;
+// //     for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
+// //       if (!flow.get(e))
+// // 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
+// //     std::cout<<std::endl;
+    
+//     std::cout << "elapsed time: " << ts << std::endl;
+//     std::cout << "number of augmentation phases: " << i << std::endl; 
+//     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
+//   }
+
+  {
+    std::cout << "max bipartite matching (LEDA)..." << std::endl;
+    //Graph::EdgeMap<int> flow(G); //0 flow
+    //Graph::EdgeMap<int> cap(G, 1);
+
+    leda_node_array<bool> NC(g);
+
+    Timer ts;
+    ts.reset();
+
+    //MaxMatching<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s_map, t_map, flow, cap);
+    //int i=0;
+    //while (max_flow_test.augmentOnShortestPath()) { ++i; }
+    
+    //leda_list<leda_edge> l=MAX_CARD_BIPARTITE_MATCHING_HK(g, A, B, NC, false);
+    leda_list<leda_edge> l=MAX_CARD_BIPARTITE_MATCHING(g);    
+    
+
+//     std::cout << "maximum matching: "<< std::endl;
+//     for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
+//       if (flow.get(e))
+// 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
+//     std::cout<<std::endl;
+//     std::cout << "edges which are not in this maximum matching: "<< std::endl;
+//     for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
+//       if (!flow.get(e))
+// 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
+//     std::cout<<std::endl;
+    
+    
+    std::cout << "elapsed time: " << ts << std::endl;
+    //std::cout << "number of augmentation phases: " << i << std::endl; 
+    std::cout << "flow value: "<< l.size() << std::endl;
+  }
+  
+  
+
+  return 0;
+}
Index: src/work/marci/makefile
===================================================================
--- src/work/marci/makefile	(revision 762)
+++ src/work/marci/makefile	(revision 771)
@@ -5,5 +5,5 @@
 
 LEDABINARIES = leda_graph_demo leda_bfs_dfs max_bipartite_matching_demo
-BINARIES = max_flow_demo iterator_bfs_demo macro_test lg_vs_sg_vs_sg bfsit_vs_byhand bipartite_graph_wrapper_test bipartite_matching_try bipartite_matching_try_3 top_sort_test max_flow_1
+BINARIES = max_flow_demo iterator_bfs_demo macro_test lg_vs_sg_vs_sg bfsit_vs_byhand bipartite_graph_wrapper_test bipartite_matching_demo top_sort_test max_flow_1
 #BINARIES = preflow_bug
 #gw_vs_not preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos edmonds_karp_demo_alpar preflow_demo_leda
Index: src/work/marci/max_bipartite_matching_demo.cc
===================================================================
--- src/work/marci/max_bipartite_matching_demo.cc	(revision 768)
+++ 	(revision )
@@ -1,218 +1,0 @@
-// -*- c++ -*-
-#include <iostream>
-#include <fstream>
-#include <vector>
-#include <cstdlib>
-
-#include <LEDA/graph.h>
-#include <LEDA/mcb_matching.h>
-#include <LEDA/list.h>
-
-#include <leda_graph_wrapper.h>
-#include <sage_graph.h>
-#include <dimacs.h>
-#include <time_measure.h>
-#include <edmonds_karp.h>
-
-/**
- * Inicializalja a veletlenszamgeneratort.
- * Figyelem, ez nem jo igazi random szamokhoz,
- * erre ne bizzad a titkaidat!
- */
-void random_init()
-{
-	unsigned int seed = getpid();
-	seed |= seed << 15;
-	seed ^= time(0);
-
-	srand(seed);
-}
-
-/**
- * Egy veletlen int-et ad vissza 0 es m-1 kozott.
- */
-int random(int m)
-{
-	return int( double(m) * rand() / (RAND_MAX + 1.0) );
-}
-
-using namespace hugo;
-
-using std::cout; 
-using std::cin; 
-using std::endl;
-
-int main() {
-   leda::graph g;
-   typedef LedaGraphWrapper<leda::graph> Graph;
-   Graph G(g);
-//  typedef ListGraph Graph;
-//  Graph G;
-
-  typedef Graph::Node Node;
-  typedef Graph::NodeIt NodeIt;  
-  typedef Graph::Edge Edge;
-  typedef Graph::EdgeIt EdgeIt;
-  typedef Graph::OutEdgeIt OutEdgeIt;
-  typedef Graph::InEdgeIt InEdgeIt;
-
-  //Node s, t;
-  //Graph::EdgeMap<int> cap(G);
-  //readDimacsMaxFlow(std::cin, G, s, t, cap);
-  std::vector<Node> s_nodes;
-  std::vector<Node> t_nodes;
-
-  int a;
-  cout << "number of nodes in the first color class=";
-  cin >> a; 
-  int b;
-  cout << "number of nodes in the second color class=";
-  cin >> b; 
-  int m;
-  cout << "number of edges=";
-  cin >> m;   
-
-  for(int i=0; i<a; ++i) {
-    s_nodes.push_back(G.addNode());
-  }
-  for(int i=0; i<a; ++i) {
-    t_nodes.push_back(G.addNode());
-  }
-  random_init();
-  for(int i=0; i<m; ++i) {
-    G.addEdge(s_nodes[random(a)], t_nodes[random(b)]);
-  }
-  
-//   G.addEdge(s_nodes[1], t_nodes[5-4]);
-//   G.addEdge(s_nodes[1], t_nodes[5-4]);
-//   G.addEdge(s_nodes[1], t_nodes[4-4]);
-//   G.addEdge(s_nodes[1], t_nodes[4-4]);
-//   G.addEdge(s_nodes[2], t_nodes[4-4]);
-//   G.addEdge(s_nodes[3], t_nodes[4-4]);
-
-  leda_list<leda_node> A;
-  leda_list<leda_node> B;
-  Graph::NodeMap<bool> s_map(G); //false
-  Graph::NodeMap<bool> t_map(G); //false
-  
-  for(int i=0; i<a; ++i) { s_map.set(s_nodes[i], true); A+=s_nodes[i]; }
-  for(int i=0; i<b; ++i) { t_map.set(t_nodes[i], true); B+=t_nodes[i]; }
-
-//   cout << "bfs and dfs iterator demo on the directed graph" << endl;
-//   for(NodeIt n=G.first<NodeIt>(); G.valid(n); G.next(n)) { 
-//     cout << G.id(n) << ": ";
-//     cout << "out edges: ";
-//     for(OutEdgeIt e=G.first<OutEdgeIt>(n); G.valid(e); G.next(e)) 
-//       cout << G.id(G.tail(e)) << "->" << G.id(G.head(e)) << " ";
-//     cout << "in edges: ";
-//     for(InEdgeIt e=G.first<InEdgeIt>(n); G.valid(e); G.next(e)) 
-//       cout << G.id(G.tail(e)) << "->" << G.id(G.head(e)) << " ";
-//     cout << endl;
-//   }
-
-
-  {
-    std::cout << "on-the-fly max bipartite matching (Edmonds-Karp) demo on wrapped leda graph..." << std::endl;
-    Graph::EdgeMap<int> flow(G); //0 flow
-    Graph::EdgeMap<int> cap(G, 1);
-
-    Timer ts;
-    ts.reset();
-
-    MaxMatching<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s_map, t_map, flow, cap);
-    int i=0;
-    while (max_flow_test.augmentOnShortestPath()) { 
-//       for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
-// 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
-//       std::cout<<std::endl;
-      ++i; 
-    }
-
-//     std::cout << "maximum matching: "<< std::endl;
-//     for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
-//       if (flow.get(e))
-// 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
-//     std::cout<<std::endl;
-//     std::cout << "edges which are not in this maximum matching: "<< std::endl;
-//     for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
-//       if (!flow.get(e))
-// 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
-//     std::cout<<std::endl;
-    
-    std::cout << "elapsed time: " << ts << std::endl;
-    std::cout << "number of augmentation phases: " << i << std::endl; 
-    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
-  }
-
-//   {
-//     std::cout << "on-the-fly max bipartite matching demo (Hopcroft-Karp) on wrapped leda graph..." << std::endl;
-//     Graph::EdgeMap<int> flow(G); //0 flow
-//     Graph::EdgeMap<int> cap(G, 1);
-
-//     Timer ts;
-//     ts.reset();
-
-//     MaxMatching<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s_map, t_map, flow, cap);
-//     int i=0;
-//     while (max_flow_test.augmentOnBlockingFlow2()) { 
-// //       for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
-// // 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
-// //       std::cout<<std::endl;
-//       ++i; 
-//     }
-
-// //     std::cout << "maximum matching: "<< std::endl;
-// //     for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
-// //       if (flow.get(e))
-// // 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
-// //     std::cout<<std::endl;
-// //     std::cout << "edges which are not in this maximum matching: "<< std::endl;
-// //     for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
-// //       if (!flow.get(e))
-// // 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
-// //     std::cout<<std::endl;
-    
-//     std::cout << "elapsed time: " << ts << std::endl;
-//     std::cout << "number of augmentation phases: " << i << std::endl; 
-//     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
-//   }
-
-  {
-    std::cout << "max bipartite matching (LEDA)..." << std::endl;
-    //Graph::EdgeMap<int> flow(G); //0 flow
-    //Graph::EdgeMap<int> cap(G, 1);
-
-    leda_node_array<bool> NC(g);
-
-    Timer ts;
-    ts.reset();
-
-    //MaxMatching<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s_map, t_map, flow, cap);
-    //int i=0;
-    //while (max_flow_test.augmentOnShortestPath()) { ++i; }
-    
-    //leda_list<leda_edge> l=MAX_CARD_BIPARTITE_MATCHING_HK(g, A, B, NC, false);
-    leda_list<leda_edge> l=MAX_CARD_BIPARTITE_MATCHING(g);    
-    
-
-//     std::cout << "maximum matching: "<< std::endl;
-//     for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
-//       if (flow.get(e))
-// 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
-//     std::cout<<std::endl;
-//     std::cout << "edges which are not in this maximum matching: "<< std::endl;
-//     for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e))  
-//       if (!flow.get(e))
-// 	std::cout << G.id(G.tail(e)) << "-" << flow.get(e) << "->" << G.id(G.head(e)) << " ";
-//     std::cout<<std::endl;
-    
-    
-    std::cout << "elapsed time: " << ts << std::endl;
-    //std::cout << "number of augmentation phases: " << i << std::endl; 
-    std::cout << "flow value: "<< l.size() << std::endl;
-  }
-  
-  
-
-  return 0;
-}
