# HG changeset patch # User alpar # Date 1090243907 0 # Node ID 429dfcbbf47d4e7b402d99cf2cab33d5fcdc73fe # Parent ec034cfade65b98641cdfb2994d2cb6fe7fe8728 A new benchmark (hcube) and other minor changes diff -r ec034cfade65 -r 429dfcbbf47d src/benchmark/Makefile.am --- a/src/benchmark/Makefile.am Mon Jul 19 13:30:20 2004 +0000 +++ b/src/benchmark/Makefile.am Mon Jul 19 13:31:47 2004 +0000 @@ -1,5 +1,7 @@ -AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/work +AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/work -I$(top_srcdir)/src/work/marci -noinst_PROGRAMS = graph-bench +noinst_PROGRAMS = graph-bench hcube graph_bench_SOURCES = graph-bench.cc + +hcube_SOURCES = hcube.cc diff -r ec034cfade65 -r 429dfcbbf47d src/benchmark/graph-bench.cc --- a/src/benchmark/graph-bench.cc Mon Jul 19 13:30:20 2004 +0000 +++ b/src/benchmark/graph-bench.cc Mon Jul 19 13:31:47 2004 +0000 @@ -3,6 +3,7 @@ #include #include #include +#include using namespace hugo; @@ -48,10 +49,12 @@ Graph G; - Node nodes[n]; + // Node nodes[n]; + std::vector nodes(n); for(int i=0;i equ(rat); unsigned long long int count; 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<