src/benchmark/bfs-bench.cc
changeset 804 6874a72dbdc5
parent 751 e742d383fffc
child 839 3edf35893a90
equal deleted inserted replaced
1:551cb93eb383 2:745b0956d6bb
    46   visited[source]=true;
    46   visited[source]=true;
    47   do {
    47   do {
    48     Node n(Q.front());
    48     Node n(Q.front());
    49     Node m;
    49     Node m;
    50     Q.pop();
    50     Q.pop();
    51     for(OutEdgeIt e(G,n);G.valid(e);G.next(e))
    51     for(OutEdgeIt e(G,n);e!=INVALID;++e)
    52       if(!visited[m=G.head(e)]) {
    52       if(!visited[m=G.head(e)]) {
    53 	Q.push(m);
    53 	Q.push(m);
    54 	visited.set(m,true);
    54 	visited.set(m,true);
    55       }
    55       }
    56   } while(!Q.empty());
    56   } while(!Q.empty());
    74   Q[Qh++]=source;
    74   Q[Qh++]=source;
    75   visited.set(source,true);
    75   visited.set(source,true);
    76   do {
    76   do {
    77     Node m;
    77     Node m;
    78     Node n=Q[Qt++];
    78     Node n=Q[Qt++];
    79     for(OutEdgeIt e(G,n);G.valid(e);G.next(e))
    79     for(OutEdgeIt e(G,n);e!=INVALID;++e)
    80       if(!visited[m=G.head(e)]) {
    80       if(!visited[m=G.head(e)]) {
    81 	Q[Qh++]=m;
    81 	Q[Qh++]=m;
    82 	visited.set(m,true);
    82 	visited.set(m,true);
    83       }
    83       }
    84   } while(Qt!=Qh);
    84   } while(Qt!=Qh);
    89 {
    89 {
    90   GRAPH_TYPEDEF_FACTORY(Graph);
    90   GRAPH_TYPEDEF_FACTORY(Graph);
    91 
    91 
    92   int i=0;
    92   int i=0;
    93   
    93   
    94   for(NodeIt n(G);G.valid(n);G.next(n))
    94   for(NodeIt n(G);n!=INVALID;++n)
    95     for(OutEdgeIt e(G,n);G.valid(e);G.next(e))
    95     for(OutEdgeIt e(G,n);e!=INVALID;++e)
    96       i++;
    96       i++;
    97 }
    97 }
    98 
    98 
    99 int main(int argc, char *argv[])
    99 int main(int argc, char *argv[])
   100 {
   100 {