marci@73: #include marci@73: #include marci@73: marci@73: #include marci@73: #include marci@73: #include marci@73: #include marci@73: alpar@105: using namespace hugo; marci@73: marci@73: // Use a DIMACS max flow file as stdin. marci@73: // read_dimacs_demo < dimacs_max_flow_file marci@73: int main(int, char **) { marci@73: typedef ListGraph::NodeIt NodeIt; marci@73: typedef ListGraph::EachEdgeIt EachEdgeIt; marci@73: marci@73: ListGraph G; marci@73: NodeIt s, t; marci@73: ListGraph::EdgeMap cap(G); marci@73: readDimacsMaxFlow(std::cin, G, s, t, cap); marci@73: marci@100: /* marci@100: double pre_time_copy=currTime(); marci@100: ListGraph F; marci@100: ListGraph::NodeMap G_to_F(G); marci@100: typedef ListGraph::EachNodeIt EachNodeIt; marci@100: for(EachNodeIt n=G.first(); n.valid(); ++n) { marci@100: G_to_F.set(n, F.addNode()); marci@100: } marci@100: for(EachEdgeIt e=G.first(); e.valid(); ++e) { marci@100: F.addEdge(G_to_F.get(G.tail(e)), G_to_F.get(G.head(e))); marci@100: } marci@100: double post_time_copy=currTime(); marci@100: std::cout << "copy time: " << post_time_copy-pre_time_copy << " sec"<< std::endl; marci@100: */ marci@100: marci@73: std::cout << "edmonds karp demo..." << std::endl; marci@73: ListGraph::EdgeMap flow(G); //0 flow marci@73: marci@73: double pre_time=currTime(); marci@73: MaxFlow, ListGraph::EdgeMap > max_flow_test(G, s, t, flow, cap); marci@100: max_flow_test.augmentWithBlockingFlow(); marci@73: max_flow_test.run(); marci@73: double post_time=currTime(); marci@73: //std::cout << "maximum flow: "<< std::endl; marci@73: //for(EachEdgeIt e=G.first(); e.valid(); ++e) { marci@73: // std::cout<<"("<"<