G.next(...), G.valid(...), ...
4 #include <list_graph.hh>
6 #include <edmonds_karp.hh>
7 #include <time_measure.h>
11 // Use a DIMACS max flow file as stdin.
12 // read_dimacs_demo < dimacs_max_flow_file
30 int main(int, char **) {
31 typedef ListGraph::NodeIt NodeIt;
32 typedef ListGraph::EachEdgeIt EachEdgeIt;
40 std::cout << &zize << " " << sizeof(mize) << sizeof(Tize) << std::endl;
41 std::cout << sizeof(bize) << std::endl;
45 std::cout << sizeof(k) << std::endl;
53 std::cout << sizeof(Bumm) << std::endl;
58 ListGraph::EdgeMap<int> cap(G);
59 readDimacsMaxFlow(std::cin, G, s, t, cap);
62 std::cout << "edmonds karp demo (blocking flow augmentation)..." << std::endl;
63 ListGraph::EdgeMap<int> flow(G); //0 flow
67 //double pre_time=currTime();
68 MaxFlow<ListGraph, int, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
69 //max_flow_test.augmentWithBlockingFlow<ListGraph>();
71 while (max_flow_test.augmentOnBlockingFlow<ListGraph>()) { ++i; }
72 //double post_time=currTime();
74 //std::cout << "maximum flow: "<< std::endl;
75 //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
76 // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
78 //std::cout<<std::endl;
79 std::cout << "elapsed time: " << ts << std::endl;
80 std::cout << "number of augmentation phases: " << i << std::endl;
81 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
85 std::cout << "edmonds karp demo (shortest path augmentation)..." << std::endl;
86 ListGraph::EdgeMap<int> flow(G); //0 flow
90 //double pre_time=currTime();
91 MaxFlow<ListGraph, int, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
92 //max_flow_test.augmentWithBlockingFlow<ListGraph>();
94 while (max_flow_test.augmentOnShortestPath()) { ++i; }
95 //double post_time=currTime();
97 //std::cout << "maximum flow: "<< std::endl;
98 //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
99 // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
101 //std::cout<<std::endl;
102 std::cout << "elapsed time: " << ts << std::endl;
103 std::cout << "number of augmentation phases: " << i << std::endl;
104 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;