// Use a DIMACS max flow file as stdin. // const_map_time < dimacs_max_flow_file #include #include #include #include #include #include using namespace lemon; int main() { typedef SmartGraph Graph; typedef Graph::Node Node; typedef Graph::Edge Edge; typedef Graph::EdgeIt EdgeIt; Graph g; Node s, t; NullMap cap; readDimacs(std::cin, g, cap, s, t); //typedef ConstMap > CN1; CN1 cn1; typedef ConstMap CN1; CN1 cn1; typedef ConstMap CN2; CN2 cn2(true); // typedef ConstMap > CE1; CE1 ce1; typedef ConstMap CE1; CE1 ce1; typedef ConstMap CE2; CE2 ce2(true); typedef SubGraphWrapper SB1; SB1 sb1(g, cn1, ce1); typedef SubGraphWrapper SB2; SB2 sb2(g, cn2, ce2); Timer ts; cout << "specialized (compile-time) const map time:" << endl; ts.reset(); for (SB1::NodeIt n(sb1); n!=INVALID; ++n) for (SB1::EdgeIt e(sb1); e!=INVALID; ++e) { } cout << ts << endl; ts.reset(); cout << "generic const map time:" << endl; for (SB2::NodeIt n(sb2); n!=INVALID; ++n) for (SB2::EdgeIt e(sb2); e!=INVALID; ++e) { } cout << ts << endl; return 0; }