Changeset 269:07af3069c0b8 in lemon-0.x for src/work/marci/edmonds_karp_demo.cc
- Timestamp:
- 03/31/04 17:50:21 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@375
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/edmonds_karp_demo.cc
r268 r269 91 91 92 92 { 93 //std::cout << "SmartGraph..." << std::endl;94 93 typedef TrivGraphWrapper<const Graph> GW; 95 94 GW gw(G); … … 123 122 124 123 { 125 //std::cout << "SmartGraph..." << std::endl;126 124 typedef TrivGraphWrapper<const Graph> GW; 127 125 GW gw(G); … … 154 152 } 155 153 156 // { 157 // std::cout << "edmonds karp demo (on-the-fly blocking flow augmentation)..." << std::endl; 158 // Graph::EdgeMap<int> flow(G); //0 flow 159 160 // Timer ts; 161 // ts.reset(); 162 163 // MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap); 164 // int i=0; 165 // while (max_flow_test.augmentOnBlockingFlow2()) { 166 // // for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 167 // // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") "; 168 // // } 169 // // std::cout<<std::endl; 170 // ++i; 171 // } 172 173 // // std::cout << "maximum flow: "<< std::endl; 174 // // for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 175 // // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") "; 176 // // } 177 // // std::cout<<std::endl; 178 // std::cout << "elapsed time: " << ts << std::endl; 179 // std::cout << "number of augmentation phases: " << i << std::endl; 180 // std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; 181 // } 154 { 155 typedef TrivGraphWrapper<const Graph> GW; 156 GW gw(G); 157 std::cout << "edmonds karp demo (on-the-fly blocking flow augmentation)..." << std::endl; 158 GW::EdgeMap<int> flow(G); //0 flow 159 160 Timer ts; 161 ts.reset(); 162 163 typedef GW::EdgeMapWrapper< Graph::EdgeMap<int>, int > EMW; 164 EMW cw(cap); 165 MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw); 166 int i=0; 167 while (max_flow_test.augmentOnBlockingFlow2()) { 168 // for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 169 // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") "; 170 // } 171 // std::cout<<std::endl; 172 ++i; 173 } 174 175 // std::cout << "maximum flow: "<< std::endl; 176 // for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 177 // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") "; 178 // } 179 // std::cout<<std::endl; 180 std::cout << "elapsed time: " << ts << std::endl; 181 std::cout << "number of augmentation phases: " << i << std::endl; 182 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; 183 } 182 184 183 185 { … … 190 192 ts.reset(); 191 193 192 //CM cm;193 194 typedef GW::EdgeMapWrapper< Graph::EdgeMap<int>, int > EMW; 194 195 EMW cw(cap);
Note: See TracChangeset
for help on using the changeset viewer.