1 #include"edge_lookup_test.h"
2 #include<lemon/smart_graph.h>
4 #include<lemon/time_measure.h>
5 #include<lemon/random.h>
9 GRAPH_TYPEDEFS(SmartGraph)
10 typedef SmartGraph Graph;
16 FE(Graph &g) :_g(g) {}
21 for(NodeIt v(_g);v!=INVALID;++v)
22 for(NodeIt u(_g);u!=INVALID;++u)
32 EdgeLookUp<Graph> _el;
33 EL(Graph &g) :_g(g), _el(g) {}
38 for(NodeIt v(_g);v!=INVALID;++v)
39 for(NodeIt u(_g);u!=INVALID;++u)
48 EdgeLookUp2<Graph> _el;
49 EL2(Graph &g) :_g(g), _el(g) {}
54 for(NodeIt v(_g);v!=INVALID;++v)
55 for(NodeIt u(_g);u!=INVALID;++u)
65 EdgeLookUp3<Graph> _el;
66 EL3(Graph &g) :_g(g), _el(g) {}
71 for(NodeIt v(_g);v!=INVALID;++v)
72 for(NodeIt u(_g);u!=INVALID;++u)
82 EdgeLookUp4<Graph> _el;
83 EL4(Graph &g) :_g(g), _el(g) {}
88 for(NodeIt v(_g);v!=INVALID;++v)
89 for(NodeIt u(_g);u!=INVALID;++u)
95 int main(int, char**argv)
98 int M=int(N*atof(argv[2]));
103 for(int i=0;i<N;i++) v.push_back(g.addNode());
104 for(int i=0;i<M;i++) g.addEdge(v[rnd[N]],v[rnd[N]]);
109 // TimeReport t("findEdge: ");
110 // for(NodeIt u(g);u!=INVALID;++u)
111 // for(NodeIt v(g);v!=INVALID;++v)
112 // e=findEdge(g,u,v);
116 // EdgeLookUp<Graph> el(g);
118 // TimeReport t("EdgeLookUp: ");
119 // for(NodeIt u(g);u!=INVALID;++u)
120 // for(NodeIt v(g);v!=INVALID;++v)
125 TimeStamp t1 = runningTimeTest(FE(g),1);
126 TimeStamp t2 = runningTimeTest(EL(g),1);
127 TimeStamp t3 = runningTimeTest(EL2(g),1);
128 TimeStamp t4 = runningTimeTest(EL3(g),1);
129 // TimeStamp t5 = runningTimeTest(EL4(g),1);
131 std::cout << t1.userTime()/N/N << ' '
132 << t2.userTime()/N/N << ' '
133 << t3.userTime()/N/N << ' '
134 << t4.userTime()/N/N << ' '
135 // << t5.userTime()/N/N