Changeset 742:235fd36336b7 in lemon0.x for src/benchmark
 Timestamp:
 07/27/04 18:09:42 (17 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@999
 Location:
 src/benchmark
 Files:

 1 added
 4 edited
Legend:
 Unmodified
 Added
 Removed

src/benchmark/Makefile.am
r711 r742 1 1 AM_CPPFLAGS = I$(top_srcdir)/src I$(top_srcdir)/src/work I$(top_srcdir)/src/work/marci 2 2 3 noinst_PROGRAMS = graphbench hcube 3 noinst_PROGRAMS = graphbench hcube bfsbench 4 4 5 5 graph_bench_SOURCES = graphbench.cc bench_tools.h 6 6 7 7 hcube_SOURCES = hcube.cc bench_tools.h 8 9 bfs_bench_SOURCES = bfsbench.cc bench_tools.h 
src/benchmark/bench_tools.h
r718 r742 82 82 } 83 83 84 85 86 /// 87 template<class Graph> 88 void addHiperCube(Graph &G,int dim,std::vector<typename Graph::Node> &nodes) 89 { 90 GRAPH_TYPEDEF_FACTORY(Graph); 84 91 92 std::vector<int> bits(dim+1); 93 bits[0]=1; 94 for(int i=1;i<=dim;i++) bits[i]=2*bits[i1]; 95 96 for(int i=0;i<bits[dim];i++) { 97 nodes.push_back(G.addNode()); 98 for(int j=0;j<dim;j++) if(i&bits[j]) G.addEdge(nodes[ibits[j]],nodes[i]); 99 } 100 } 101 102 /// 103 template<class Graph> 104 void addBiDirHiperCube(Graph &G,int dim,std::vector<typename Graph::Node>&nodes) 105 { 106 GRAPH_TYPEDEF_FACTORY(Graph); 107 108 std::vector<int> bits(dim+1); 109 bits[0]=1; 110 for(int i=1;i<=dim;i++) bits[i]=2*bits[i1]; 111 112 for(int i=0;i<bits[dim];i++) { 113 nodes.push_back(G.addNode()); 114 for(int j=0;j<dim;j++) if(i&bits[j]) { 115 G.addEdge(nodes[ibits[j]],nodes[i]); 116 G.addEdge(nodes[i],nodes[ibits[j]]); 117 } 118 119 } 120 } 85 121 86 122 #endif 
src/benchmark/benchmark
r723 r742 4 4 { 5 5 echo $1 1>&2 6 for ((i=1;i<5;i++)) 6 $2 $3 $4 $5 $6 $7 $8 $9; 7 for ((i=1;i<=5;i++)) 7 8 do 8 9 $2 $3 $4 $5 $6 $7 $8 $9; 
src/benchmark/hcube.cc
r729 r742 11 11 using namespace std; 12 12 using namespace hugo; 13 14 template<class Graph>15 void addHiperCube(Graph &G,int dim,vector<typename Graph::Node> &nodes)16 {17 GRAPH_TYPEDEF_FACTORY(Graph);18 19 vector<int> bits(dim+1);20 bits[0]=1;21 for(int i=1;i<=dim;i++) bits[i]=2*bits[i1];22 23 for(int i=0;i<bits[dim];i++) {24 nodes.push_back(G.addNode());25 for(int j=0;j<dim;j++) if(i&bits[j]) G.addEdge(nodes[ibits[j]],nodes[i]);26 }27 }28 29 template<class Graph>30 void addBiDirHiperCube(Graph &G,int dim,vector<typename Graph::Node> &nodes)31 {32 GRAPH_TYPEDEF_FACTORY(Graph);33 34 vector<int> bits(dim+1);35 bits[0]=1;36 for(int i=1;i<=dim;i++) bits[i]=2*bits[i1];37 38 for(int i=0;i<bits[dim];i++) {39 nodes.push_back(G.addNode());40 for(int j=0;j<dim;j++) if(i&bits[j]) {41 G.addEdge(nodes[ibits[j]],nodes[i]);42 G.addEdge(nodes[i],nodes[ibits[j]]);43 }44 45 }46 }47 13 48 14 inline int numOfOnes(int n,int dim)
Note: See TracChangeset
for help on using the changeset viewer.