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);
30 std::cout << "elapsed time: " << ts << std::endl;
32 Graph::NodeMap<bool> cut(G);
33 max_flow_test.minCut(cut);
36 for(G.first(e); G.valid(e); G.next(e)) {
37 if (cut[G.tail(e)] && !cut[G.head(e)]) min_cut_value+=cap[e];
40 Graph::NodeMap<bool> cut1(G);
41 max_flow_test.minMinCut(cut1);
42 int min_min_cut_value=0;
43 for(G.first(e); G.valid(e); G.next(e)) {
44 if (cut[G.tail(e)] && !cut[G.head(e)])
45 min_min_cut_value+=cap[e];
48 Graph::NodeMap<bool> cut2(G);
49 max_flow_test.maxMinCut(cut2);
50 int max_min_cut_value=0;
51 for(G.first(e); G.valid(e); G.next(e)) {
52 if (cut2[G.tail(e)] && !cut2[G.head(e)])
53 max_min_cut_value+=cap[e];
56 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
57 std::cout << "min cut value: "<< min_cut_value << std::endl;
58 std::cout << "min min cut value: "<< min_min_cut_value << std::endl;
59 std::cout << "max min cut value: "<< max_min_cut_value <<
60 std::endl<< std::endl;