equal
deleted
inserted
replaced
28 preflow<ListGraph, int> max_flow_test(G, s, t, cap); |
28 preflow<ListGraph, int> max_flow_test(G, s, t, cap); |
29 double post_time=currTime(); |
29 double post_time=currTime(); |
30 if ( mintime > post_time-pre_time ) mintime = post_time-pre_time; |
30 if ( mintime > post_time-pre_time ) mintime = post_time-pre_time; |
31 } |
31 } |
32 |
32 |
33 preflow<ListGraph, int> max_flow_test(G, s, t, cap); |
33 double pre_time=currTime(); |
34 |
34 preflow<ListGraph, int> max_flow_test(G, s, t, cap); |
|
35 double post_time=currTime(); |
|
36 |
35 ListGraph::NodeMap<bool> cut(G); |
37 ListGraph::NodeMap<bool> cut(G); |
36 max_flow_test.minCut(cut); |
38 max_flow_test.minCut(cut); |
37 int min_cut_value=0; |
39 int min_cut_value=0; |
38 for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) { |
40 for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) { |
39 if (cut.get(G.tail(e)) && !cut.get(G.head(e))) min_cut_value+=cap.get(e); |
41 if (cut.get(G.tail(e)) && !cut.get(G.head(e))) min_cut_value+=cap.get(e); |
54 if (cut2.get(G.tail(e)) && !cut2.get(G.head(e))) |
56 if (cut2.get(G.tail(e)) && !cut2.get(G.head(e))) |
55 max_min_cut_value+=cap.get(e); |
57 max_min_cut_value+=cap.get(e); |
56 } |
58 } |
57 |
59 |
58 std::cout << "min time of 10 runs: " << mintime << " sec"<< std::endl; |
60 std::cout << "min time of 10 runs: " << mintime << " sec"<< std::endl; |
|
61 std::cout << "phase 0: " << max_flow_test.time-pre_time |
|
62 << " sec"<< std::endl; |
|
63 std::cout << "phase 1: " << post_time-max_flow_test.time |
|
64 << " sec"<< std::endl; |
59 std::cout << "flow value: "<< max_flow_test.maxFlow() << std::endl; |
65 std::cout << "flow value: "<< max_flow_test.maxFlow() << std::endl; |
60 std::cout << "min cut value: "<< min_cut_value << std::endl; |
66 std::cout << "min cut value: "<< min_cut_value << std::endl; |
61 std::cout << "min min cut value: "<< min_min_cut_value << std::endl; |
67 std::cout << "min min cut value: "<< min_min_cut_value << std::endl; |
62 std::cout << "max min cut value: "<< max_min_cut_value << |
68 std::cout << "max min cut value: "<< max_min_cut_value << |
63 std::endl<< std::endl; |
69 std::endl<< std::endl; |