Some modifications and another testfile.
5 #include <LEDA/graph.h>
6 #include <leda_graph_wrapper.h>
8 #include <time_measure.h>
9 #include <edmonds_karp.h>
18 typedef LedaGraphWrapper<leda::graph> Graph;
22 // std::cout << G.nodeNum() << std::endl;
24 typedef Graph::Node Node;
25 typedef Graph::NodeIt NodeIt;
26 typedef Graph::Edge Edge;
27 typedef Graph::EdgeIt EdgeIt;
28 typedef Graph::OutEdgeIt OutEdgeIt;
29 typedef Graph::InEdgeIt InEdgeIt;
32 Graph::EdgeMap<int> cap(G);
33 readDimacsMaxFlow(std::cin, G, s, t, cap);
36 // cout << "bfs and dfs iterator demo on the directed graph" << endl;
37 // for(NodeIt n=G.first<NodeIt>(); G.valid(n); G.next(n)) {
38 // cout << G.id(n) << ": ";
39 // cout << "out edges: ";
40 // for(OutEdgeIt e=G.first<OutEdgeIt>(n); G.valid(e); G.next(e))
41 // cout << G.id(G.tail(e)) << "-" << cap.get(e) << "->" << G.id(G.head(e)) << " ";
42 // cout << "in edges: ";
43 // for(InEdgeIt e=G.first<InEdgeIt>(n); G.valid(e); G.next(e))
44 // cout << G.id(G.tail(e)) << "-" << cap.get(e) << "->" << G.id(G.head(e)) << " ";
49 // for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e)) { cap.set(e, i); i+=3; }
50 // for(EdgeIt e=G.first<EdgeIt>(); G.valid(e); G.next(e)) { cout << cap.get(e) << " "; }
54 //std::cout << "SmartGraph..." << std::endl;
55 std::cout << "on-the-fly edmonds karp demo on wrapped leda graph..." << std::endl;
56 Graph::EdgeMap<int> flow(G); //0 flow
62 MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
63 //max_flow_test.augmentWithBlockingFlow<Graph>();
65 while (max_flow_test.augmentOnShortestPath()) {
66 // for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) {
67 // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
69 // std::cout<<std::endl;
73 // std::cout << "maximum flow: "<< std::endl;
74 // for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) {
75 // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
77 // std::cout<<std::endl;
78 std::cout << "elapsed time: " << ts << std::endl;
79 std::cout << "number of augmentation phases: " << i << std::endl;
80 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;