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

 1 edited
Legend:
 Unmodified
 Added
 Removed

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
Note: See TracChangeset
for help on using the changeset viewer.