src/work/athos/minlength_demo.cc
author marci
Fri, 07 May 2004 11:57:34 +0000
changeset 577 e8703f0a6e2f
child 607 327f7cf13843
permissions -rw-r--r--
top-sort, dimacs mods.
athos@511
     1
#include <iostream>
athos@511
     2
#include <fstream>
athos@511
     3
athos@511
     4
#include <list_graph.h>
athos@511
     5
#include <dimacs.h>
athos@511
     6
#include <minlengthpaths.h>
athos@511
     7
//#include <time_measure.h>
athos@511
     8
athos@511
     9
using namespace hugo;
athos@511
    10
athos@511
    11
// Use a DIMACS max flow file as stdin.
athos@511
    12
// read_dimacs_demo < dimacs_max_flow_file
athos@511
    13
int main(int argc, char ** argv) {
athos@511
    14
  typedef ListGraph Graph;
athos@511
    15
athos@511
    16
  typedef Graph::Node Node;
athos@511
    17
  //typedef Graph::EachEdgeIt EachEdgeIt;
athos@511
    18
athos@511
    19
  Graph G;
athos@511
    20
  Node s, t;
athos@511
    21
  Graph::EdgeMap<int> cap(G);
athos@511
    22
  readDimacsMaxFlow(std::cin, G, s, t, cap);
athos@511
    23
athos@511
    24
  std::cout << "preflow demo (ATHOS)..." << std::endl;
athos@511
    25
  //Graph::EdgeMap<int> flow(G); //0 flow
athos@511
    26
athos@511
    27
  //  double pre_time=currTime();
athos@511
    28
athos@511
    29
  int k=1;
athos@511
    30
  if (argc>1)
athos@511
    31
    k = atoi(argv[1]);
athos@511
    32
  MinLengthPaths<Graph, Graph::EdgeMap<int> >
athos@511
    33
    surb_test(G,cap);
athos@511
    34
  std::cout << surb_test.run(s,t,k) << std::endl;
athos@511
    35
  std::cout << surb_test.totalLength() << std::endl;
athos@511
    36
  //preflow_push<Graph, int> max_flow_test(G, s, t, cap);
athos@511
    37
  //int flow_value=max_flow_test.run();
athos@511
    38
athos@511
    39
  //double post_time=currTime();
athos@511
    40
athos@511
    41
  //std::cout << "elapsed time: " << post_time-pre_time << " sec"<< std::endl; 
athos@511
    42
  //std::cout << "flow value: "<< flow_value << std::endl;
athos@511
    43
athos@511
    44
  return 0;
athos@511
    45
}