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