COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/work/jacint/dijkstra.cc @ 166:abcbdcf36ab2

Last change on this file since 166:abcbdcf36ab2 was 160:f1a7005e9dff, checked in by jacint, 18 years ago

* empty log message *

File size: 837 bytes
RevLine 
[159]1#include <iostream>
[160]2#include <fstream>
[159]3
4#include <list_graph.hh>
[160]5#include <dimacs.hh>
[159]6#include <dijkstra.h>
[160]7#include <time_measure.h>
[159]8
9using namespace hugo;
10
[160]11int main(int, char **) {
[159]12  typedef ListGraph::NodeIt NodeIt;
13  typedef ListGraph::EachEdgeIt EachEdgeIt;
[160]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;
[159]21 
[160]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;
[159]27 
[160]28  EachEdgeIt e;
[159]29
[160]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) );
[159]34  }
35
36  return 0;
37}
Note: See TracBrowser for help on using the repository browser.