diff -r 4cb8f31c1ff8 -r baf0b6e40211 src/work/marci/max_flow_demo.cc --- a/src/work/marci/max_flow_demo.cc Tue Sep 14 17:42:43 2004 +0000 +++ b/src/work/marci/max_flow_demo.cc Wed Sep 15 10:34:12 2004 +0000 @@ -3,30 +3,23 @@ // Use a DIMACS max flow file as stdin. // max_flow_demo < dimacs_max_flow_file - #include #include -#include #include +#include #include #include -//#include #include #include -//#include -#include #include using namespace hugo; int main(int, char **) { - typedef SageGraph MutableGraph; - - //typedef FullFeatureGraphConcept Graph; - //typedef SmartGraph Graph; - typedef SageGraph Graph; + typedef ListGraph MutableGraph; + typedef SmartGraph Graph; typedef Graph::Node Node; typedef Graph::EdgeIt EdgeIt; @@ -53,7 +46,7 @@ std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; max_flow_test.minCut(cut); - FOR_EACH_LOC(Graph::EdgeIt, e, g) { + for(Graph::EdgeIt e(g); e!=INVALID; ++e) { if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) std::cout << "Slackness does not hold!" << std::endl; if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) @@ -63,13 +56,13 @@ { std::cout << "preflow ..." << std::endl; - FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); + for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0); ts.reset(); - max_flow_test.preflow(Preflow, Graph::EdgeMap >::GEN_FLOW); + max_flow_test.run(Preflow, Graph::EdgeMap >::GEN_FLOW); std::cout << "elapsed time: " << ts << std::endl; std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; - FOR_EACH_LOC(Graph::EdgeIt, e, g) { + for(Graph::EdgeIt e(g); e!=INVALID; ++e) { if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) std::cout << "Slackness does not hold!" << std::endl; if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) @@ -88,7 +81,7 @@ { std::cout << "physical blocking flow augmentation ..." << std::endl; - FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); + for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0); ts.reset(); int i=0; while (augmenting_flow_test.augmentOnBlockingFlow()) { ++i; } @@ -96,7 +89,7 @@ std::cout << "number of augmentation phases: " << i << std::endl; std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl; - FOR_EACH_LOC(Graph::EdgeIt, e, g) { + for(Graph::EdgeIt e(g); e!=INVALID; ++e) { if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) std::cout << "Slackness does not hold!" << std::endl; if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) @@ -106,7 +99,7 @@ { std::cout << "on-the-fly blocking flow augmentation ..." << std::endl; - FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); + for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0); ts.reset(); int i=0; while (augmenting_flow_test.augmentOnBlockingFlow2()) { ++i; } @@ -114,7 +107,7 @@ std::cout << "number of augmentation phases: " << i << std::endl; std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl; - FOR_EACH_LOC(Graph::EdgeIt, e, g) { + for(Graph::EdgeIt e(g); e!=INVALID; ++e) { if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) std::cout << "Slackness does not hold!" << std::endl; if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) @@ -124,7 +117,7 @@ { std::cout << "on-the-fly shortest path augmentation ..." << std::endl; - FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); + for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0); ts.reset(); int i=0; while (augmenting_flow_test.augmentOnShortestPath()) { ++i; } @@ -132,7 +125,7 @@ std::cout << "number of augmentation phases: " << i << std::endl; std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl; - FOR_EACH_LOC(Graph::EdgeIt, e, g) { + for(Graph::EdgeIt e(g); e!=INVALID; ++e) { if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) std::cout << "Slackness does not hold!" << std::endl; if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) @@ -142,7 +135,7 @@ { std::cout << "on-the-fly shortest path augmentation ..." << std::endl; - FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); + for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0); ts.reset(); int i=0; while (augmenting_flow_test.augmentOnShortestPath2()) { ++i; } @@ -150,7 +143,7 @@ std::cout << "number of augmentation phases: " << i << std::endl; std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl; - FOR_EACH_LOC(Graph::EdgeIt, e, g) { + for(Graph::EdgeIt e(g); e!=INVALID; ++e) { if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) std::cout << "Slackness does not hold!" << std::endl; if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0)