diff -r 132dd3eb0f33 -r 7deda4d6a07a src/work/jacint/preflow.cc --- a/src/work/jacint/preflow.cc Sat Mar 20 19:39:42 2004 +0000 +++ b/src/work/jacint/preflow.cc Sat Mar 20 20:06:23 2004 +0000 @@ -1,6 +1,7 @@ #include #include +#include #include #include #include @@ -11,12 +12,12 @@ // Use a DIMACS max flow file as stdin. // read_dimacs_demo < dimacs_max_flow_file int main(int, char **) { - typedef ListGraph::Node Node; - typedef ListGraph::EdgeIt EdgeIt; + typedef SmartGraph::Node Node; + typedef SmartGraph::EdgeIt EdgeIt; - ListGraph G; + SmartGraph G; Node s, t; - ListGraph::EdgeMap cap(G); + SmartGraph::EdgeMap cap(G); readDimacsMaxFlow(std::cin, G, s, t, cap); std::cout << "preflow demo ..." << std::endl; @@ -24,40 +25,40 @@ double mintime=1000000; for ( int i=1; i!=11; ++i ) { - ListGraph::EdgeMap flow(G); + SmartGraph::EdgeMap flow(G); double pre_time=currTime(); - Preflow max_flow_test(G, s, t, cap, flow); + Preflow max_flow_test(G, s, t, cap, flow); max_flow_test.run(); double post_time=currTime(); if ( mintime > post_time-pre_time ) mintime = post_time-pre_time; } - ListGraph::EdgeMap flow(G); - Preflow max_flow_test(G, s, t, cap, flow); + SmartGraph::EdgeMap flow(G); + Preflow max_flow_test(G, s, t, cap, flow); max_flow_test.run(); - ListGraph::NodeMap cut(G); + SmartGraph::NodeMap cut(G); max_flow_test.minCut(cut); int min_cut_value=0; EdgeIt e; for(G.first(e); G.valid(e); G.next(e)) { - if (cut.get(G.tail(e)) && !cut.get(G.head(e))) min_cut_value+=cap.get(e); + if (cut[G.tail(e)] && !cut[G.head(e)]) min_cut_value+=cap[e]; } - ListGraph::NodeMap cut1(G); + SmartGraph::NodeMap cut1(G); max_flow_test.minMinCut(cut1); int min_min_cut_value=0; for(G.first(e); G.valid(e); G.next(e)) { - if (cut.get(G.tail(e)) && !cut.get(G.head(e))) - min_min_cut_value+=cap.get(e); + if (cut[G.tail(e)] && !cut[G.head(e)]) + min_min_cut_value+=cap[e]; } - ListGraph::NodeMap cut2(G); + SmartGraph::NodeMap cut2(G); max_flow_test.maxMinCut(cut2); int max_min_cut_value=0; for(G.first(e); G.valid(e); G.next(e)) { - if (cut2.get(G.tail(e)) && !cut2.get(G.head(e))) - max_min_cut_value+=cap.get(e); + if (cut2[G.tail(e)] && !cut2[G.head(e)]) + max_min_cut_value+=cap[e]; } std::cout << "min time of 10 runs: " << mintime << " sec"<< std::endl;