// -*- c++ -*- // Use a DIMACS max flow file as follows: // graph_wrapper_time dimacs_max_flow_file #include #include #include #include #include #include #include #include #include #include using namespace lemon; using std::cout; using std::endl; template void timeTest(std::string str, Graph& g) { g.clear(); typename Graph::Node s; typename Graph::Node t; typedef typename Graph::template EdgeMap FlowMap; FlowMap cap(g); FlowMap flow(g); std::ifstream is(str.c_str()); readDimacs(is, g, cap, s, t); Timer ts; ts.reset(); typedef Preflow MyPreflow; MyPreflow max_flow(g, s, t, cap, flow); max_flow.run(MyPreflow::NO_FLOW); cout << "flow value: " << max_flow.flowValue() << endl; cout << ts << endl; } int main(int, char** argv) { std::string in=argv[1]; typedef ListGraph Graph; Graph g; timeTest(in, g); typedef GraphWrapper Graph1; Graph1 g1(g); timeTest(in, g1); typedef GraphWrapper Graph2; Graph2 g2(g1); timeTest(in, g2); typedef GraphWrapper Graph3; Graph3 g3(g2); timeTest(in, g3); typedef GraphWrapper Graph4; Graph4 g4(g3); timeTest(in, g4); typedef GraphWrapper Graph5; Graph5 g5(g4); timeTest(in, g5); typedef GraphWrapper Graph6; Graph6 g6(g5); timeTest(in, g6); typedef GraphWrapper Graph7; Graph7 g7(g6); timeTest(in, g7); return 0; }