1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/work/alpar/f_ed_ka_demo.cc Mon Feb 16 10:57:01 2004 +0000
1.3 @@ -0,0 +1,39 @@
1.4 +#include <iostream>
1.5 +#include <fstream>
1.6 +
1.7 +#include "../list_graph.hh"
1.8 +#include "../marci/dimacs.hh"
1.9 +#include "f_ed_ka.h"
1.10 +#include "../marci/time_measure.h"
1.11 +
1.12 +using namespace marci;
1.13 +
1.14 +// Use a DIMACS max flow file as stdin.
1.15 +// read_dimacs_demo < dimacs_max_flow_file
1.16 +
1.17 +int main(int, char **) {
1.18 + typedef ListGraph::NodeIt NodeIt;
1.19 + typedef ListGraph::EachEdgeIt EachEdgeIt;
1.20 +
1.21 + ListGraph G;
1.22 + NodeIt s, t;
1.23 + ListGraph::EdgeMap<int> cap(G);
1.24 + readDimacsMaxFlow(std::cin, G, s, t, cap);
1.25 +
1.26 + std::cout << "edmonds karp demo..." << std::endl;
1.27 + ListGraph::EdgeMap<int> flow(G); //0 flow
1.28 +
1.29 + int ret;
1.30 + double pre_time=currTime();
1.31 + ret = maxFlow(G,flow,cap,s,t);
1.32 + double post_time=currTime();
1.33 + //std::cout << "maximum flow: "<< std::endl;
1.34 + //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
1.35 + // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
1.36 + //}
1.37 + //std::cout<<std::endl;
1.38 + std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl;
1.39 + std::cout << "flow value: "<< ret << std::endl;
1.40 +
1.41 + return 0;
1.42 +}