alpar@708: // -*- mode:C++ -*- alpar@708: alpar@708: #include alpar@708: #include alpar@708: #include alpar@708: #include alpar@718: #include<../work/jacint/max_flow_no_stack.h> alpar@711: #include"bench_tools.h" alpar@708: alpar@708: using namespace std; alpar@708: using namespace hugo; alpar@708: alpar@708: template alpar@708: void addHiperCube(Graph &G,int dim,vector &nodes) alpar@708: { alpar@708: GRAPH_TYPEDEF_FACTORY(Graph); alpar@708: alpar@708: vector bits(dim+1); alpar@708: bits[0]=1; alpar@708: for(int i=1;i<=dim;i++) bits[i]=2*bits[i-1]; alpar@708: alpar@708: for(int i=0;i alpar@708: void addBiDirHiperCube(Graph &G,int dim,vector &nodes) alpar@708: { alpar@708: GRAPH_TYPEDEF_FACTORY(Graph); alpar@708: alpar@708: vector bits(dim+1); alpar@708: bits[0]=1; alpar@708: for(int i=1;i<=dim;i++) bits[i]=2*bits[i-1]; alpar@708: alpar@708: for(int i=0;i>=1; alpar@718: } alpar@718: return s; alpar@718: } alpar@718: alpar@718: inline int numOfZeros(int n,int dim) alpar@718: { alpar@718: int s=dim; alpar@718: for(int i=0;i>=1; alpar@718: } alpar@718: return s; alpar@718: } alpar@718: alpar@708: int main(int argc, char *argv[]) alpar@708: { alpar@708: // typedef ListGraph Graph; alpar@708: typedef SmartGraph Graph; alpar@708: alpar@708: ///\bug GRAPH_TYPEDEF_FACTORY(Graph); alpar@708: GRAPH_TYPEDEF_FACTORY_NOTYPENAME(Graph); alpar@708: alpar@708: Graph G; alpar@708: alpar@708: Timer T; alpar@708: alpar@708: if(argc!=2) { alpar@708: cout << "Usage: " << argv[0] << " dim\n"; alpar@708: return 1; alpar@708: } alpar@708: alpar@708: int dim=atoi(argv[1]); alpar@708: alpar@718: // cout << "Creating Hipercube ("<< (1< nodes; alpar@708: addBiDirHiperCube(G,dim,nodes); alpar@718: alpar@718: PrintTime("GENGRAPH",T); alpar@718: alpar@708: T.reset(); alpar@708: Graph::EdgeMap map(G); alpar@708: { alpar@708: Primes P; alpar@708: for(int i=0;i Dij(G,map); alpar@708: Dij.run(nodes[0]); alpar@708: } alpar@718: PrintTime("DIJKSTRA",T); alpar@718: alpar@718: T.reset(); alpar@718: { alpar@718: Graph::EdgeMap flow(G); alpar@708: alpar@718: MaxFlowNoStack MF(G,nodes[0],nodes[1<