benchmark/bfs-bench.cc
changeset 1756 b1f441f24d08
parent 1689 f1795dafe42c
child 1847 7cbc12e42482
equal deleted inserted replaced
2:b9737a44ab87 3:5854b8c58626
    29 }
    29 }
    30 
    30 
    31 template<class Graph>
    31 template<class Graph>
    32 void bfsStlQueue(Graph &G,typename Graph::Node source)
    32 void bfsStlQueue(Graph &G,typename Graph::Node source)
    33 {
    33 {
    34   GRAPH_TYPEDEF_FACTORY(Graph);
    34   GRAPH_TYPEDEFS(typename Graph);
    35 
    35 
    36   using namespace std;
    36   using namespace std;
    37   
    37   
    38   typename Graph::template NodeMap<bool> visited(G,false);
    38   typename Graph::template NodeMap<bool> visited(G,false);
    39     
    39     
    54 }
    54 }
    55 
    55 
    56 template<class Graph>
    56 template<class Graph>
    57 void bfsOwnQueue(Graph &G,typename Graph::Node source)
    57 void bfsOwnQueue(Graph &G,typename Graph::Node source)
    58 {
    58 {
    59   GRAPH_TYPEDEF_FACTORY(Graph);
    59   GRAPH_TYPEDEFS(typename Graph);
    60 
    60 
    61   using namespace std;
    61   using namespace std;
    62   
    62   
    63   typename Graph::template NodeMap<bool> visited(G,false);
    63   typename Graph::template NodeMap<bool> visited(G,false);
    64   
    64   
    82 }
    82 }
    83 
    83 
    84 template<class Graph>
    84 template<class Graph>
    85 void iteratorBench(Graph &G)
    85 void iteratorBench(Graph &G)
    86 {
    86 {
    87   GRAPH_TYPEDEF_FACTORY(Graph);
    87   GRAPH_TYPEDEFS(typename Graph);
    88 
    88 
    89   int i=0;
    89   int i=0;
    90   
    90   
    91   for(NodeIt n(G);n!=INVALID;++n)
    91   for(NodeIt n(G);n!=INVALID;++n)
    92     for(OutEdgeIt e(G,n);e!=INVALID;++e)
    92     for(OutEdgeIt e(G,n);e!=INVALID;++e)
    95 
    95 
    96 int main(int argc, char *argv[])
    96 int main(int argc, char *argv[])
    97 {
    97 {
    98   typedef SmartGraph Graph;
    98   typedef SmartGraph Graph;
    99 
    99 
   100   ///\bug GRAPH_TYPEDEF_FACTORY(Graph);
   100   GRAPH_TYPEDEFS(Graph);
   101   GRAPH_TYPEDEF_FACTORY_NOTYPENAME(Graph);
       
   102 
   101 
   103   Graph G;
   102   Graph G;
   104   
   103   
   105   Timer T;
   104   Timer T;
   106   
   105