src/work/marci/preflow_demo_leda.cc
author marci
Mon, 20 Sep 2004 17:53:33 +0000
changeset 890 3a48bc350e0f
permissions -rw-r--r--
Specialized ConstMap for defining constant maps at compile time, by klao.
Time comparision of the generic and specialized maps.
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