src/work/jacint/dijkstra.cc
author jacint
Thu, 11 Mar 2004 11:03:22 +0000
changeset 166 abcbdcf36ab2
parent 159 0defa5aa1229
child 167 7949a29a334e
permissions -rw-r--r--
*** empty log message ***
     1 #include <iostream>
     2 #include <fstream>
     3 
     4 #include <list_graph.hh>
     5 #include <dimacs.hh>
     6 #include <dijkstra.h>
     7 #include <time_measure.h>
     8 
     9 using namespace hugo;
    10 
    11 int main(int, char **) {
    12   typedef ListGraph::NodeIt NodeIt;
    13   typedef ListGraph::EachEdgeIt EachEdgeIt;
    14 
    15   ListGraph G;
    16   NodeIt s, t;
    17   ListGraph::EdgeMap<int> cap(G);
    18   readDimacsMaxFlow(std::cin, G, s, t, cap);
    19 
    20   std::cout << "dijkstra demo ..." << std::endl;
    21   
    22   double pre_time=currTime();
    23     Dijkstra<ListGraph, int> dijkstra_test(G, s, cap);
    24   double post_time=currTime();
    25     
    26   std::cout << "running time: " << post_time-pre_time << " sec"<< std::endl; 
    27  
    28   EachEdgeIt e;
    29 
    30   for ( G.getFirst(e) ; G.valid(e); G.next(e) ) {
    31     NodeIt u=G.tail(e);
    32     NodeIt v=G.head(e);
    33     assert ( dijkstra_test.dist(v) - dijkstra_test.dist(u) <= cap.get(e) );
    34   }
    35 
    36   return 0;
    37 }