Some warining fix in maps.
4 #include<hugo/list_graph.h>
5 #include<hugo/smart_graph.h>
6 #include<hugo/dijkstra.h>
7 #include<hugo/max_flow.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++) {
35 void bfsStlQueue(Graph &G,typename Graph::Node source)
37 GRAPH_TYPEDEF_FACTORY(Graph);
41 typename Graph::template NodeMap<bool> visited(G,false);
43 queue<typename Graph::Node> Q;
51 for(OutEdgeIt e(G,n);e!=INVALID;++e)
52 if(!visited[m=G.head(e)]) {
60 void bfsOwnQueue(Graph &G,typename Graph::Node source)
62 GRAPH_TYPEDEF_FACTORY(Graph);
66 typename Graph::template NodeMap<bool> visited(G,false);
69 vector<typename Graph::Node> Q(N);
75 visited.set(source,true);
79 for(OutEdgeIt e(G,n);e!=INVALID;++e)
80 if(!visited[m=G.head(e)]) {
88 void iteratorBench(Graph &G)
90 GRAPH_TYPEDEF_FACTORY(Graph);
94 for(NodeIt n(G);n!=INVALID;++n)
95 for(OutEdgeIt e(G,n);e!=INVALID;++e)
99 int main(int argc, char *argv[])
101 // typedef ListGraph Graph;
102 typedef SmartGraph Graph;
104 ///\bug GRAPH_TYPEDEF_FACTORY(Graph);
105 GRAPH_TYPEDEF_FACTORY_NOTYPENAME(Graph);
112 cout << "Usage: " << argv[0] << " dim mul\n";
116 int dim=atoi(argv[1]);
117 int mul=atoi(argv[2]);
119 // cout << "Creating Hipercube ("<< (1<<dim) << " nodes, "
120 // << dim*(1<<dim) << " edges):";
124 addBiDirHiperCube(G,dim,nodes);
126 PrintTime("GENGRAPH",T);
130 for(int i=0;i<mul;i++)
131 bfsStlQueue(G,nodes[0]);
133 PrintTime("BFS-STL",T);
136 for(int i=0;i<mul;i++)
137 bfsOwnQueue(G,nodes[0]);
139 PrintTime("BFS-OWN",T);
142 for(int i=0;i<mul;i++)
145 PrintTime("ITERATE",T);