[Lemon-commits] [lemon_svn] alpar: r1334 - in hugo/trunk: doc src/work/alpar

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:44:40 CET 2006


Author: alpar
Date: Mon Nov  1 20:00:19 2004
New Revision: 1334

Modified:
   hugo/trunk/doc/named-param.dox
   hugo/trunk/src/work/alpar/dijkstra.h

Log:
Improved docs.

Modified: hugo/trunk/doc/named-param.dox
==============================================================================
--- hugo/trunk/doc/named-param.dox	(original)
+++ hugo/trunk/doc/named-param.dox	Mon Nov  1 20:00:19 2004
@@ -1,5 +1,19 @@
 /*!
+
 \page named-param Named Parameters
 
+\section named-templ-param Named Template Parameters
+
+Instead of creating a new traits class you can also use this adaptor class
+like this
+\code
+Dijkstra<>::SetPredNodeMap<NullMap<Node,Node> >
+\endcode
+It can also be used in conjunction with other named template
+parameters in arbitrary order.
+\code
+Dijkstra<>::SetDistMap<MyMap>::SetPredMap<NullMap<Node,Edge> >
+\endcode
+
 
 */

Modified: hugo/trunk/src/work/alpar/dijkstra.h
==============================================================================
--- hugo/trunk/src/work/alpar/dijkstra.h	(original)
+++ hugo/trunk/src/work/alpar/dijkstra.h	Mon Nov  1 20:00:19 2004
@@ -30,23 +30,24 @@
 /// \addtogroup flowalgs
 /// @{
 
+  ///Default traits class of Dijkstra class.
+
+  ///Default traits class of Dijkstra class.
+  ///\param GR Graph type.
+  ///\param LM Type of length map.
   template<class GR, class LM>
   struct DijkstraDefaultTraits
   {
-    ///\e 
+    ///The graph type the algorithm runs on. 
     typedef GR Graph;
-    ///\e
-    typedef typename Graph::Node Node;
-    ///\e
-    typedef typename Graph::Edge Edge;
     ///The type of the map that stores the edge lengths.
 
     ///It must meet the \ref ReadMap concept.
     ///
     typedef LM LengthMap;
-    ///The type of the length of the edges.
+    //The type of the length of the edges.
     typedef typename LM::ValueType ValueType;
-    ///The heap type used by the dijkstra algorithm.
+    ///The heap type used by Dijkstra algorithm.
     typedef BinHeap<typename Graph::Node,
 		    typename LM::ValueType,
 		    typename GR::template NodeMap<int>,
@@ -57,12 +58,12 @@
     /// 
     ///It must meet the \ref WriteMap concept.
     ///
-    typedef typename Graph::template NodeMap<Edge> PredMap;
-    ///
+    typedef typename Graph::template NodeMap<typename GR::Edge> PredMap;
+    ///Instantiates a PredMap.
  
     ///\todo Please document...
     ///
-    static PredMap *createPredMap(const Graph &G) 
+    static PredMap *createPredMap(const GR &G) 
     {
       return new PredMap(G);
     }
@@ -71,12 +72,12 @@
     ///
     ///It must meet the \ref WriteMap concept.
     ///
-    typedef typename Graph::template NodeMap<Node> PredNodeMap;
-    ///
+    typedef typename Graph::template NodeMap<typename GR::Node> PredNodeMap;
+    ///Instantiates a PredNodeMap.
  
     ///\todo Please document...
     /// 
-    static PredNodeMap *createPredNodeMap(const Graph &G)
+    static PredNodeMap *createPredNodeMap(const GR &G)
     {
       return new PredNodeMap(G);
     }
@@ -84,12 +85,12 @@
  
     ///It must meet the \ref WriteMap concept.
     ///
-    typedef typename Graph::template NodeMap<ValueType> DistMap;
-    ///
+    typedef typename Graph::template NodeMap<typename LM::ValueType> DistMap;
+    ///Instantiates a DistMap.
  
     ///\todo Please document...
     ///
-    static DistMap *createDistMap(const Graph &G)
+    static DistMap *createDistMap(const GR &G)
     {
       return new DistMap(G);
     }
@@ -108,22 +109,25 @@
   ///It is also possible to change the underlying priority heap.
   ///
   ///\param GR The graph type the algorithm runs on. The default value is
-  ///\ref ListGraph
+  ///\ref ListGraph. The value of GR is not used directly by %Dijsktra, it
+  ///is only passed to \ref DijkstraDefaultTraits.
   ///\param LM This read-only
   ///EdgeMap
   ///determines the
   ///lengths of the edges. It is read once for each edge, so the map
   ///may involve in relatively time consuming process to compute the edge
   ///length if it is necessary. The default map type is
-  ///\ref skeleton::StaticGraph::EdgeMap "Graph::EdgeMap<int>"
-  ///\param Heap The heap type used by the %Dijkstra
-  ///algorithm. The default
-  ///is using \ref BinHeap "binary heap".
+  ///\ref skeleton::StaticGraph::EdgeMap "Graph::EdgeMap<int>".
+  ///The value of LM is not used directly by %Dijsktra, it
+  ///is only passed to \ref DijkstraDefaultTraits.
+  ///\param TR Traits class to set various data types used by the algorithm.
+  ///The default traits class is
+  ///\ref DijkstraDefaultTraits<GR,LM> "DijkstraDefaultTraits<GR,LM>".
+  ///See \ref DijkstraDefaultTraits for the documentation of
+  ///a Dijkstra traits class.
   ///
   ///\author Jacint Szabo and Alpar Juttner
   ///\todo We need a typedef-names should be standardized. (-:
-  ///\todo Type of \c PredMap, \c PredNodeMap and \c DistMap
-  ///should not be fixed. (Problematic to solve).
 
 #ifdef DOXYGEN
   template <typename GR,
@@ -138,7 +142,7 @@
   public:
     typedef TR Traits;
     ///The type of the underlying graph.
-    typedef GR Graph;
+    typedef typename TR::Graph Graph;
     ///\e
     typedef typename Graph::Node Node;
     ///\e
@@ -149,9 +153,9 @@
     typedef typename Graph::OutEdgeIt OutEdgeIt;
     
     ///The type of the length of the edges.
-    typedef typename LM::ValueType ValueType;
+    typedef typename TR::LengthMap::ValueType ValueType;
     ///The type of the map that stores the edge lengths.
-    typedef LM LengthMap;
+    typedef typename TR::LengthMap LengthMap;
     ///\brief The type of the map that stores the last
     ///edges of the shortest paths.
     typedef typename TR::PredMap PredMap;
@@ -160,7 +164,6 @@
     typedef typename TR::PredNodeMap PredNodeMap;
     ///The type of the map that stores the dists of the nodes.
     typedef typename TR::DistMap DistMap;
-
     ///The heap type used by the dijkstra algorithm.
     typedef typename TR::Heap Heap;
 
@@ -168,7 +171,7 @@
     /// Pointer to the underlying graph.
     const Graph *G;
     /// Pointer to the length map
-    const LM *length;
+    const LengthMap *length;
     ///Pointer to the map of predecessors edges.
     PredMap *predecessor;
     ///Indicates if \ref predecessor is locally allocated (\c true) or not.
@@ -219,7 +222,10 @@
 	exit(1);
       }
     };
