src/work/marci/leda/bipartite_matching_leda.cc
changeset 775 e46a1f0623a0
parent 648 8c13444bccf6
child 921 818510fa3d99
equal deleted inserted replaced
6:32b83a8bf358 7:0920af7c4c5c
    12 #include <leda_graph_wrapper.h>
    12 #include <leda_graph_wrapper.h>
    13 #include <sage_graph.h>
    13 #include <sage_graph.h>
    14 //#include <smart_graph.h>
    14 //#include <smart_graph.h>
    15 //#include <dimacs.h>
    15 //#include <dimacs.h>
    16 #include <hugo/time_measure.h>
    16 #include <hugo/time_measure.h>
    17 #include <hugo/for_each_macros.h>
    17 #include <for_each_macros.h>
    18 #include <hugo/graph_wrapper.h>
    18 #include <hugo/graph_wrapper.h>
    19 #include <bipartite_graph_wrapper.h>
    19 #include <bipartite_graph_wrapper.h>
    20 #include <hugo/maps.h>
    20 #include <hugo/maps.h>
    21 #include <max_flow.h>
    21 #include <hugo/max_flow.h>
    22 
    22 
    23 /**
    23 /**
    24  * Inicializalja a veletlenszamgeneratort.
    24  * Inicializalja a veletlenszamgeneratort.
    25  * Figyelem, ez nem jo igazi random szamokhoz,
    25  * Figyelem, ez nem jo igazi random szamokhoz,
    26  * erre ne bizzad a titkaidat!
    26  * erre ne bizzad a titkaidat!
    93   BGW bgw(g, bipartite_map);
    93   BGW bgw(g, bipartite_map);
    94 
    94 
    95   BGW::NodeMap<int> dbyj(bgw);
    95   BGW::NodeMap<int> dbyj(bgw);
    96   BGW::EdgeMap<int> dbyxcj(bgw);
    96   BGW::EdgeMap<int> dbyxcj(bgw);
    97 
    97 
    98   typedef stGraphWrapper<BGW> stGW;
    98   typedef stBipartiteGraphWrapper<BGW> stGW;
    99   stGW stgw(bgw);
    99   stGW stgw(bgw);
   100   ConstMap<stGW::Edge, int> const1map(1);
   100   ConstMap<stGW::Edge, int> const1map(1);
   101 
   101 
   102   Timer ts;
   102   Timer ts;
   103   stGW::EdgeMap<int> flow(stgw);
   103   stGW::EdgeMap<int> flow(stgw);
   107   ts.reset();
   107   ts.reset();
   108   FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0);
   108   FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0);
   109 //  while (max_flow_test.augmentOnShortestPath()) { }
   109 //  while (max_flow_test.augmentOnShortestPath()) { }
   110   typedef SageGraph MutableGraph;
   110   typedef SageGraph MutableGraph;
   111 //  while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) {
   111 //  while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) {
   112   while (max_flow_test.augmentOnBlockingFlow2()) {
   112 //   while (max_flow_test.augmentOnBlockingFlow2()) {
   113    std::cout << max_flow_test.flowValue() << std::endl;
   113 //    std::cout << max_flow_test.flowValue() << std::endl;
   114   }
   114 //   }
       
   115   max_flow_test.run();
   115   std::cout << "max flow value: " << max_flow_test.flowValue() << std::endl;
   116   std::cout << "max flow value: " << max_flow_test.flowValue() << std::endl;
   116   std::cout << "elapsed time: " << ts << std::endl;
   117   std::cout << "elapsed time: " << ts << std::endl;
   117 
   118 
   118   ts.reset();
   119   ts.reset();
   119   FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0);
   120   FOR_EACH_LOC(stGW::EdgeIt, e, stgw) flow.set(e, 0);