diff -r ec034cfade65 -r 429dfcbbf47d src/benchmark/hcube.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/benchmark/hcube.cc Mon Jul 19 13:31:47 2004 +0000 @@ -0,0 +1,149 @@ +// -*- mode:C++ -*- + +#include +#include +#include +#include +#include +#include +#include<../work/jacint/max_flow.h> + +using namespace std; +using namespace hugo; + +///An experimental typedef factory +#define GRAPH_TYPEDEF_FACTORY(Graph) \ + typedef typename Graph:: Node Node;\ + typedef typename Graph:: NodeIt NodeIn;\ + typedef typename Graph:: Edge Edge;\ + typedef typename Graph:: EdgeIt EdgeIt;\ + typedef typename Graph:: InEdgeIt InEdgeIt;\ + typedef typename Graph::OutEdgeIt OutEdgeIt; + +#define GRAPH_TYPEDEF_FACTORY_NOTYPENAME(Graph) \ + typedef Graph:: Node Node;\ + typedef Graph:: NodeIt NodeIn;\ + typedef Graph:: Edge Edge;\ + typedef Graph:: EdgeIt EdgeIt;\ + typedef Graph:: InEdgeIt InEdgeIt;\ + typedef Graph::OutEdgeIt OutEdgeIt; + + +class Primes +{ + vector primes; + int n; + + bool isPrime(int m) + { + for(int i=0;m +void addHiperCube(Graph &G,int dim,vector &nodes) +{ + GRAPH_TYPEDEF_FACTORY(Graph); + + vector bits(dim+1); + bits[0]=1; + for(int i=1;i<=dim;i++) bits[i]=2*bits[i-1]; + + for(int i=0;i +void addBiDirHiperCube(Graph &G,int dim,vector &nodes) +{ + GRAPH_TYPEDEF_FACTORY(Graph); + + vector bits(dim+1); + bits[0]=1; + for(int i=1;i<=dim;i++) bits[i]=2*bits[i-1]; + + for(int i=0;i nodes; + addBiDirHiperCube(G,dim,nodes); + cout << T; + cout << "\nGenerating the lengths: "; + T.reset(); + Graph::EdgeMap map(G); + { + Primes P; + for(int i=0;i Dij(G,map); + Dij.run(nodes[0]); + } + cout << T; +// cout << "\nRunning MaxFlow: "; +// T.reset(); +// { +// Graph::EdgeMap flow(G); + +// MaxFlow MF(G,nodes[0],nodes[1<