lemon/dfs.h
changeset 783 ef88c0a30f85
parent 716 f47b6c94577e
parent 713 4ac30454f1c1
child 786 e20173729589
child 787 c2230649a493
     1.1 --- a/lemon/dfs.h	Mon Jan 12 23:11:39 2009 +0100
     1.2 +++ b/lemon/dfs.h	Thu Nov 05 15:48:01 2009 +0100
     1.3 @@ -47,13 +47,13 @@
     1.4      ///
     1.5      ///The type of the map that stores the predecessor
     1.6      ///arcs of the %DFS paths.
     1.7 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     1.8 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
     1.9      typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
    1.10 -    ///Instantiates a PredMap.
    1.11 +    ///Instantiates a \c PredMap.
    1.12  
    1.13 -    ///This function instantiates a PredMap.
    1.14 +    ///This function instantiates a \ref PredMap.
    1.15      ///\param g is the digraph, to which we would like to define the
    1.16 -    ///PredMap.
    1.17 +    ///\ref PredMap.
    1.18      static PredMap *createPredMap(const Digraph &g)
    1.19      {
    1.20        return new PredMap(g);
    1.21 @@ -62,13 +62,14 @@
    1.22      ///The type of the map that indicates which nodes are processed.
    1.23  
    1.24      ///The type of the map that indicates which nodes are processed.
    1.25 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    1.26 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    1.27 +    ///By default it is a NullMap.
    1.28      typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    1.29 -    ///Instantiates a ProcessedMap.
    1.30 +    ///Instantiates a \c ProcessedMap.
    1.31  
    1.32 -    ///This function instantiates a ProcessedMap.
    1.33 +    ///This function instantiates a \ref ProcessedMap.
    1.34      ///\param g is the digraph, to which
    1.35 -    ///we would like to define the ProcessedMap
    1.36 +    ///we would like to define the \ref ProcessedMap.
    1.37  #ifdef DOXYGEN
    1.38      static ProcessedMap *createProcessedMap(const Digraph &g)
    1.39  #else
    1.40 @@ -81,13 +82,13 @@
    1.41      ///The type of the map that indicates which nodes are reached.
    1.42  
    1.43      ///The type of the map that indicates which nodes are reached.
    1.44 -    ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    1.45 +    ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
    1.46      typedef typename Digraph::template NodeMap<bool> ReachedMap;
    1.47 -    ///Instantiates a ReachedMap.
    1.48 +    ///Instantiates a \c ReachedMap.
    1.49  
    1.50 -    ///This function instantiates a ReachedMap.
    1.51 +    ///This function instantiates a \ref ReachedMap.
    1.52      ///\param g is the digraph, to which
    1.53 -    ///we would like to define the ReachedMap.
    1.54 +    ///we would like to define the \ref ReachedMap.
    1.55      static ReachedMap *createReachedMap(const Digraph &g)
    1.56      {
    1.57        return new ReachedMap(g);
    1.58 @@ -96,13 +97,13 @@
    1.59      ///The type of the map that stores the distances of the nodes.
    1.60  
    1.61      ///The type of the map that stores the distances of the nodes.
    1.62 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    1.63 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    1.64      typedef typename Digraph::template NodeMap<int> DistMap;
    1.65 -    ///Instantiates a DistMap.
    1.66 +    ///Instantiates a \c DistMap.
    1.67  
    1.68 -    ///This function instantiates a DistMap.
    1.69 +    ///This function instantiates a \ref DistMap.
    1.70      ///\param g is the digraph, to which we would like to define the
    1.71 -    ///DistMap.
    1.72 +    ///\ref DistMap.
    1.73      static DistMap *createDistMap(const Digraph &g)
    1.74      {
    1.75        return new DistMap(g);
    1.76 @@ -206,7 +207,7 @@
    1.77  
    1.78      typedef Dfs Create;
    1.79  
    1.80 -    ///\name Named template parameters
    1.81 +    ///\name Named Template Parameters
    1.82  
    1.83      ///@{
    1.84  
    1.85 @@ -220,11 +221,11 @@
    1.86        }
    1.87      };
    1.88      ///\brief \ref named-templ-param "Named parameter" for setting
    1.89 -    ///PredMap type.
    1.90 +    ///\c PredMap type.
    1.91      ///
    1.92      ///\ref named-templ-param "Named parameter" for setting
    1.93 -    ///PredMap type.
    1.94 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    1.95 +    ///\c PredMap type.
    1.96 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    1.97      template <class T>
    1.98      struct SetPredMap : public Dfs<Digraph, SetPredMapTraits<T> > {
    1.99        typedef Dfs<Digraph, SetPredMapTraits<T> > Create;
   1.100 @@ -240,11 +241,11 @@
   1.101        }
   1.102      };
   1.103      ///\brief \ref named-templ-param "Named parameter" for setting
   1.104 -    ///DistMap type.
   1.105 +    ///\c DistMap type.
   1.106      ///
   1.107      ///\ref named-templ-param "Named parameter" for setting
   1.108 -    ///DistMap type.
   1.109 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
   1.110 +    ///\c DistMap type.
   1.111 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
   1.112      template <class T>
   1.113      struct SetDistMap : public Dfs< Digraph, SetDistMapTraits<T> > {
   1.114        typedef Dfs<Digraph, SetDistMapTraits<T> > Create;
   1.115 @@ -260,11 +261,11 @@
   1.116        }
   1.117      };
   1.118      ///\brief \ref named-templ-param "Named parameter" for setting
   1.119 -    ///ReachedMap type.
   1.120 +    ///\c ReachedMap type.
   1.121      ///
   1.122      ///\ref named-templ-param "Named parameter" for setting
   1.123 -    ///ReachedMap type.
   1.124 -    ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
   1.125 +    ///\c ReachedMap type.
   1.126 +    ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
   1.127      template <class T>
   1.128      struct SetReachedMap : public Dfs< Digraph, SetReachedMapTraits<T> > {
   1.129        typedef Dfs< Digraph, SetReachedMapTraits<T> > Create;
   1.130 @@ -280,11 +281,11 @@
   1.131        }
   1.132      };
   1.133      ///\brief \ref named-templ-param "Named parameter" for setting
   1.134 -    ///ProcessedMap type.
   1.135 +    ///\c ProcessedMap type.
   1.136      ///
   1.137      ///\ref named-templ-param "Named parameter" for setting
   1.138 -    ///ProcessedMap type.
   1.139 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
   1.140 +    ///\c ProcessedMap type.
   1.141 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
   1.142      template <class T>
   1.143      struct SetProcessedMap : public Dfs< Digraph, SetProcessedMapTraits<T> > {
   1.144        typedef Dfs< Digraph, SetProcessedMapTraits<T> > Create;
   1.145 @@ -298,10 +299,10 @@
   1.146        }
   1.147      };
   1.148      ///\brief \ref named-templ-param "Named parameter" for setting
   1.149 -    ///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
   1.150 +    ///\c ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
   1.151      ///
   1.152      ///\ref named-templ-param "Named parameter" for setting
   1.153 -    ///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
   1.154 +    ///\c ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
   1.155      ///If you don't set it explicitly, it will be automatically allocated.
   1.156      struct SetStandardProcessedMap :
   1.157        public Dfs< Digraph, SetStandardProcessedMapTraits > {
   1.158 @@ -411,8 +412,8 @@
   1.159      ///\name Execution Control
   1.160      ///The simplest way to execute the DFS algorithm is to use one of the
   1.161      ///member functions called \ref run(Node) "run()".\n
   1.162 -    ///If you need more control on the execution, first you have to call
   1.163 -    ///\ref init(), then you can add a source node with \ref addSource()
   1.164 +    ///If you need better control on the execution, you have to call
   1.165 +    ///\ref init() first, then you can add a source node with \ref addSource()
   1.166      ///and perform the actual computation with \ref start().
   1.167      ///This procedure can be repeated if there are nodes that have not
   1.168      ///been reached.
   1.169 @@ -669,9 +670,9 @@
   1.170  
   1.171      ///@{
   1.172  
   1.173 -    ///The DFS path to a node.
   1.174 +    ///The DFS path to the given node.
   1.175  
   1.176 -    ///Returns the DFS path to a node.
   1.177 +    ///Returns the DFS path to the given node from the root(s).
   1.178      ///
   1.179      ///\warning \c t should be reached from the root(s).
   1.180      ///
   1.181 @@ -679,9 +680,9 @@
   1.182      ///must be called before using this function.
   1.183      Path path(Node t) const { return Path(*G, *_pred, t); }
   1.184  
   1.185 -    ///The distance of a node from the root(s).
   1.186 +    ///The distance of the given node from the root(s).
   1.187  
   1.188 -    ///Returns the distance of a node from the root(s).
   1.189 +    ///Returns the distance of the given node from the root(s).
   1.190      ///
   1.191      ///\warning If node \c v is not reached from the root(s), then
   1.192      ///the return value of this function is undefined.
   1.193 @@ -690,7 +691,7 @@
   1.194      ///must be called before using this function.
   1.195      int dist(Node v) const { return (*_dist)[v]; }
   1.196  
   1.197 -    ///Returns the 'previous arc' of the %DFS tree for a node.
   1.198 +    ///Returns the 'previous arc' of the %DFS tree for the given node.
   1.199  
   1.200      ///This function returns the 'previous arc' of the %DFS tree for the
   1.201      ///node \c v, i.e. it returns the last arc of a %DFS path from a
   1.202 @@ -698,21 +699,21 @@
   1.203      ///root(s) or if \c v is a root.
   1.204      ///
   1.205      ///The %DFS tree used here is equal to the %DFS tree used in
   1.206 -    ///\ref predNode().
   1.207 +    ///\ref predNode() and \ref predMap().
   1.208      ///
   1.209      ///\pre Either \ref run(Node) "run()" or \ref init()
   1.210      ///must be called before using this function.
   1.211      Arc predArc(Node v) const { return (*_pred)[v];}
   1.212  
   1.213 -    ///Returns the 'previous node' of the %DFS tree.
   1.214 +    ///Returns the 'previous node' of the %DFS tree for the given node.
   1.215  
   1.216      ///This function returns the 'previous node' of the %DFS
   1.217      ///tree for the node \c v, i.e. it returns the last but one node
   1.218 -    ///from a %DFS path from a root to \c v. It is \c INVALID
   1.219 +    ///of a %DFS path from a root to \c v. It is \c INVALID
   1.220      ///if \c v is not reached from the root(s) or if \c v is a root.
   1.221      ///
   1.222      ///The %DFS tree used here is equal to the %DFS tree used in
   1.223 -    ///\ref predArc().
   1.224 +    ///\ref predArc() and \ref predMap().
   1.225      ///
   1.226      ///\pre Either \ref run(Node) "run()" or \ref init()
   1.227      ///must be called before using this function.
   1.228 @@ -733,13 +734,13 @@
   1.229      ///predecessor arcs.
   1.230      ///
   1.231      ///Returns a const reference to the node map that stores the predecessor
   1.232 -    ///arcs, which form the DFS tree.
   1.233 +    ///arcs, which form the DFS tree (forest).
   1.234      ///
   1.235      ///\pre Either \ref run(Node) "run()" or \ref init()
   1.236      ///must be called before using this function.
   1.237      const PredMap &predMap() const { return *_pred;}
   1.238  
   1.239 -    ///Checks if a node is reached from the root(s).
   1.240 +    ///Checks if the given node. node is reached from the root(s).
   1.241  
   1.242      ///Returns \c true if \c v is reached from the root(s).
   1.243      ///
   1.244 @@ -765,7 +766,7 @@
   1.245      ///
   1.246      ///The type of the map that stores the predecessor
   1.247      ///arcs of the %DFS paths.
   1.248 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
   1.249 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
   1.250      typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
   1.251      ///Instantiates a PredMap.
   1.252  
   1.253 @@ -780,7 +781,7 @@
   1.254      ///The type of the map that indicates which nodes are processed.
   1.255  
   1.256      ///The type of the map that indicates which nodes are processed.
   1.257 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
   1.258 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
   1.259      ///By default it is a NullMap.
   1.260      typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
   1.261      ///Instantiates a ProcessedMap.
   1.262 @@ -800,7 +801,7 @@
   1.263      ///The type of the map that indicates which nodes are reached.
   1.264  
   1.265      ///The type of the map that indicates which nodes are reached.
   1.266 -    ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
   1.267 +    ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
   1.268      typedef typename Digraph::template NodeMap<bool> ReachedMap;
   1.269      ///Instantiates a ReachedMap.
   1.270  
   1.271 @@ -815,7 +816,7 @@
   1.272      ///The type of the map that stores the distances of the nodes.
   1.273  
   1.274      ///The type of the map that stores the distances of the nodes.
   1.275 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
   1.276 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
   1.277      typedef typename Digraph::template NodeMap<int> DistMap;
   1.278      ///Instantiates a DistMap.
   1.279  
   1.280 @@ -830,18 +831,14 @@
   1.281      ///The type of the DFS paths.
   1.282  
   1.283      ///The type of the DFS paths.
   1.284 -    ///It must meet the \ref concepts::Path "Path" concept.
   1.285 +    ///It must conform to the \ref concepts::Path "Path" concept.
   1.286      typedef lemon::Path<Digraph> Path;
   1.287    };
   1.288  
   1.289    /// Default traits class used by DfsWizard
   1.290  
   1.291 -  /// To make it easier to use Dfs algorithm
   1.292 -  /// we have created a wizard class.
   1.293 -  /// This \ref DfsWizard class needs default traits,
   1.294 -  /// as well as the \ref Dfs class.
   1.295 -  /// The \ref DfsWizardBase is a class to be the default traits of the
   1.296 -  /// \ref DfsWizard class.
   1.297 +  /// Default traits class used by DfsWizard.
   1.298 +  /// \tparam GR The type of the digraph.
   1.299    template<class GR>
   1.300    class DfsWizardBase : public DfsWizardDefaultTraits<GR>
   1.301    {
   1.302 @@ -869,7 +866,7 @@
   1.303      public:
   1.304      /// Constructor.
   1.305  
   1.306 -    /// This constructor does not require parameters, therefore it initiates
   1.307 +    /// This constructor does not require parameters, it initiates
   1.308      /// all of the attributes to \c 0.
   1.309      DfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
   1.310                        _dist(0), _path(0), _di(0) {}
   1.311 @@ -899,7 +896,6 @@
   1.312    {
   1.313      typedef TR Base;
   1.314  
   1.315 -    ///The type of the digraph the algorithm runs on.
   1.316      typedef typename TR::Digraph Digraph;
   1.317  
   1.318      typedef typename Digraph::Node Node;
   1.319 @@ -907,16 +903,10 @@
   1.320      typedef typename Digraph::Arc Arc;
   1.321      typedef typename Digraph::OutArcIt OutArcIt;
   1.322  
   1.323 -    ///\brief The type of the map that stores the predecessor
   1.324 -    ///arcs of the DFS paths.
   1.325      typedef typename TR::PredMap PredMap;
   1.326 -    ///\brief The type of the map that stores the distances of the nodes.
   1.327      typedef typename TR::DistMap DistMap;
   1.328 -    ///\brief The type of the map that indicates which nodes are reached.
   1.329      typedef typename TR::ReachedMap ReachedMap;
   1.330 -    ///\brief The type of the map that indicates which nodes are processed.
   1.331      typedef typename TR::ProcessedMap ProcessedMap;
   1.332 -    ///The type of the DFS paths
   1.333      typedef typename TR::Path Path;
   1.334  
   1.335    public:
   1.336 @@ -999,11 +989,12 @@
   1.337        static PredMap *createPredMap(const Digraph &) { return 0; };
   1.338        SetPredMapBase(const TR &b) : TR(b) {}
   1.339      };
   1.340 -    ///\brief \ref named-func-param "Named parameter"
   1.341 -    ///for setting PredMap object.
   1.342 +
   1.343 +    ///\brief \ref named-templ-param "Named parameter" for setting
   1.344 +    ///the predecessor map.
   1.345      ///
   1.346 -    ///\ref named-func-param "Named parameter"
   1.347 -    ///for setting PredMap object.
   1.348 +    ///\ref named-templ-param "Named parameter" function for setting
   1.349 +    ///the map that stores the predecessor arcs of the nodes.
   1.350      template<class T>
   1.351      DfsWizard<SetPredMapBase<T> > predMap(const T &t)
   1.352      {
   1.353 @@ -1017,11 +1008,12 @@
   1.354        static ReachedMap *createReachedMap(const Digraph &) { return 0; };
   1.355        SetReachedMapBase(const TR &b) : TR(b) {}
   1.356      };
   1.357 -    ///\brief \ref named-func-param "Named parameter"
   1.358 -    ///for setting ReachedMap object.
   1.359 +
   1.360 +    ///\brief \ref named-templ-param "Named parameter" for setting
   1.361 +    ///the reached map.
   1.362      ///
   1.363 -    /// \ref named-func-param "Named parameter"
   1.364 -    ///for setting ReachedMap object.
   1.365 +    ///\ref named-templ-param "Named parameter" function for setting
   1.366 +    ///the map that indicates which nodes are reached.
   1.367      template<class T>
   1.368      DfsWizard<SetReachedMapBase<T> > reachedMap(const T &t)
   1.369      {
   1.370 @@ -1035,11 +1027,13 @@
   1.371        static DistMap *createDistMap(const Digraph &) { return 0; };
   1.372        SetDistMapBase(const TR &b) : TR(b) {}
   1.373      };
   1.374 -    ///\brief \ref named-func-param "Named parameter"
   1.375 -    ///for setting DistMap object.
   1.376 +
   1.377 +    ///\brief \ref named-templ-param "Named parameter" for setting
   1.378 +    ///the distance map.
   1.379      ///
   1.380 -    /// \ref named-func-param "Named parameter"
   1.381 -    ///for setting DistMap object.
   1.382 +    ///\ref named-templ-param "Named parameter" function for setting
   1.383 +    ///the map that stores the distances of the nodes calculated
   1.384 +    ///by the algorithm.
   1.385      template<class T>
   1.386      DfsWizard<SetDistMapBase<T> > distMap(const T &t)
   1.387      {
   1.388 @@ -1053,11 +1047,12 @@
   1.389        static ProcessedMap *createProcessedMap(const Digraph &) { return 0; };
   1.390        SetProcessedMapBase(const TR &b) : TR(b) {}
   1.391      };
   1.392 -    ///\brief \ref named-func-param "Named parameter"
   1.393 -    ///for setting ProcessedMap object.
   1.394 +
   1.395 +    ///\brief \ref named-func-param "Named parameter" for setting
   1.396 +    ///the processed map.
   1.397      ///
   1.398 -    /// \ref named-func-param "Named parameter"
   1.399 -    ///for setting ProcessedMap object.
   1.400 +    ///\ref named-templ-param "Named parameter" function for setting
   1.401 +    ///the map that indicates which nodes are processed.
   1.402      template<class T>
   1.403      DfsWizard<SetProcessedMapBase<T> > processedMap(const T &t)
   1.404      {
   1.405 @@ -1126,9 +1121,9 @@
   1.406    ///
   1.407    /// This class defines the interface of the DfsVisit events, and
   1.408    /// it could be the base of a real visitor class.
   1.409 -  template <typename _Digraph>
   1.410 +  template <typename GR>
   1.411    struct DfsVisitor {
   1.412 -    typedef _Digraph Digraph;
   1.413 +    typedef GR Digraph;
   1.414      typedef typename Digraph::Arc Arc;
   1.415      typedef typename Digraph::Node Node;
   1.416      /// \brief Called for the source node of the DFS.
   1.417 @@ -1164,9 +1159,9 @@
   1.418      void backtrack(const Arc& arc) {}
   1.419    };
   1.420  #else
   1.421 -  template <typename _Digraph>
   1.422 +  template <typename GR>
   1.423    struct DfsVisitor {
   1.424 -    typedef _Digraph Digraph;
   1.425 +    typedef GR Digraph;
   1.426      typedef typename Digraph::Arc Arc;
   1.427      typedef typename Digraph::Node Node;
   1.428      void start(const Node&) {}
   1.429 @@ -1199,16 +1194,16 @@
   1.430    ///
   1.431    /// Default traits class of DfsVisit class.
   1.432    /// \tparam _Digraph The type of the digraph the algorithm runs on.
   1.433 -  template<class _Digraph>
   1.434 +  template<class GR>
   1.435    struct DfsVisitDefaultTraits {
   1.436  
   1.437      /// \brief The type of the digraph the algorithm runs on.
   1.438 -    typedef _Digraph Digraph;
   1.439 +    typedef GR Digraph;
   1.440  
   1.441      /// \brief The type of the map that indicates which nodes are reached.
   1.442      ///
   1.443      /// The type of the map that indicates which nodes are reached.
   1.444 -    /// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
   1.445 +    /// It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
   1.446      typedef typename Digraph::template NodeMap<bool> ReachedMap;
   1.447  
   1.448      /// \brief Instantiates a ReachedMap.
   1.449 @@ -1224,12 +1219,12 @@
   1.450  
   1.451    /// \ingroup search
   1.452    ///
   1.453 -  /// \brief %DFS algorithm class with visitor interface.
   1.454 +  /// \brief DFS algorithm class with visitor interface.
   1.455    ///
   1.456 -  /// This class provides an efficient implementation of the %DFS algorithm
   1.457 +  /// This class provides an efficient implementation of the DFS algorithm
   1.458    /// with visitor interface.
   1.459    ///
   1.460 -  /// The %DfsVisit class provides an alternative interface to the Dfs
   1.461 +  /// The DfsVisit class provides an alternative interface to the Dfs
   1.462    /// class. It works with callback mechanism, the DfsVisit object calls
   1.463    /// the member functions of the \c Visitor class on every DFS event.
   1.464    ///
   1.465 @@ -1238,37 +1233,37 @@
   1.466    /// events of the DFS algorithm. Otherwise consider to use Dfs or dfs()
   1.467    /// instead.
   1.468    ///
   1.469 -  /// \tparam _Digraph The type of the digraph the algorithm runs on.
   1.470 -  /// The default value is
   1.471 -  /// \ref ListDigraph. The value of _Digraph is not used directly by
   1.472 -  /// \ref DfsVisit, it is only passed to \ref DfsVisitDefaultTraits.
   1.473 -  /// \tparam _Visitor The Visitor type that is used by the algorithm.
   1.474 -  /// \ref DfsVisitor "DfsVisitor<_Digraph>" is an empty visitor, which
   1.475 +  /// \tparam GR The type of the digraph the algorithm runs on.
   1.476 +  /// The default type is \ref ListDigraph.
   1.477 +  /// The value of GR is not used directly by \ref DfsVisit,
   1.478 +  /// it is only passed to \ref DfsVisitDefaultTraits.
   1.479 +  /// \tparam VS The Visitor type that is used by the algorithm.
   1.480 +  /// \ref DfsVisitor "DfsVisitor<GR>" is an empty visitor, which
   1.481    /// does not observe the DFS events. If you want to observe the DFS
   1.482    /// events, you should implement your own visitor class.
   1.483 -  /// \tparam _Traits Traits class to set various data types used by the
   1.484 +  /// \tparam TR Traits class to set various data types used by the
   1.485    /// algorithm. The default traits class is
   1.486 -  /// \ref DfsVisitDefaultTraits "DfsVisitDefaultTraits<_Digraph>".
   1.487 +  /// \ref DfsVisitDefaultTraits "DfsVisitDefaultTraits<GR>".
   1.488    /// See \ref DfsVisitDefaultTraits for the documentation of
   1.489    /// a DFS visit traits class.
   1.490  #ifdef DOXYGEN
   1.491 -  template <typename _Digraph, typename _Visitor, typename _Traits>
   1.492 +  template <typename GR, typename VS, typename TR>
   1.493  #else
   1.494 -  template <typename _Digraph = ListDigraph,
   1.495 -            typename _Visitor = DfsVisitor<_Digraph>,
   1.496 -            typename _Traits = DfsVisitDefaultTraits<_Digraph> >
   1.497 +  template <typename GR = ListDigraph,
   1.498 +            typename VS = DfsVisitor<GR>,
   1.499 +            typename TR = DfsVisitDefaultTraits<GR> >
   1.500  #endif
   1.501    class DfsVisit {
   1.502    public:
   1.503  
   1.504      ///The traits class.
   1.505 -    typedef _Traits Traits;
   1.506 +    typedef TR Traits;
   1.507  
   1.508      ///The type of the digraph the algorithm runs on.
   1.509      typedef typename Traits::Digraph Digraph;
   1.510  
   1.511      ///The visitor type used by the algorithm.
   1.512 -    typedef _Visitor Visitor;
   1.513 +    typedef VS Visitor;
   1.514  
   1.515      ///The type of the map that indicates which nodes are reached.
   1.516      typedef typename Traits::ReachedMap ReachedMap;
   1.517 @@ -1369,8 +1364,8 @@
   1.518      /// \name Execution Control
   1.519      /// The simplest way to execute the DFS algorithm is to use one of the
   1.520      /// member functions called \ref run(Node) "run()".\n
   1.521 -    /// If you need more control on the execution, first you have to call
   1.522 -    /// \ref init(), then you can add a source node with \ref addSource()
   1.523 +    /// If you need better control on the execution, you have to call
   1.524 +    /// \ref init() first, then you can add a source node with \ref addSource()
   1.525      /// and perform the actual computation with \ref start().
   1.526      /// This procedure can be repeated if there are nodes that have not
   1.527      /// been reached.
   1.528 @@ -1620,7 +1615,7 @@
   1.529  
   1.530      ///@{
   1.531  
   1.532 -    /// \brief Checks if a node is reached from the root(s).
   1.533 +    /// \brief Checks if the given node is reached from the root(s).
   1.534      ///
   1.535      /// Returns \c true if \c v is reached from the root(s).
   1.536      ///