marci@82: #include marci@82: #include marci@82: marci@82: #include marci@82: #include marci@82: #include marci@87: #include marci@82: #include marci@82: alpar@921: using namespace lemon; 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 cap(G); marci@82: readDimacsMaxFlow(std::cin, G, s, t, cap); marci@82: marci@87: { marci@87: std::cout << "preflow demo (preflow_push_max_flow by JACINT)..." << std::endl; marci@82: //ListGraph::EdgeMap flow(G); //0 flow marci@82: marci@82: double pre_time=currTime(); marci@82: preflow_push_max_flow max_flow_test(G, s, t, cap); marci@82: max_flow_test.run(); marci@100: ListGraph::NodeMap cut(G); marci@100: max_flow_test.mincut(cut); marci@82: int cut_value=0; marci@82: for(EachEdgeIt e=G.first(); e.valid(); ++e) { alpar@986: if (cut.get(G.source(e)) && !cut.get(G.target(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(); e.valid(); ++e) { alpar@986: // std::cout<<"("<"< flow(G); //0 flow marci@87: marci@87: double pre_time=currTime(); marci@87: preflow_push_hl max_flow_test(G, s, t, cap); marci@87: max_flow_test.run(); marci@100: ListGraph::NodeMap cut(G); marci@100: max_flow_test.mincut(cut); marci@87: int cut_value=0; marci@87: for(EachEdgeIt e=G.first(); e.valid(); ++e) { alpar@986: if (cut.get(G.source(e)) && !cut.get(G.target(e))) cut_value+=cap.get(e); marci@87: } marci@87: double post_time=currTime(); marci@87: //std::cout << "maximum flow: "<< std::endl; marci@87: //for(EachEdgeIt e=G.first(); e.valid(); ++e) { alpar@986: // std::cout<<"("<"<