# HG changeset patch # User jacint # Date 1079813183 0 # Node ID 7deda4d6a07a456743fe79324f4cc3cdd2a7563b # Parent 132dd3eb0f338b6ec13ca9bbfcd687404753e9a5 *** empty log message *** diff -r 132dd3eb0f33 -r 7deda4d6a07a src/work/jacint/README_FLOW --- a/src/work/jacint/README_FLOW Sat Mar 20 19:39:42 2004 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ - Heurisztikak: - -gap: ha egy 0 #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; diff -r 132dd3eb0f33 -r 7deda4d6a07a src/work/jacint/prim.cc --- a/src/work/jacint/prim.cc Sat Mar 20 19:39:42 2004 +0000 +++ b/src/work/jacint/prim.cc Sat Mar 20 20:06:23 2004 +0000 @@ -1,6 +1,7 @@ #include #include +#include #include #include #include @@ -12,18 +13,18 @@ using namespace hugo; int main(int, char **) { - typedef ListGraph::Node Node; + typedef SmartGraph::Node Node; - ListGraph G; + SmartGraph G; Node s, t; - ListGraph::EdgeMap cap(G); + SmartGraph::EdgeMap cap(G); readDimacsMaxFlow(std::cin, G, s, t, cap); std::cout << "prim demo ..." << std::endl; double pre_time=currTime(); - Prim > > prim_test(G, cap); + Prim > > prim_test(G, cap); prim_test.run(); double post_time=currTime(); @@ -31,8 +32,8 @@ << post_time-pre_time << " sec"<< std::endl; pre_time=currTime(); - Prim > > prim_test2(G, cap); + Prim > > prim_test2(G, cap); prim_test2.run(); post_time=currTime();