src/work/marci/preflow_demo_leda_uj.cc
author marci
Tue, 21 Sep 2004 11:54:20 +0000
changeset 892 004636791dd7
permissions -rw-r--r--
graph_wrappers now pass the tests.
klao@125
     1
#include <iostream>
klao@125
     2
#include <fstream>
klao@125
     3
klao@125
     4
#include <LEDA/graph.h>
klao@125
     5
#include <LEDA/graph_alg.h>
klao@125
     6
#include <LEDA/dimacs.h>
klao@125
     7
klao@125
     8
#if defined(LEDA_NAMESPACE)
klao@125
     9
using namespace leda;
klao@125
    10
#endif
klao@125
    11
klao@125
    12
using namespace std;
klao@125
    13
klao@125
    14
#include <time_measure.h>
klao@125
    15
klao@125
    16
// Use a DIMACS max flow file as stdin.
klao@125
    17
// read_dimacs_demo_leda < dimacs_max_flow_file
klao@125
    18
int main() 
klao@125
    19
{
klao@125
    20
  GRAPH<int,int> G;
klao@125
    21
  leda_node s,t;
klao@125
    22
  leda_edge_array<int> cap;
klao@125
    23
  Read_Dimacs_MF(cin,G,s,t,cap);
klao@125
    24
 
klao@125
    25
  leda_edge_array<int> flow(G);
klao@125
    26
klao@125
    27
  std::cout << "preflow demo (LEDA)..." << std::endl;
klao@125
    28
  double pre_time=currTime();
klao@125
    29
  int flow_value = MAX_FLOW(G,s,t,cap,flow); 
klao@125
    30
  double post_time=currTime();
klao@125
    31
  //std::cout << "maximum flow: "<< std::endl;
klao@125
    32
  //std::cout<<std::endl;
klao@125
    33
  std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl; 
klao@125
    34
  std::cout << "flow value: "<< flow_value << std::endl;
klao@125
    35
klao@125
    36
  return 0;
klao@125
    37
}