Dijkstra, bin_heap, fib_heap added to the doc.
6 #include <list_graph.h>
7 #include <smart_graph.h>
9 #include <edmonds_karp.h>
10 #include <time_measure.h>
11 #include <graph_wrapper.h>
15 // Use a DIMACS max flow file as stdin.
16 // read_dimacs_demo dimacs_max_flow_file
18 int main(int, char** argv) {
20 std::string in=argv[1];
21 typedef ListGraph MutableGraph;
24 typedef ListGraph Graph;
25 typedef Graph::Node Node;
26 typedef Graph::EdgeIt EdgeIt;
30 Graph::EdgeMap<int> cap(G);
31 std::ifstream ins(in.c_str());
32 readDimacsMaxFlow(ins, G, s, t, cap);
35 std::cout << "ListGraph..." << std::endl;
36 std::cout << "edmonds karp demo (physical blocking flow augmentation)..." << std::endl;
37 Graph::EdgeMap<int> flow(G); //0 flow
42 MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
44 while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) { ++i; }
46 std::cout << "elapsed time: " << ts << std::endl;
47 std::cout << "number of augmentation phases: " << i << std::endl;
48 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
52 std::cout << "edmonds karp demo (on-the-fly blocking flow augmentation)..." << std::endl;
53 Graph::EdgeMap<int> flow(G); //0 flow
58 MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
60 while (max_flow_test.augmentOnBlockingFlow2()) { ++i; }
62 std::cout << "elapsed time: " << ts << std::endl;
63 std::cout << "number of augmentation phases: " << i << std::endl;
64 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
68 std::cout << "edmonds karp demo (on-the-fly shortest path augmentation)..." << std::endl;
69 Graph::EdgeMap<int> flow(G); //0 flow
74 MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
76 while (max_flow_test.augmentOnShortestPath()) { ++i; }
78 std::cout << "elapsed time: " << ts << std::endl;
79 std::cout << "number of augmentation phases: " << i << std::endl;
80 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
86 typedef SmartGraph Graph;
87 typedef Graph::Node Node;
88 typedef Graph::EdgeIt EdgeIt;
92 Graph::EdgeMap<int> cap(G);
93 std::ifstream ins(in.c_str());
94 readDimacsMaxFlow(ins, G, s, t, cap);
97 std::cout << "SmartGraph..." << std::endl;
98 std::cout << "edmonds karp demo (physical blocking flow augmentation)..." << std::endl;
99 Graph::EdgeMap<int> flow(G); //0 flow
104 MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
106 while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) { ++i; }
108 std::cout << "elapsed time: " << ts << std::endl;
109 std::cout << "number of augmentation phases: " << i << std::endl;
110 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
114 std::cout << "edmonds karp demo (on-the-fly blocking flow augmentation)..." << std::endl;
115 Graph::EdgeMap<int> flow(G); //0 flow
120 MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
122 while (max_flow_test.augmentOnBlockingFlow2()) { ++i; }
124 std::cout << "elapsed time: " << ts << std::endl;
125 std::cout << "number of augmentation phases: " << i << std::endl;
126 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
130 std::cout << "edmonds karp demo (on-the-fly shortest path augmentation)..." << std::endl;
131 Graph::EdgeMap<int> flow(G); //0 flow
136 MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
138 while (max_flow_test.augmentOnShortestPath()) { ++i; }
140 std::cout << "elapsed time: " << ts << std::endl;
141 std::cout << "number of augmentation phases: " << i << std::endl;
142 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;