lemon/dijkstra.h
changeset 550 c5fd2d996909
parent 519 9605e051942f
child 576 33c6b6e755cd
     1.1 --- a/lemon/dijkstra.h	Thu Mar 05 10:13:20 2009 +0000
     1.2 +++ b/lemon/dijkstra.h	Sun Mar 29 23:08:20 2009 +0200
     1.3 @@ -38,8 +38,10 @@
     1.4    ///
     1.5    /// This operation traits class defines all computational operations and
     1.6    /// constants which are used in the Dijkstra algorithm.
     1.7 -  template <typename Value>
     1.8 +  template <typename V>
     1.9    struct DijkstraDefaultOperationTraits {
    1.10 +    /// \e
    1.11 +    typedef V Value;
    1.12      /// \brief Gives back the zero value of the type.
    1.13      static Value zero() {
    1.14        return static_cast<Value>(0);
    1.15 @@ -58,8 +60,8 @@
    1.16  
    1.17    ///Default traits class of Dijkstra class.
    1.18    ///\tparam GR The type of the digraph.
    1.19 -  ///\tparam LM The type of the length map.
    1.20 -  template<class GR, class LM>
    1.21 +  ///\tparam LEN The type of the length map.
    1.22 +  template<typename GR, typename LEN>
    1.23    struct DijkstraDefaultTraits
    1.24    {
    1.25      ///The type of the digraph the algorithm runs on.
    1.26 @@ -69,9 +71,9 @@
    1.27  
    1.28      ///The type of the map that stores the arc lengths.
    1.29      ///It must meet the \ref concepts::ReadMap "ReadMap" concept.
    1.30 -    typedef LM LengthMap;
    1.31 +    typedef LEN LengthMap;
    1.32      ///The type of the length of the arcs.
    1.33 -    typedef typename LM::Value Value;
    1.34 +    typedef typename LEN::Value Value;
    1.35  
    1.36      /// Operation traits for %Dijkstra algorithm.
    1.37  
    1.38 @@ -100,7 +102,7 @@
    1.39      ///
    1.40      ///\sa BinHeap
    1.41      ///\sa Dijkstra
    1.42 -    typedef BinHeap<typename LM::Value, HeapCrossRef, std::less<Value> > Heap;
    1.43 +    typedef BinHeap<typename LEN::Value, HeapCrossRef, std::less<Value> > Heap;
    1.44      ///Instantiates a \c Heap.
    1.45  
    1.46      ///This function instantiates a \ref Heap.
    1.47 @@ -150,7 +152,7 @@
    1.48  
    1.49      ///The type of the map that stores the distances of the nodes.
    1.50      ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    1.51 -    typedef typename Digraph::template NodeMap<typename LM::Value> DistMap;
    1.52 +    typedef typename Digraph::template NodeMap<typename LEN::Value> DistMap;
    1.53      ///Instantiates a \c DistMap.
    1.54  
    1.55      ///This function instantiates a \ref DistMap.
    1.56 @@ -180,18 +182,18 @@
    1.57    ///
    1.58    ///\tparam GR The type of the digraph the algorithm runs on.
    1.59    ///The default type is \ref ListDigraph.
    1.60 -  ///\tparam LM A \ref concepts::ReadMap "readable" arc map that specifies
    1.61 +  ///\tparam LEN A \ref concepts::ReadMap "readable" arc map that specifies
    1.62    ///the lengths of the arcs.
    1.63    ///It is read once for each arc, so the map may involve in
    1.64    ///relatively time consuming process to compute the arc lengths if
    1.65    ///it is necessary. The default map type is \ref
    1.66    ///concepts::Digraph::ArcMap "GR::ArcMap<int>".
    1.67  #ifdef DOXYGEN
    1.68 -  template <typename GR, typename LM, typename TR>
    1.69 +  template <typename GR, typename LEN, typename TR>
    1.70  #else
    1.71    template <typename GR=ListDigraph,
    1.72 -            typename LM=typename GR::template ArcMap<int>,
    1.73 -            typename TR=DijkstraDefaultTraits<GR,LM> >
    1.74 +            typename LEN=typename GR::template ArcMap<int>,
    1.75 +            typename TR=DijkstraDefaultTraits<GR,LEN> >
    1.76  #endif
    1.77    class Dijkstra {
    1.78    public:
    1.79 @@ -913,8 +915,8 @@
    1.80  
    1.81    ///Default traits class of dijkstra() function.
    1.82    ///\tparam GR The type of the digraph.
    1.83 -  ///\tparam LM The type of the length map.
    1.84 -  template<class GR, class LM>
    1.85 +  ///\tparam LEN The type of the length map.
    1.86 +  template<class GR, class LEN>
    1.87    struct DijkstraWizardDefaultTraits
    1.88    {
    1.89      ///The type of the digraph the algorithm runs on.
    1.90 @@ -923,9 +925,9 @@
    1.91  
    1.92      ///The type of the map that stores the arc lengths.
    1.93      ///It must meet the \ref concepts::ReadMap "ReadMap" concept.
    1.94 -    typedef LM LengthMap;
    1.95 +    typedef LEN LengthMap;
    1.96      ///The type of the length of the arcs.
    1.97 -    typedef typename LM::Value Value;
    1.98 +    typedef typename LEN::Value Value;
    1.99  
   1.100      /// Operation traits for Dijkstra algorithm.
   1.101  
   1.102 @@ -1007,7 +1009,7 @@
   1.103  
   1.104      ///The type of the map that stores the distances of the nodes.
   1.105      ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
   1.106 -    typedef typename Digraph::template NodeMap<typename LM::Value> DistMap;
   1.107 +    typedef typename Digraph::template NodeMap<typename LEN::Value> DistMap;
   1.108      ///Instantiates a DistMap.
   1.109  
   1.110      ///This function instantiates a DistMap.
   1.111 @@ -1033,10 +1035,10 @@
   1.112    /// as well as the \ref Dijkstra class.
   1.113    /// The \ref DijkstraWizardBase is a class to be the default traits of the
   1.114    /// \ref DijkstraWizard class.
   1.115 -  template<class GR,class LM>
   1.116 -  class DijkstraWizardBase : public DijkstraWizardDefaultTraits<GR,LM>
   1.117 +  template<typename GR, typename LEN>
   1.118 +  class DijkstraWizardBase : public DijkstraWizardDefaultTraits<GR,LEN>
   1.119    {
   1.120 -    typedef DijkstraWizardDefaultTraits<GR,LM> Base;
   1.121 +    typedef DijkstraWizardDefaultTraits<GR,LEN> Base;
   1.122    protected:
   1.123      //The type of the nodes in the digraph.
   1.124      typedef typename Base::Digraph::Node Node;
   1.125 @@ -1070,9 +1072,9 @@
   1.126      /// others are initiated to \c 0.
   1.127      /// \param g The digraph the algorithm runs on.
   1.128      /// \param l The length map.
   1.129 -    DijkstraWizardBase(const GR &g,const LM &l) :
   1.130 +    DijkstraWizardBase(const GR &g,const LEN &l) :
   1.131        _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
   1.132 -      _length(reinterpret_cast<void*>(const_cast<LM*>(&l))),
   1.133 +      _length(reinterpret_cast<void*>(const_cast<LEN*>(&l))),
   1.134        _processed(0), _pred(0), _dist(0), _path(0), _di(0) {}
   1.135  
   1.136    };
   1.137 @@ -1281,11 +1283,11 @@
   1.138    ///to the end of the parameter list.
   1.139    ///\sa DijkstraWizard
   1.140    ///\sa Dijkstra
   1.141 -  template<class GR, class LM>
   1.142 -  DijkstraWizard<DijkstraWizardBase<GR,LM> >
   1.143 -  dijkstra(const GR &digraph, const LM &length)
   1.144 +  template<typename GR, typename LEN>
   1.145 +  DijkstraWizard<DijkstraWizardBase<GR,LEN> >
   1.146 +  dijkstra(const GR &digraph, const LEN &length)
   1.147    {
   1.148 -    return DijkstraWizard<DijkstraWizardBase<GR,LM> >(digraph,length);
   1.149 +    return DijkstraWizard<DijkstraWizardBase<GR,LEN> >(digraph,length);
   1.150    }
   1.151  
   1.152  } //END OF NAMESPACE LEMON