5 #include <sage_graph.h>
6 #include <hugo/smart_graph.h>
7 #include <hugo/dimacs.h>
8 #include <hugo/time_measure.h>
9 //#include <hugo/for_each_macros.h>
18 typedef SageGraph Graph;
19 typedef Graph::Node Node;
20 typedef Graph::NodeIt NodeIt;
21 typedef Graph::Edge Edge;
22 typedef Graph::EdgeIt EdgeIt;
23 typedef Graph::OutEdgeIt OutEdgeIt;
27 //Graph::EdgeMap<int> cap(g);
28 //readDimacsMaxFlow(std::cin, g, s, t, cap);
29 readDimacs(std::cin, g);
33 cout << g.nodeNum() << endl;
34 cout << g.edgeNum() << endl;
36 Graph::NodeMap<Edge> pred(g);
37 cout << "iteration time of bfs written by hand..." << endl;
41 Graph::NodeMap<bool> reached(g);
44 std::queue<Node> bfs_queue;
46 while (!bfs_queue.empty()) {
47 Node v=bfs_queue.front();
50 for(g.first(e,v); g.valid(e); g.next(e)) {
60 std::cout << ts << std::endl;
63 cout << "iteration time with bfs iterator..." << endl;
66 BfsIterator< Graph, Graph::NodeMap<bool> > bfs(g);
67 bfs.pushAndSetReached(s);
69 while (!bfs.finished()) {
71 if (g.valid(bfs) && bfs.isBNodeNewlyReached())
72 pred.set(bfs.head(), Graph::Edge(bfs));
74 std::cout << ts << std::endl;