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

 1 edited
Legend:
 Unmodified
 Added
 Removed

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.