marci@82: #include <iostream>
marci@82: #include <fstream>
marci@82: 
marci@82: #include <list_graph.hh>
marci@82: #include <dimacs.hh>
marci@82: #include <preflow_push.hh>
marci@82: #include <time_measure.h>
marci@82: 
alpar@105: using namespace hugo;
marci@82: 
marci@82: // Use a DIMACS max flow file as stdin.
marci@82: // read_dimacs_demo < dimacs_max_flow_file
marci@82: int main(int, char **) {
marci@82:   typedef ListGraph::NodeIt NodeIt;
marci@82:   typedef ListGraph::EachEdgeIt EachEdgeIt;
marci@82: 
marci@82:   ListGraph G;
marci@82:   NodeIt s, t;
marci@82:   ListGraph::EdgeMap<int> cap(G);
marci@82:   readDimacsMaxFlow(std::cin, G, s, t, cap);
marci@82: 
marci@82:   std::cout << "preflow demo (ATHOS)..." << std::endl;
marci@82:   //ListGraph::EdgeMap<int> flow(G); //0 flow
marci@82: 
marci@82:   double pre_time=currTime();
marci@82:   preflow_push<ListGraph, int> max_flow_test(G, s, t, cap);
marci@82:   int flow_value=max_flow_test.run();
marci@82:   //ListGraph::NodeMap<bool> cut=max_flow_test.mincut();
marci@82:   //int cut_value=0;
marci@82:   //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
marci@82:   //  if (cut.get(G.tail(e)) && !cut.get(G.head(e))) cut_value+=cap.get(e);
marci@82:   //}
marci@82:   double post_time=currTime();
marci@82:   //std::cout << "maximum flow: "<< std::endl;
marci@82:   //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) { 
marci@82:   //  std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
marci@82:   //}
marci@82:   //std::cout<<std::endl;
marci@82:   std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl; 
marci@82:   std::cout << "flow value: "<< flow_value << std::endl;
marci@82:   //std::cout << "cut value: "<< cut_value << std::endl;
marci@82: 
marci@82:   return 0;
marci@82: }