# HG changeset patch # User alpar # Date 1084031914 0 # Node ID 1d4855f5312e9f10489946049dc9a12bf6cac7de # Parent 357ff646e7357112d812ff121319ece4f56c3d01 Some new typedefs. diff -r 357ff646e735 -r 1d4855f5312e src/hugo/dijkstra.h --- a/src/hugo/dijkstra.h Sat May 08 15:56:00 2004 +0000 +++ b/src/hugo/dijkstra.h Sat May 08 15:58:34 2004 +0000 @@ -25,8 +25,8 @@ /// ///It is also possible to change the underlying priority heap. /// - ///\param Graph The graph type the algorithm runs on. - ///\param LengthMap This read-only + ///\param GR The graph type the algorithm runs on. + ///\param LM This read-only ///EdgeMap ///determines the ///lengths of the edges. It is read once for each edge, so the map @@ -38,38 +38,49 @@ ///is using \ref BinHeap "binary heap". /// ///\author Jacint Szabo - ///\todo We need a LengthMap typedef + ///\todo We need a typedef-names should be standardized. + #ifdef DOXYGEN - template #else - template , + template , template class Heap = BinHeap > #endif class Dijkstra{ public: + ///The type of the underlying graph. + typedef GR Graph; typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; typedef typename Graph::Edge Edge; typedef typename Graph::OutEdgeIt OutEdgeIt; - typedef typename LengthMap::ValueType ValueType; + ///The type of the length of the edges. + typedef typename LM::ValueType ValueType; + ///The the type of the map that stores the edge lengths. + typedef LM LengthMap; + ///\brief The the type of the map that stores the last + ///edges of the shortest paths. typedef typename Graph::template NodeMap PredMap; + ///\brief The the type of the map that stores the last but one + ///nodes of the shortest paths. typedef typename Graph::template NodeMap PredNodeMap; + ///The the type of the map that stores the dists of the nodes. typedef typename Graph::template NodeMap DistMap; private: const Graph& G; - const LengthMap& length; + const LM& length; PredMap predecessor; PredNodeMap pred_node; DistMap distance; public : - Dijkstra(const Graph& _G, const LengthMap& _length) : + Dijkstra(const Graph& _G, const LM& _length) : G(_G), length(_length), predecessor(_G), pred_node(_G), distance(_G) { } void run(Node s); @@ -82,9 +93,9 @@ ///of this funcion is undefined. ValueType dist(Node v) const { return distance[v]; } - ///Returns the previous edge of the shortest path tree. + ///Returns the 'previous edge' of the shortest path tree. - ///For a node \c v it returns the previous edge of the shortest path tree, + ///For a node \c v it returns the 'previous edge' of the shortest path tree, ///i.e. it returns the last edge from a shortest path from the root to \c ///v. It is INVALID if \c v is unreachable from the root or if \c v=s. The ///shortest path tree used here is equal to the shortest path tree used in @@ -92,9 +103,9 @@ ///this function. Edge pred(Node v) const { return predecessor[v]; } - ///Returns the previous node of the shortest path tree. + ///Returns the 'previous node' of the shortest path tree. - ///For a node \c v it returns the previous node of the shortest path tree, + ///For a node \c v it returns the 'previous node' of the shortest path tree, ///i.e. it returns the last but one node from a shortest path from the ///root to \c /v. It is INVALID if \c v is unreachable from the root or if ///\c v=s. The shortest path tree used here is equal to the shortest path @@ -146,9 +157,9 @@ ///shortest path to each node. The algorithm computes ///- The shortest path tree. ///- The distance of each node from the root. - template class Heap > - void Dijkstra::run(Node s) { + void Dijkstra::run(Node s) { NodeIt u; for ( G.first(u) ; G.valid(u) ; G.next(u) ) { @@ -156,9 +167,9 @@ pred_node.set(u,INVALID); } - typename Graph::template NodeMap heap_map(G,-1); + typename GR::template NodeMap heap_map(G,-1); - typedef Heap, + typedef Heap, std::less > HeapType;