[Lemon-commits] [lemon_svn] alpar: r761 - hugo/trunk/src/hugo
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:41:21 CET 2006
Author: alpar
Date: Sat May 8 17:58:34 2004
New Revision: 761
Modified:
hugo/trunk/src/hugo/dijkstra.h
Log:
Some new typedefs.
Modified: hugo/trunk/src/hugo/dijkstra.h
==============================================================================
--- hugo/trunk/src/hugo/dijkstra.h (original)
+++ hugo/trunk/src/hugo/dijkstra.h Sat May 8 17:58:34 2004
@@ -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 <typename Graph,
- typename LengthMap,
+ template <typename GR,
+ typename LM,
typename Heap>
#else
- template <typename Graph,
- typename LengthMap=typename Graph::template EdgeMap<int>,
+ template <typename GR,
+ typename LM=typename GR::template EdgeMap<int>,
template <class,class,class,class> 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<Edge> PredMap;
+ ///\brief The the type of the map that stores the last but one
+ ///nodes of the shortest paths.
typedef typename Graph::template NodeMap<Node> PredNodeMap;
+ ///The the type of the map that stores the dists of the nodes.
typedef typename Graph::template NodeMap<ValueType> 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 <typename Graph, typename LengthMap,
+ template <typename GR, typename LM,
template<class,class,class,class> class Heap >
- void Dijkstra<Graph,LengthMap,Heap>::run(Node s) {
+ void Dijkstra<GR,LM,Heap>::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<int> heap_map(G,-1);
+ typename GR::template NodeMap<int> heap_map(G,-1);
- typedef Heap<Node, ValueType, typename Graph::template NodeMap<int>,
+ typedef Heap<Node, ValueType, typename GR::template NodeMap<int>,
std::less<ValueType> >
HeapType;
More information about the Lemon-commits
mailing list