1.1 --- a/test/dijkstra_test.cc Sun Jul 13 16:46:56 2008 +0100
1.2 +++ b/test/dijkstra_test.cc Sun Jul 13 19:51:02 2008 +0100
1.3 @@ -1,6 +1,6 @@
1.4 -/* -*- C++ -*-
1.5 +/* -*- mode: C++; indent-tabs-mode: nil; -*-
1.6 *
1.7 - * This file is a part of LEMON, a generic C++ optimization library
1.8 + * This file is a part of LEMON, a generic C++ optimization library.
1.9 *
1.10 * Copyright (C) 2003-2008
1.11 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.12 @@ -28,13 +28,13 @@
1.13
1.14 using namespace lemon;
1.15
1.16 -void checkDijkstraCompile()
1.17 +void checkDijkstraCompile()
1.18 {
1.19 typedef int VType;
1.20 typedef concepts::Digraph Digraph;
1.21 typedef concepts::ReadMap<Digraph::Arc,VType> LengthMap;
1.22 typedef Dijkstra<Digraph, LengthMap> DType;
1.23 -
1.24 +
1.25 Digraph G;
1.26 Digraph::Node n;
1.27 Digraph::Arc e;
1.28 @@ -60,14 +60,14 @@
1.29 Path<Digraph> pp = dijkstra_test.path(n);
1.30 }
1.31
1.32 -void checkDijkstraFunctionCompile()
1.33 +void checkDijkstraFunctionCompile()
1.34 {
1.35 typedef int VType;
1.36 typedef concepts::Digraph Digraph;
1.37 typedef Digraph::Arc Arc;
1.38 typedef Digraph::Node Node;
1.39 typedef concepts::ReadMap<Digraph::Arc,VType> LengthMap;
1.40 -
1.41 +
1.42 Digraph g;
1.43 dijkstra(g,LengthMap(),Node()).run();
1.44 dijkstra(g,LengthMap()).source(Node()).run();
1.45 @@ -78,7 +78,7 @@
1.46 }
1.47
1.48 template <class Digraph>
1.49 -void checkDijkstra() {
1.50 +void checkDijkstra() {
1.51 TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
1.52 typedef typename Digraph::template ArcMap<int> LengthMap;
1.53
1.54 @@ -86,7 +86,7 @@
1.55 Node s, t;
1.56 LengthMap length(G);
1.57 PetStruct<Digraph> ps = addPetersen(G, 5);
1.58 -
1.59 +
1.60 for(int i=0;i<5;i++) {
1.61 length[ps.outcir[i]]=4;
1.62 length[ps.incir[i]]=1;
1.63 @@ -94,11 +94,11 @@
1.64 }
1.65 s=ps.outer[0];
1.66 t=ps.inner[1];
1.67 -
1.68 - Dijkstra<Digraph, LengthMap>
1.69 - dijkstra_test(G, length);
1.70 +
1.71 + Dijkstra<Digraph, LengthMap>
1.72 + dijkstra_test(G, length);
1.73 dijkstra_test.run(s);
1.74 -
1.75 +
1.76 check(dijkstra_test.dist(t)==13,"Dijkstra found a wrong path.");
1.77
1.78 Path<Digraph> p = dijkstra_test.path(t);
1.79 @@ -106,12 +106,12 @@
1.80 check(checkPath(G, p),"path() found a wrong path.");
1.81 check(pathSource(G, p) == s,"path() found a wrong path.");
1.82 check(pathTarget(G, p) == t,"path() found a wrong path.");
1.83 -
1.84 +
1.85 for(ArcIt e(G); e!=INVALID; ++e) {
1.86 Node u=G.source(e);
1.87 Node v=G.target(e);
1.88 check( !dijkstra_test.reached(u) || (dijkstra_test.dist(v) - dijkstra_test.dist(u) <= length[e]),
1.89 - "dist(target)-dist(source)-arc_length= " << dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]);
1.90 + "dist(target)-dist(source)-arc_length= " << dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]);
1.91 }
1.92
1.93 for(NodeIt v(G); v!=INVALID; ++v){
1.94 @@ -121,10 +121,10 @@
1.95 Node u=G.source(e);
1.96 check(u==dijkstra_test.predNode(v),"Wrong tree.");
1.97 check(dijkstra_test.dist(v) - dijkstra_test.dist(u) == length[e],
1.98 - "Wrong distance! Difference: " << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]));
1.99 + "Wrong distance! Difference: " << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]));
1.100 }
1.101 }
1.102 -
1.103 +
1.104 {
1.105 NullMap<Node,Arc> myPredMap;
1.106 dijkstra(G,length).predMap(myPredMap).run(s);