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