src/work/marci/edmonds_karp_demo.cc
changeset 157 ee17030e5f47
parent 146 c4adf922624f
child 168 27fbd1559fb7
equal deleted inserted replaced
7:18ec02a53eeb 8:74690b28dc45
     3 
     3 
     4 #include <list_graph.hh>
     4 #include <list_graph.hh>
     5 #include <dimacs.hh>
     5 #include <dimacs.hh>
     6 #include <edmonds_karp.hh>
     6 #include <edmonds_karp.hh>
     7 #include <time_measure.h>
     7 #include <time_measure.h>
       
     8 #include <graph_wrapper.h>
     8 
     9 
     9 using namespace hugo;
    10 using namespace hugo;
    10 
    11 
    11 // Use a DIMACS max flow file as stdin.
    12 // Use a DIMACS max flow file as stdin.
    12 // read_dimacs_demo < dimacs_max_flow_file
    13 // read_dimacs_demo < dimacs_max_flow_file
    55 
    56 
    56   ListGraph G;
    57   ListGraph G;
    57   NodeIt s, t;
    58   NodeIt s, t;
    58   ListGraph::EdgeMap<int> cap(G);
    59   ListGraph::EdgeMap<int> cap(G);
    59   readDimacsMaxFlow(std::cin, G, s, t, cap);
    60   readDimacsMaxFlow(std::cin, G, s, t, cap);
       
    61 /*
       
    62   typedef TrivGraphWrapper<ListGraph> TGW;
       
    63   TGW gw(G);
       
    64   TGW::EachNodeIt sw;
       
    65   gw.getFirst(sw);
       
    66   std::cout << "p1:" << gw.nodeNum() << std::endl;
       
    67   gw.erase(sw);
       
    68   std::cout << "p2:" << gw.nodeNum() << std::endl;
       
    69 
       
    70   typedef const ListGraph cLG;
       
    71   typedef TrivGraphWrapper<const cLG> CTGW;
       
    72   CTGW cgw(G);
       
    73   CTGW::EachNodeIt csw;
       
    74   cgw.getFirst(csw);
       
    75   std::cout << "p1:" << cgw.nodeNum() << std::endl;
       
    76   //cgw.erase(csw);
       
    77   std::cout << "p2:" << cgw.nodeNum() << std::endl;
       
    78 */
    60 
    79 
    61   {
    80   {
    62   std::cout << "edmonds karp demo (blocking flow augmentation)..." << std::endl;
    81   std::cout << "edmonds karp demo (blocking flow augmentation)..." << std::endl;
    63   ListGraph::EdgeMap<int> flow(G); //0 flow
    82   ListGraph::EdgeMap<int> flow(G); //0 flow
    64 
    83