5 #include <list_graph.h>
6 #include <smart_graph.h>
8 #include <time_measure.h>
9 #include <for_each_macros.h>
10 #include <bfs_iterator.h>
15 typedef ListGraph Graph;
16 typedef Graph::Node Node;
17 typedef Graph::NodeIt NodeIt;
18 typedef Graph::Edge Edge;
19 typedef Graph::EdgeIt EdgeIt;
20 typedef Graph::OutEdgeIt OutEdgeIt;
24 Graph::EdgeMap<int> cap(G);
25 readDimacsMaxFlow(std::cin, G, s, t, cap);
26 Graph::NodeMap<OutEdgeIt> pred(G);
30 Graph::NodeMap<bool> reached(G);
31 /*Reverse_bfs from t, to find the starting level.*/
34 std::queue<Node> bfs_queue;
36 while (!bfs_queue.empty()) {
37 Node v=bfs_queue.front();
40 for(G.first(e,v); G.valid(e); G.next(e)) {
50 std::cout << ts << std::endl;
55 BfsIterator5< Graph, Graph::NodeMap<bool> > bfs(G);
56 bfs.pushAndSetReached(s);
58 while (!bfs.finished()) {
60 if (G.valid(bfs) && bfs.isBNodeNewlyReached())
61 pred.set(bfs.bNode(), bfs);
63 std::cout << ts << std::endl;