Changeset 751:e742d383fffc in lemon-0.x
- Timestamp:
- 08/04/04 20:51:51 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1011
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/benchmark/bfs-bench.cc
r742 r751 39 39 using namespace std; 40 40 41 typename Graph:: NodeMap<bool> visited(G,false);41 typename Graph::template NodeMap<bool> visited(G,false); 42 42 43 43 queue<typename Graph::Node> Q; … … 64 64 using namespace std; 65 65 66 typename Graph:: NodeMap<bool> visited(G,false);66 typename Graph::template NodeMap<bool> visited(G,false); 67 67 68 68 int N=G.nodeNum(); … … 85 85 } 86 86 87 template<class Graph> 88 void iteratorBench(Graph &G) 89 { 90 GRAPH_TYPEDEF_FACTORY(Graph); 91 92 int i=0; 93 94 for(NodeIt n(G);G.valid(n);G.next(n)) 95 for(OutEdgeIt e(G,n);G.valid(e);G.next(e)) 96 i++; 97 } 98 87 99 int main(int argc, char *argv[]) 88 100 { … … 97 109 Timer T; 98 110 99 if(argc!= 2) {100 cout << "Usage: " << argv[0] << " dim \n";111 if(argc!=3) { 112 cout << "Usage: " << argv[0] << " dim mul\n"; 101 113 return 1; 102 114 } 103 115 104 116 int dim=atoi(argv[1]); 117 int mul=atoi(argv[2]); 105 118 106 119 // cout << "Creating Hipercube ("<< (1<<dim) << " nodes, " … … 115 128 T.reset(); 116 129 { 117 for(int i=0;i< 50000;i++)130 for(int i=0;i<mul;i++) 118 131 bfsStlQueue(G,nodes[0]); 119 132 } … … 121 134 T.reset(); 122 135 { 123 for(int i=0;i< 50000;i++)136 for(int i=0;i<mul;i++) 124 137 bfsOwnQueue(G,nodes[0]); 125 138 } 126 139 PrintTime("BFS-OWN",T); 140 T.reset(); 141 { 142 for(int i=0;i<mul;i++) 143 iteratorBench(G); 144 } 145 PrintTime("ITERATE",T); 146 147 127 148 }
Note: See TracChangeset
for help on using the changeset viewer.