.
4 #include <list_graph.hh>
6 #include <preflow_max_flow.h>
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;
16 typedef ListGraph::EachNodeIt EachNodeIt;
20 ListGraph::EdgeMap<int> cap(G);
21 readDimacsMaxFlow(std::cin, G, s, t, cap);
23 std::cout << "preflow_max_flow demo ..." << std::endl;
25 double pre_time=currTime();
26 preflow_max_flow<ListGraph, int> max_flow_test(G, s, t, cap);
27 ListGraph::NodeMap<bool> cut=max_flow_test.minCut();
28 double post_time=currTime();
31 for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
32 if (cut.get(G.tail(e)) && !cut.get(G.head(e))) cut_value+=cap.get(e);
35 std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl;
36 std::cout << "flow value: "<< max_flow_test.maxFlow() << std::endl;
37 std::cout << "cut value: "<< cut_value << std::endl;