nem hekkelunk.
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
13 int main(int, char **) {
14 typedef ListGraph::NodeIt NodeIt;
15 typedef ListGraph::EachEdgeIt EachEdgeIt;
19 ListGraph::EdgeMap<int> cap(G);
20 readDimacsMaxFlow(std::cin, G, s, t, cap);
23 std::cout << "edmonds karp demo (blocking flow augmentation)..." << std::endl;
24 ListGraph::EdgeMap<int> flow(G); //0 flow
26 double pre_time=currTime();
27 MaxFlow<ListGraph, int, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
28 //max_flow_test.augmentWithBlockingFlow<ListGraph>();
29 max_flow_test.run<ListGraph>();
30 double post_time=currTime();
32 //std::cout << "maximum flow: "<< std::endl;
33 //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
34 // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
36 //std::cout<<std::endl;
37 std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl;
38 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
42 std::cout << "edmonds karp demo (shortest path augmentation)..." << std::endl;
43 ListGraph::EdgeMap<int> flow(G); //0 flow
45 double pre_time=currTime();
46 MaxFlow<ListGraph, int, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
47 //max_flow_test.augmentWithBlockingFlow<ListGraph>();
49 double post_time=currTime();
51 //std::cout << "maximum flow: "<< std::endl;
52 //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
53 // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
55 //std::cout<<std::endl;
56 std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl;
57 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;