-    ///\ref named-templ-param "Named parameter" for setting PredMap's type
+    ///\ref named-templ-param "Named parameter" for setting PredMap type
+
+    ///\ingroup flowalgs 
+    ///\ref named-templ-param "Named parameter" for setting PredMap type
     template <class T>
     class SetPredMap : public Dijkstra< Graph,
 					LengthMap,
@@ -237,7 +243,10 @@
 	exit(1);
       }
     };
-    ///\ref named-templ-param "Named parameter" for setting PredNodeMap's type
+    ///\ref named-templ-param "Named parameter" for setting PredNodeMap type
+
+    ///\ingroup flowalgs 
+    ///\ref named-templ-param "Named parameter" for setting PredNodeMap type
     template <class T>
     class SetPredNodeMap : public Dijkstra< Graph,
 					    LengthMap,
@@ -255,7 +264,10 @@
 	exit(1);
       }
     };
-    ///\ref named-templ-param "Named parameter" for setting DistMap's type
+    ///\ref named-templ-param "Named parameter" for setting DistMap type
+
+    ///\ingroup flowalgs 
+    ///\ref named-templ-param "Named parameter" for setting DistMap type
     template <class T>
     class SetDistMap : public Dijkstra< Graph,
 					LengthMap,
@@ -265,7 +277,7 @@
     
     ///\param _G the graph the algorithm will run on.
     ///\param _length the length map used by the algorithm.
-    Dijkstra(const Graph& _G, const LM& _length) :
+    Dijkstra(const Graph& _G, const LengthMap& _length) :
       G(&_G), length(&_length),
       predecessor(NULL), local_predecessor(false),
       pred_node(NULL), local_pred_node(false),
@@ -284,7 +296,7 @@
 
     ///Sets the length map.
     ///\return <tt> (*this) </tt>
-    Dijkstra &setLengthMap(const LM &m) 
+    Dijkstra &setLengthMap(const LengthMap &m) 
     {
       length = &m;
       return *this;
@@ -349,7 +361,7 @@
   ///shortest path to each node. The algorithm computes
   ///- The shortest path tree.
   ///- The distance of each node from the root.
-    
+  ///\todo heap_map's type could also be in the traits class.
     void run(Node s) {
       
       init_maps();
@@ -361,7 +373,7 @@
 	pred_node->set(u,INVALID);
       }
       
-      typename GR::template NodeMap<int> heap_map(*G,-1);
+      typename Graph::template NodeMap<int> heap_map(*G,-1);
       
       Heap heap(heap_map);
       
@@ -583,7 +595,7 @@
   
   ///\e
 
-  ///\e
+  ///\todo Please document...
   ///
   template<class GR, class LM>
   _Dijkstra<DijkstraDefaultTraits<GR,LM> >



More information about the Lemon-commits mailing list