src/work/marci/edmonds_karp_demo.cc
changeset 206 47f62d789fe7
parent 188 ad1417e74042
child 243 a85fd87460e3
     1.1 --- a/src/work/marci/edmonds_karp_demo.cc	Fri Mar 19 07:59:52 2004 +0000
     1.2 +++ b/src/work/marci/edmonds_karp_demo.cc	Fri Mar 19 09:09:20 2004 +0000
     1.3 @@ -34,8 +34,8 @@
     1.4  
     1.5    typedef ListGraph MutableGraph;
     1.6  
     1.7 -//  typedef SmartGraph Graph;
     1.8 -  typedef ListGraph Graph;
     1.9 +  typedef SmartGraph Graph;
    1.10 +  //typedef ListGraph Graph;
    1.11    typedef Graph::Node Node;
    1.12    typedef Graph::EdgeIt EdgeIt;
    1.13  
    1.14 @@ -114,6 +114,35 @@
    1.15    }
    1.16  
    1.17    {
    1.18 +    std::cout << "SmartGraph..." << std::endl;
    1.19 +    std::cout << "edmonds karp demo (physical blocking flow 1 augmentation)..." << std::endl;
    1.20 +    Graph::EdgeMap<int> flow(G); //0 flow
    1.21 +
    1.22 +    Timer ts;
    1.23 +    ts.reset();
    1.24 +
    1.25 +    MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
    1.26 +    //max_flow_test.augmentWithBlockingFlow<Graph>();
    1.27 +    int i=0;
    1.28 +    while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) { 
    1.29 +//     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 
    1.30 +//       std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
    1.31 +//     }
    1.32 +//     std::cout<<std::endl;
    1.33 +      ++i; 
    1.34 +    }
    1.35 +
    1.36 +//   std::cout << "maximum flow: "<< std::endl;
    1.37 +//   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 
    1.38 +//     std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
    1.39 +//   }
    1.40 +//   std::cout<<std::endl;
    1.41 +    std::cout << "elapsed time: " << ts << std::endl;
    1.42 +    std::cout << "number of augmentation phases: " << i << std::endl; 
    1.43 +    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    1.44 +  }
    1.45 +
    1.46 +  {
    1.47      std::cout << "edmonds karp demo (on-the-fly blocking flow augmentation)..." << std::endl;
    1.48      Graph::EdgeMap<int> flow(G); //0 flow
    1.49