Specialized ConstMap for defining constant maps at compile time, by klao.
Time comparision of the generic and specialized maps.
3 // Use a DIMACS max flow file as follows:
4 // graph_wrapper_time dimacs_max_flow_file
10 #include <hugo/invalid.h>
11 #include <hugo/time_measure.h>
12 #include <hugo/graph_wrapper.h>
13 #include <hugo/preflow.h>
14 #include <hugo/dimacs.h>
15 #include <hugo/list_graph.h>
22 template<typename Graph>
23 void timeTest(std::string str, Graph& g) {
25 typename Graph::Node s;
26 typename Graph::Node t;
27 typedef typename Graph::template EdgeMap<int> FlowMap;
30 std::ifstream is(str.c_str());
31 readDimacs(is, g, cap, s, t);
35 typedef Preflow<Graph, int, FlowMap, FlowMap> MyPreflow;
36 MyPreflow max_flow(g, s, t, cap, flow);
37 max_flow.run(MyPreflow::NO_FLOW);
38 cout << "flow value: " << max_flow.flowValue() << endl;
42 int main(int, char** argv) {
43 std::string in=argv[1];
45 typedef ListGraph Graph;
47 timeTest<Graph>(in, g);
48 typedef GraphWrapper<Graph> Graph1;
50 timeTest<Graph1>(in, g1);
51 typedef GraphWrapper<Graph1> Graph2;
53 timeTest<Graph2>(in, g2);
54 typedef GraphWrapper<Graph2> Graph3;
56 timeTest<Graph3>(in, g3);
57 typedef GraphWrapper<Graph3> Graph4;
59 timeTest<Graph4>(in, g4);
60 typedef GraphWrapper<Graph4> Graph5;
62 timeTest<Graph5>(in, g5);
63 typedef GraphWrapper<Graph5> Graph6;
65 timeTest<Graph6>(in, g6);
66 typedef GraphWrapper<Graph6> Graph7;
68 timeTest<Graph7>(in, g7);