3 #include <smart_graph.h>
4 #include <list_graph.h>
6 #include <preflowproba.h>
7 #include <time_measure.h>
11 int main(int, char **) {
13 typedef SmartGraph Graph;
15 typedef Graph::Node Node;
16 typedef Graph::EdgeIt EdgeIt;
20 Graph::EdgeMap<int> cap(G);
21 readDimacsMaxFlow(std::cin, G, s, t, cap);
24 std::cout << "preflow demo ..." << std::endl;
26 Graph::EdgeMap<int> flow(G);
27 Preflow<Graph, int> max_flow_test(G, s, t, cap, flow, 1,1);
30 std::cout << "elapsed time with res: " << ts << std::endl;
32 std::cout << "preflow demo ..." << std::endl;
34 Graph::EdgeMap<int> flow2(G);
35 Preflow<Graph, int> max_flow_test2(G, s, t, cap, flow2, 1,0);
38 std::cout << "elapsed time without res: " << ts << std::endl;
40 Graph::NodeMap<bool> cut(G);
41 max_flow_test.minCut(cut);
44 for(G.first(e); G.valid(e); G.next(e)) {
45 if (cut[G.tail(e)] && !cut[G.head(e)]) min_cut_value+=cap[e];
48 Graph::NodeMap<bool> cut1(G);
49 max_flow_test.minMinCut(cut1);
50 int min_min_cut_value=0;
51 for(G.first(e); G.valid(e); G.next(e)) {
52 if (cut[G.tail(e)] && !cut[G.head(e)])
53 min_min_cut_value+=cap[e];
56 Graph::NodeMap<bool> cut2(G);
57 max_flow_test.maxMinCut(cut2);
58 int max_min_cut_value=0;
59 for(G.first(e); G.valid(e); G.next(e)) {
60 if (cut2[G.tail(e)] && !cut2[G.head(e)])
61 max_min_cut_value+=cap[e];
64 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
65 std::cout << "min cut value: "<< min_cut_value << std::endl;
66 std::cout << "min min cut value: "<< min_min_cut_value << std::endl;
67 std::cout << "max min cut value: "<< max_min_cut_value <<
68 std::endl<< std::endl;