.
3 #include <list_graph.hh>
5 #include <edmonds_karp.hh>
9 // Use a DIMACS max flow file as stdin.
10 // read_dimacs_demo < dimacs_flow_file
11 int main(int, char **) {
12 typedef ListGraph::NodeIt NodeIt;
13 typedef ListGraph::EachEdgeIt EachEdgeIt;
17 ListGraph::EdgeMap<int> cap(G);
18 readDimacsMaxFlow(std::cin, G, s, t, cap);
20 std::cout << "augmenting path flow algorithm demo..." << std::endl;
21 ListGraph::EdgeMap<int> flow(G); //0 flow
22 MaxFlow<ListGraph, int, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
25 std::cout << "maximum flow: "<< std::endl;
26 for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
27 std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
30 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;