COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/work/alpar/f_ed_ka_demo.cc @ 102:294cb99af985

Last change on this file since 102:294cb99af985 was 95:3322fbf254d2, checked in by marci, 20 years ago

.

File size: 1.1 KB
Line 
1#include <iostream>
2#include <fstream>
3
4#include "../list_graph.hh"
5#include "../marci/dimacs.hh"
6#include "f_ed_ka.h"
7#include "../marci/time_measure.h"
8
9using namespace marci;
10
11// Use a DIMACS max flow file as stdin.
12// read_dimacs_demo < dimacs_max_flow_file
13
14int main(int, char **) {
15  typedef ListGraph::NodeIt NodeIt;
16  typedef ListGraph::EachNodeIt EachNodeIt;
17  typedef ListGraph::EachEdgeIt EachEdgeIt;
18
19  ListGraph G;
20  NodeIt s, t;
21  ListGraph::EdgeMap<int> cap(G);
22  readDimacsMaxFlow(std::cin, G, s, t, cap);
23
24  std::cout << "edmonds karp demo..." << std::endl;
25  ListGraph::EdgeMap<int> flow(G); //0 flow
26 
27  int ret;
28  double pre_time=currTime();
29  ret = maxFlow(G,flow,cap,s,t);
30  double post_time=currTime();
31  //std::cout << "maximum flow: "<< std::endl;
32  //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
33  //  std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
34  //}
35  //std::cout<<std::endl;
36  std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl;
37  std::cout << "flow value: "<< ret << std::endl;
38
39  return 0;
40}
Note: See TracBrowser for help on using the repository browser.