Line | |
---|
1 | #include <iostream> |
---|
2 | #include <fstream> |
---|
3 | |
---|
4 | #include "../list_graph.hh" |
---|
5 | #include "../marci/dimacs.hh" |
---|
6 | #include "f_ed_ka.h" |
---|
7 | #include "../marci/time_measure.h" |
---|
8 | |
---|
9 | using namespace marci; |
---|
10 | |
---|
11 | // Use a DIMACS max flow file as stdin. |
---|
12 | // read_dimacs_demo < dimacs_max_flow_file |
---|
13 | |
---|
14 | int main(int, char **) { |
---|
15 | typedef ListGraph::NodeIt NodeIt; |
---|
16 | typedef ListGraph::EachEdgeIt EachEdgeIt; |
---|
17 | |
---|
18 | ListGraph G; |
---|
19 | NodeIt s, t; |
---|
20 | ListGraph::EdgeMap<int> cap(G); |
---|
21 | readDimacsMaxFlow(std::cin, G, s, t, cap); |
---|
22 | |
---|
23 | std::cout << "edmonds karp demo..." << std::endl; |
---|
24 | ListGraph::EdgeMap<int> flow(G); //0 flow |
---|
25 | |
---|
26 | int ret; |
---|
27 | double pre_time=currTime(); |
---|
28 | ret = maxFlow(G,flow,cap,s,t); |
---|
29 | double post_time=currTime(); |
---|
30 | //std::cout << "maximum flow: "<< std::endl; |
---|
31 | //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) { |
---|
32 | // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") "; |
---|
33 | //} |
---|
34 | //std::cout<<std::endl; |
---|
35 | std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl; |
---|
36 | std::cout << "flow value: "<< ret << std::endl; |
---|
37 | |
---|
38 | return 0; |
---|
39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.