1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/test/dijkstra_test.cc Fri May 07 06:58:24 2004 +0000
1.3 @@ -0,0 +1,41 @@
1.4 +#include <test_tools.h>
1.5 +#include <hugo/smart_graph.h>
1.6 +#include <hugo/dijkstra.h>
1.7 +
1.8 +using namespace hugo;
1.9 +
1.10 +const int PET_SIZE =5;
1.11 +
1.12 +int main()
1.13 +{
1.14 +
1.15 + typedef SmartGraph Graph;
1.16 +
1.17 + typedef Graph::Edge Edge;
1.18 + typedef Graph::Node Node;
1.19 + typedef Graph::EdgeIt EdgeIt;
1.20 + typedef Graph::NodeIt NodeIt;
1.21 + typedef Graph::EdgeMap<int> LengthMap;
1.22 +
1.23 + Graph G;
1.24 + Node s, t;
1.25 + LengthMap cap(G);
1.26 +
1.27 + PetStruct<Graph> ps = addPetersen(G,PET_SIZE);
1.28 +
1.29 + for(int i=0;i<PET_SIZE;i++) {
1.30 + cap[ps.outcir[i]]=4;
1.31 + cap[ps.incir[i]]=1;
1.32 + cap[ps.chords[i]]=10;
1.33 + }
1.34 + s=ps.outer[0];
1.35 + t=ps.inner[1];
1.36 +
1.37 + Dijkstra<Graph, LengthMap>
1.38 + dijkstra_test(G, cap);
1.39 + dijkstra_test.run(s);
1.40 +
1.41 + check(dijkstra_test.dist(t)==13,"Dijkstra found a wrong path.");
1.42 +
1.43 +}
1.44 +