1.1 --- a/src/work/marci/edmonds_karp_demo.cc Tue Mar 30 17:37:14 2004 +0000
1.2 +++ b/src/work/marci/edmonds_karp_demo.cc Tue Mar 30 17:47:51 2004 +0000
1.3 @@ -121,33 +121,37 @@
1.4 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
1.5 }
1.6
1.7 -// {
1.8 -// //std::cout << "SmartGraph..." << std::endl;
1.9 -// std::cout << "edmonds karp demo (physical blocking flow 1 augmentation)..." << std::endl;
1.10 -// Graph::EdgeMap<int> flow(G); //0 flow
1.11 + {
1.12 + //std::cout << "SmartGraph..." << std::endl;
1.13 + typedef TrivGraphWrapper<const Graph> GW;
1.14 + GW gw(G);
1.15 + std::cout << "edmonds karp demo (physical blocking flow 1 augmentation)..." << std::endl;
1.16 + GW::EdgeMap<int> flow(G); //0 flow
1.17
1.18 -// Timer ts;
1.19 -// ts.reset();
1.20 + Timer ts;
1.21 + ts.reset();
1.22
1.23 -// MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
1.24 -// int i=0;
1.25 -// while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) {
1.26 -// // for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) {
1.27 -// // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
1.28 -// // }
1.29 -// // std::cout<<std::endl;
1.30 -// ++i;
1.31 + typedef GW::EdgeMapWrapper< Graph::EdgeMap<int>, int > EMW;
1.32 + EMW cw(cap);
1.33 + MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw);
1.34 + int i=0;
1.35 + while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) {
1.36 +// for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) {
1.37 +// std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
1.38 // }
1.39 +// std::cout<<std::endl;
1.40 + ++i;
1.41 + }
1.42
1.43 -// // std::cout << "maximum flow: "<< std::endl;
1.44 -// // for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) {
1.45 -// // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
1.46 -// // }
1.47 -// // std::cout<<std::endl;
1.48 -// std::cout << "elapsed time: " << ts << std::endl;
1.49 -// std::cout << "number of augmentation phases: " << i << std::endl;
1.50 -// std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
1.51 +// std::cout << "maximum flow: "<< std::endl;
1.52 +// for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) {
1.53 +// std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
1.54 // }
1.55 +// std::cout<<std::endl;
1.56 + std::cout << "elapsed time: " << ts << std::endl;
1.57 + std::cout << "number of augmentation phases: " << i << std::endl;
1.58 + std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
1.59 + }
1.60
1.61 // {
1.62 // std::cout << "edmonds karp demo (on-the-fly blocking flow augmentation)..." << std::endl;