src/work/marci/preflow_demo_leda.cc
author jacint
Thu, 06 May 2004 09:26:23 +0000
changeset 538 d8863141824d
permissions -rw-r--r--
(none)
marci@73
     1
#include <iostream.h>
marci@73
     2
#include <fstream.h>
marci@73
     3
marci@73
     4
#include <LEDA/graph.h>
marci@73
     5
#include <LEDA/graph_alg.h>
marci@73
     6
#include <LEDA/dimacs.h>
marci@73
     7
marci@73
     8
#include <time_measure.h>
marci@73
     9
marci@73
    10
// Use a DIMACS max flow file as stdin.
marci@73
    11
// read_dimacs_demo_leda < dimacs_max_flow_file
marci@73
    12
int main() 
marci@73
    13
{
marci@73
    14
  GRAPH<int,int> G;
marci@73
    15
  leda_node s,t;
marci@73
    16
  leda_edge_array<int> cap;
marci@73
    17
  Read_Dimacs_Maxflow(cin,G,cap,s,t);
marci@73
    18
 
marci@73
    19
  leda_edge_array<int> flow(G);
marci@73
    20
marci@73
    21
  std::cout << "preflow demo (LEDA)..." << std::endl;
marci@73
    22
  double pre_time=currTime();
marci@73
    23
  int flow_value = MAX_FLOW(G,s,t,cap,flow); 
marci@73
    24
  double post_time=currTime();
marci@73
    25
  //std::cout << "maximum flow: "<< std::endl;
marci@73
    26
  //std::cout<<std::endl;
marci@73
    27
  std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl; 
marci@73
    28
  std::cout << "flow value: "<< flow_value << std::endl;
marci@73
    29
marci@73
    30
  return 0;
marci@73
    31
}
marci@73
    32
marci@73
    33