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, 17 years ago

* empty log message *

File size: 837 bytes
Line 
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
9using namespace hugo;
10
11int 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}
Note: See TracBrowser for help on using the repository browser.