src/work/alpar/f_ed_ka_demo.cc
changeset 108 0351b00fd283
parent 103 063de9e1be98
child 117 67253d52b284
equal deleted inserted replaced
3:f0b66bfe7d3c 4:36ff401e3091
     6 #include "../list_graph.hh"
     6 #include "../list_graph.hh"
     7 #include "../marci/dimacs.hh"
     7 #include "../marci/dimacs.hh"
     8 #include "f_ed_ka.h"
     8 #include "f_ed_ka.h"
     9 #include "../marci/time_measure.h"
     9 #include "../marci/time_measure.h"
    10 
    10 
    11 using namespace marci;
    11 using namespace hugo;
    12 
    12 
    13 // Use a DIMACS max flow file as stdin.
    13 // Use a DIMACS max flow file as stdin.
    14 // read_dimacs_demo < dimacs_max_flow_file
    14 // read_dimacs_demo < dimacs_max_flow_file
    15 
    15 
    16 int main(int, char **) {
    16 int main(int, char **) {
    17   //  typedef SmartGraph Graph;
    17   typedef SmartGraph Graph;
    18   typedef ListGraph Graph;
    18   //typedef ListGraph Graph;
    19 
    19 
    20   typedef Graph::NodeIt NodeIt;
    20   typedef Graph::NodeIt NodeIt;
    21   typedef Graph::EachNodeIt EachNodeIt;
    21   typedef Graph::EachNodeIt EachNodeIt;
    22   typedef Graph::EachEdgeIt EachEdgeIt;
    22   typedef Graph::EachEdgeIt EachEdgeIt;
    23 
    23 
    24   Graph G;
    24   Graph G;
    25   NodeIt s, t;
    25   NodeIt s, t;
    26   Graph::EdgeMap<int> cap(G);
    26   Graph::DynEdgeMap<int> cap(G);
    27   readDimacsMaxFlow(std::cin, G, s, t, cap);
    27   readDimacsMaxFlow(std::cin, G, s, t, cap);
    28 
    28 
    29   std::cout << "edmonds karp demo..." << std::endl;
    29   std::cout << "edmonds karp demo..." << std::endl;
    30   Graph::EdgeMap<int> flow(G); //0 flow
    30   Graph::DynEdgeMap<int> flow(G); //0 flow
    31   
    31   
    32   int ret;
    32   int ret;
    33   double pre_time=currTime();
    33   double pre_time=currTime();
    34   ret = maxFlow(G,flow,cap,s,t);
    34   ret = maxFlow(G,flow,cap,s,t);
    35   double post_time=currTime();
    35   double post_time=currTime();