Change MaxFlow to Preflow.
4 #include<hugo/list_graph.h>
5 #include<hugo/smart_graph.h>
6 #include<hugo/dijkstra.h>
7 #include<hugo/preflow.h>
9 #include"bench_tools.h"
14 inline int numOfOnes(int n,int dim)
17 for(int i=0;i<dim;i++) {
24 inline int numOfZeros(int n,int dim)
27 for(int i=0;i<dim;i++) {
34 int main(int argc, char *argv[])
36 // typedef ListGraph Graph;
37 typedef SmartGraph Graph;
39 ///\bug GRAPH_TYPEDEF_FACTORY(Graph);
40 GRAPH_TYPEDEF_FACTORY_NOTYPENAME(Graph);
47 cout << "Usage: " << argv[0] << " dim\n";
51 int dim=atoi(argv[1]);
53 // cout << "Creating Hipercube ("<< (1<<dim) << " nodes, "
54 // << dim*(1<<dim) << " edges):";
58 addBiDirHiperCube(G,dim,nodes);
60 PrintTime("GENGRAPH",T);
63 Graph::EdgeMap<int> map(G);
64 for(int i=0;i<5;i++) {
66 for(int i=0;i<dim*(1<<dim);i++) P();
68 // for(EdgeIt e(G);G.valid(e);G.next(e)) map[e]=P();
69 for(int i=0;i<dim*(1<<dim);i++)
70 // map[Edge(((long long int)(i)*2987)%(dim*(1<<dim)))]=P();
71 map[Edge(((long long int)(i)*93505)%(dim*(1<<dim)))]=P();
73 // for(int i=0;i<(1<<dim);i++) {
74 // int mul= (1<<(numOfZeros(i,dim)/4));
75 // for(OutEdgeIt e(G,nodes[i]);G.valid(e);G.next(e))
80 PrintTime("GENLENGTHS",T);
84 Dijkstra<Graph> Dij(G,map);
88 PrintTime("DIJKSTRA",T);
92 Graph::EdgeMap<int> flow(G);
94 Preflow<Graph,int> MF(G,nodes[0],nodes[1<<dim-1],map,flow);
98 PrintTime("PREFLOW",T);