src/work/marci/bfsit_vs_byhand.cc
changeset 870 9bde6cd8e3da
parent 773 ce9438c5a82d
child 921 818510fa3d99
equal deleted inserted replaced
10:58aba821eb26 11:54e8d6e1b448
    31   g.first(s);
    31   g.first(s);
    32 
    32 
    33   cout << g.nodeNum() << endl;
    33   cout << g.nodeNum() << endl;
    34   cout << g.edgeNum() << endl;
    34   cout << g.edgeNum() << endl;
    35 
    35 
    36   Graph::NodeMap<OutEdgeIt> pred(g);
    36   Graph::NodeMap<Edge> pred(g);
    37   cout << "iteration time of bfs written by hand..." << endl;
    37   cout << "iteration time of bfs written by hand..." << endl;
    38   Timer ts;
    38   Timer ts;
    39   {
    39   {
    40     ts.reset();
    40     ts.reset();
    41     Graph::NodeMap<bool> reached(g);
    41     Graph::NodeMap<bool> reached(g);
    67     bfs.pushAndSetReached(s);
    67     bfs.pushAndSetReached(s);
    68     pred.set(s, INVALID);
    68     pred.set(s, INVALID);
    69     while (!bfs.finished()) { 
    69     while (!bfs.finished()) { 
    70       ++bfs; 
    70       ++bfs; 
    71       if (g.valid(bfs) && bfs.isBNodeNewlyReached()) 
    71       if (g.valid(bfs) && bfs.isBNodeNewlyReached()) 
    72 	pred.set(bfs.bNode(), bfs);
    72 	pred.set(bfs.head(), Graph::Edge(bfs));
    73     }
    73     }
    74     std::cout << ts << std::endl;
    74     std::cout << ts << std::endl;
    75   }
    75   }
    76 
    76 
    77   return 0;
    77   return 0;