4 #include<lemon/list_graph.h>
5 #include<lemon/smart_graph.h>
6 #include<lemon/dijkstra.h>
7 #include<lemon/preflow.h>
9 #include"bench_tools.h"
12 using namespace lemon;
14 inline int numOfOnes(int n,int dim)
17 for(int i=0;i<dim;i++) {
24 inline int numOfZeros(int n,int dim)
27 for(int i=0;i<dim;i++) {
34 int main(int argc, char *argv[])
36 // typedef ListGraph Graph;
37 typedef SmartGraph Graph;
39 GRAPH_TYPEDEFS(Graph);
46 cout << "Usage: " << argv[0] << " dim\n";
50 int dim=atoi(argv[1]);
52 // cout << "Creating Hipercube ("<< (1<<dim) << " nodes, "
53 // << dim*(1<<dim) << " edges):";
57 addBiDirHyperCube(G,dim,nodes);
59 PrintTime("GENGRAPH",T);
62 Graph::EdgeMap<int> map(G);
63 for(int i=0;i<5;i++) {
65 for(int i=0;i<dim*(1<<dim);i++) P();
67 // for(EdgeIt e(G);G.valid(e);G.next(e)) map[e]=P();
69 ///\todo It must have been commented out because of
72 // for(int i=0;i<dim*(1<<dim);i++) {
73 // te.setToId(((long long int)(i)*93505)%(dim*(1<<dim)));
74 // // map[Edge(((long long int)(i)*2987)%(dim*(1<<dim)))]=P();
78 // for(int i=0;i<(1<<dim);i++) {
79 // int mul= (1<<(numOfZeros(i,dim)/4));
80 // for(OutEdgeIt e(G,nodes[i]);G.valid(e);G.next(e))
85 PrintTime("GENLENGTHS",T);
89 Dijkstra<Graph> Dij(G,map);
93 PrintTime("DIJKSTRA",T);
97 Graph::EdgeMap<int> flow(G);
99 Preflow<Graph,int> MF(G,nodes[0],nodes[1<<dim-1],map,flow);
100 for(int i=0;i<10;i++)
103 PrintTime("PREFLOW",T);