lemon/bfs.h
changeset 783 ef88c0a30f85
parent 716 f47b6c94577e
parent 713 4ac30454f1c1
child 786 e20173729589
child 787 c2230649a493
     1.1 --- a/lemon/bfs.h	Mon Jan 12 23:11:39 2009 +0100
     1.2 +++ b/lemon/bfs.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 shortest 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 @@ -221,11 +222,11 @@
    1.77        }
    1.78      };
    1.79      ///\brief \ref named-templ-param "Named parameter" for setting
    1.80 -    ///PredMap type.
    1.81 +    ///\c PredMap type.
    1.82      ///
    1.83      ///\ref named-templ-param "Named parameter" for setting
    1.84 -    ///PredMap type.
    1.85 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    1.86 +    ///\c PredMap type.
    1.87 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
    1.88      template <class T>
    1.89      struct SetPredMap : public Bfs< Digraph, SetPredMapTraits<T> > {
    1.90        typedef Bfs< Digraph, SetPredMapTraits<T> > Create;
    1.91 @@ -241,11 +242,11 @@
    1.92        }
    1.93      };
    1.94      ///\brief \ref named-templ-param "Named parameter" for setting
    1.95 -    ///DistMap type.
    1.96 +    ///\c DistMap type.
    1.97      ///
    1.98      ///\ref named-templ-param "Named parameter" for setting
    1.99 -    ///DistMap type.
   1.100 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
   1.101 +    ///\c DistMap type.
   1.102 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
   1.103      template <class T>
   1.104      struct SetDistMap : public Bfs< Digraph, SetDistMapTraits<T> > {
   1.105        typedef Bfs< Digraph, SetDistMapTraits<T> > Create;
   1.106 @@ -261,11 +262,11 @@
   1.107        }
   1.108      };
   1.109      ///\brief \ref named-templ-param "Named parameter" for setting
   1.110 -    ///ReachedMap type.
   1.111 +    ///\c ReachedMap type.
   1.112      ///
   1.113      ///\ref named-templ-param "Named parameter" for setting
   1.114 -    ///ReachedMap type.
   1.115 -    ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
   1.116 +    ///\c ReachedMap type.
   1.117 +    ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
   1.118      template <class T>
   1.119      struct SetReachedMap : public Bfs< Digraph, SetReachedMapTraits<T> > {
   1.120        typedef Bfs< Digraph, SetReachedMapTraits<T> > Create;
   1.121 @@ -281,11 +282,11 @@
   1.122        }
   1.123      };
   1.124      ///\brief \ref named-templ-param "Named parameter" for setting
   1.125 -    ///ProcessedMap type.
   1.126 +    ///\c ProcessedMap type.
   1.127      ///
   1.128      ///\ref named-templ-param "Named parameter" for setting
   1.129 -    ///ProcessedMap type.
   1.130 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
   1.131 +    ///\c ProcessedMap type.
   1.132 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
   1.133      template <class T>
   1.134      struct SetProcessedMap : public Bfs< Digraph, SetProcessedMapTraits<T> > {
   1.135        typedef Bfs< Digraph, SetProcessedMapTraits<T> > Create;
   1.136 @@ -300,10 +301,10 @@
   1.137        }
   1.138      };
   1.139      ///\brief \ref named-templ-param "Named parameter" for setting
   1.140 -    ///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
   1.141 +    ///\c ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
   1.142      ///
   1.143      ///\ref named-templ-param "Named parameter" for setting
   1.144 -    ///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
   1.145 +    ///\c ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
   1.146      ///If you don't set it explicitly, it will be automatically allocated.
   1.147      struct SetStandardProcessedMap :
   1.148        public Bfs< Digraph, SetStandardProcessedMapTraits > {
   1.149 @@ -413,8 +414,8 @@
   1.150      ///\name Execution Control
   1.151      ///The simplest way to execute the BFS algorithm is to use one of the
   1.152      ///member functions called \ref run(Node) "run()".\n
   1.153 -    ///If you need more control on the execution, first you have to call
   1.154 -    ///\ref init(), then you can add several source nodes with
   1.155 +    ///If you need better control on the execution, you have to call
   1.156 +    ///\ref init() first, then you can add several source nodes with
   1.157      ///\ref addSource(). Finally the actual path computation can be
   1.158      ///performed with one of the \ref start() functions.
   1.159  
   1.160 @@ -737,9 +738,9 @@
   1.161  
   1.162      ///@{
   1.163  
   1.164 -    ///The shortest path to a node.
   1.165 +    ///The shortest path to the given node.
   1.166  
   1.167 -    ///Returns the shortest path to a node.
   1.168 +    ///Returns the shortest path to the given node from the root(s).
   1.169      ///
   1.170      ///\warning \c t should be reached from the root(s).
   1.171      ///
   1.172 @@ -747,9 +748,9 @@
   1.173      ///must be called before using this function.
   1.174      Path path(Node t) const { return Path(*G, *_pred, t); }
   1.175  
   1.176 -    ///The distance of a node from the root(s).
   1.177 +    ///The distance of the given node from the root(s).
   1.178  
   1.179 -    ///Returns the distance of a node from the root(s).
   1.180 +    ///Returns the distance of the given node from the root(s).
   1.181      ///
   1.182      ///\warning If node \c v is not reached from the root(s), then
   1.183      ///the return value of this function is undefined.
   1.184 @@ -758,29 +759,31 @@
   1.185      ///must be called before using this function.
   1.186      int dist(Node v) const { return (*_dist)[v]; }
   1.187  
   1.188 -    ///Returns the 'previous arc' of the shortest path tree for a node.
   1.189 -
   1.190 +    ///\brief Returns the 'previous arc' of the shortest path tree for
   1.191 +    ///the given node.
   1.192 +    ///
   1.193      ///This function returns the 'previous arc' of the shortest path
   1.194      ///tree for the node \c v, i.e. it returns the last arc of a
   1.195      ///shortest path from a root to \c v. It is \c INVALID if \c v
   1.196      ///is not reached from the root(s) or if \c v is a root.
   1.197      ///
   1.198      ///The shortest path tree used here is equal to the shortest path
   1.199 -    ///tree used in \ref predNode().
   1.200 +    ///tree used in \ref predNode() and \ref predMap().
   1.201      ///
   1.202      ///\pre Either \ref run(Node) "run()" or \ref init()
   1.203      ///must be called before using this function.
   1.204      Arc predArc(Node v) const { return (*_pred)[v];}
   1.205  
   1.206 -    ///Returns the 'previous node' of the shortest path tree for a node.
   1.207 -
   1.208 +    ///\brief Returns the 'previous node' of the shortest path tree for
   1.209 +    ///the given node.
   1.210 +    ///
   1.211      ///This function returns the 'previous node' of the shortest path
   1.212      ///tree for the node \c v, i.e. it returns the last but one node
   1.213 -    ///from a shortest path from a root to \c v. It is \c INVALID
   1.214 +    ///of a shortest path from a root to \c v. It is \c INVALID
   1.215      ///if \c v is not reached from the root(s) or if \c v is a root.
   1.216      ///
   1.217      ///The shortest path tree used here is equal to the shortest path
   1.218 -    ///tree used in \ref predArc().
   1.219 +    ///tree used in \ref predArc() and \ref predMap().
   1.220      ///
   1.221      ///\pre Either \ref run(Node) "run()" or \ref init()
   1.222      ///must be called before using this function.
   1.223 @@ -801,13 +804,13 @@
   1.224      ///predecessor arcs.
   1.225      ///
   1.226      ///Returns a const reference to the node map that stores the predecessor
   1.227 -    ///arcs, which form the shortest path tree.
   1.228 +    ///arcs, which form the shortest path tree (forest).
   1.229      ///
   1.230      ///\pre Either \ref run(Node) "run()" or \ref init()
   1.231      ///must be called before using this function.
   1.232      const PredMap &predMap() const { return *_pred;}
   1.233  
   1.234 -    ///Checks if a node is reached from the root(s).
   1.235 +    ///Checks if the given node is reached from the root(s).
   1.236  
   1.237      ///Returns \c true if \c v is reached from the root(s).
   1.238      ///
   1.239 @@ -833,7 +836,7 @@
   1.240      ///
   1.241      ///The type of the map that stores the predecessor
   1.242      ///arcs of the shortest paths.
   1.243 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
   1.244 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
   1.245      typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
   1.246      ///Instantiates a PredMap.
   1.247  
   1.248 @@ -848,7 +851,7 @@
   1.249      ///The type of the map that indicates which nodes are processed.
   1.250  
   1.251      ///The type of the map that indicates which nodes are processed.
   1.252 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
   1.253 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
   1.254      ///By default it is a NullMap.
   1.255      typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
   1.256      ///Instantiates a ProcessedMap.
   1.257 @@ -868,7 +871,7 @@
   1.258      ///The type of the map that indicates which nodes are reached.
   1.259  
   1.260      ///The type of the map that indicates which nodes are reached.
   1.261 -    ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
   1.262 +    ///It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
   1.263      typedef typename Digraph::template NodeMap<bool> ReachedMap;
   1.264      ///Instantiates a ReachedMap.
   1.265  
   1.266 @@ -883,7 +886,7 @@
   1.267      ///The type of the map that stores the distances of the nodes.
   1.268  
   1.269      ///The type of the map that stores the distances of the nodes.
   1.270 -    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
   1.271 +    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
   1.272      typedef typename Digraph::template NodeMap<int> DistMap;
   1.273      ///Instantiates a DistMap.
   1.274  
   1.275 @@ -898,18 +901,14 @@
   1.276      ///The type of the shortest paths.
   1.277  
   1.278      ///The type of the shortest paths.
   1.279 -    ///It must meet the \ref concepts::Path "Path" concept.
   1.280 +    ///It must conform to the \ref concepts::Path "Path" concept.
   1.281      typedef lemon::Path<Digraph> Path;
   1.282    };
   1.283  
   1.284    /// Default traits class used by BfsWizard
   1.285  
   1.286 -  /// To make it easier to use Bfs algorithm
   1.287 -  /// we have created a wizard class.
   1.288 -  /// This \ref BfsWizard class needs default traits,
   1.289 -  /// as well as the \ref Bfs class.
   1.290 -  /// The \ref BfsWizardBase is a class to be the default traits of the
   1.291 -  /// \ref BfsWizard class.
   1.292 +  /// Default traits class used by BfsWizard.
   1.293 +  /// \tparam GR The type of the digraph.
   1.294    template<class GR>
   1.295    class BfsWizardBase : public BfsWizardDefaultTraits<GR>
   1.296    {
   1.297 @@ -937,7 +936,7 @@
   1.298      public:
   1.299      /// Constructor.
   1.300  
   1.301 -    /// This constructor does not require parameters, therefore it initiates
   1.302 +    /// This constructor does not require parameters, it initiates
   1.303      /// all of the attributes to \c 0.
   1.304      BfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
   1.305                        _dist(0), _path(0), _di(0) {}
   1.306 @@ -967,7 +966,6 @@
   1.307    {
   1.308      typedef TR Base;
   1.309  
   1.310 -    ///The type of the digraph the algorithm runs on.
   1.311      typedef typename TR::Digraph Digraph;
   1.312  
   1.313      typedef typename Digraph::Node Node;
   1.314 @@ -975,16 +973,10 @@
   1.315      typedef typename Digraph::Arc Arc;
   1.316      typedef typename Digraph::OutArcIt OutArcIt;
   1.317  
   1.318 -    ///\brief The type of the map that stores the predecessor
   1.319 -    ///arcs of the shortest paths.
   1.320      typedef typename TR::PredMap PredMap;
   1.321 -    ///\brief The type of the map that stores the distances of the nodes.
   1.322      typedef typename TR::DistMap DistMap;
   1.323 -    ///\brief The type of the map that indicates which nodes are reached.
   1.324      typedef typename TR::ReachedMap ReachedMap;
   1.325 -    ///\brief The type of the map that indicates which nodes are processed.
   1.326      typedef typename TR::ProcessedMap ProcessedMap;
   1.327 -    ///The type of the shortest paths
   1.328      typedef typename TR::Path Path;
   1.329  
   1.330    public:
   1.331 @@ -1067,11 +1059,12 @@
   1.332        static PredMap *createPredMap(const Digraph &) { return 0; };
   1.333        SetPredMapBase(const TR &b) : TR(b) {}
   1.334      };
   1.335 -    ///\brief \ref named-func-param "Named parameter"
   1.336 -    ///for setting PredMap object.
   1.337 +
   1.338 +    ///\brief \ref named-templ-param "Named parameter" for setting
   1.339 +    ///the predecessor map.
   1.340      ///
   1.341 -    ///\ref named-func-param "Named parameter"
   1.342 -    ///for setting PredMap object.
   1.343 +    ///\ref named-templ-param "Named parameter" function for setting
   1.344 +    ///the map that stores the predecessor arcs of the nodes.
   1.345      template<class T>
   1.346      BfsWizard<SetPredMapBase<T> > predMap(const T &t)
   1.347      {
   1.348 @@ -1085,11 +1078,12 @@
   1.349        static ReachedMap *createReachedMap(const Digraph &) { return 0; };
   1.350        SetReachedMapBase(const TR &b) : TR(b) {}
   1.351      };
   1.352 -    ///\brief \ref named-func-param "Named parameter"
   1.353 -    ///for setting ReachedMap object.
   1.354 +
   1.355 +    ///\brief \ref named-templ-param "Named parameter" for setting
   1.356 +    ///the reached map.
   1.357      ///
   1.358 -    /// \ref named-func-param "Named parameter"
   1.359 -    ///for setting ReachedMap object.
   1.360 +    ///\ref named-templ-param "Named parameter" function for setting
   1.361 +    ///the map that indicates which nodes are reached.
   1.362      template<class T>
   1.363      BfsWizard<SetReachedMapBase<T> > reachedMap(const T &t)
   1.364      {
   1.365 @@ -1103,11 +1097,13 @@
   1.366        static DistMap *createDistMap(const Digraph &) { return 0; };
   1.367        SetDistMapBase(const TR &b) : TR(b) {}
   1.368      };
   1.369 -    ///\brief \ref named-func-param "Named parameter"
   1.370 -    ///for setting DistMap object.
   1.371 +
   1.372 +    ///\brief \ref named-templ-param "Named parameter" for setting
   1.373 +    ///the distance map.
   1.374      ///
   1.375 -    /// \ref named-func-param "Named parameter"
   1.376 -    ///for setting DistMap object.
   1.377 +    ///\ref named-templ-param "Named parameter" function for setting
   1.378 +    ///the map that stores the distances of the nodes calculated
   1.379 +    ///by the algorithm.
   1.380      template<class T>
   1.381      BfsWizard<SetDistMapBase<T> > distMap(const T &t)
   1.382      {
   1.383 @@ -1121,11 +1117,12 @@
   1.384        static ProcessedMap *createProcessedMap(const Digraph &) { return 0; };
   1.385        SetProcessedMapBase(const TR &b) : TR(b) {}
   1.386      };
   1.387 -    ///\brief \ref named-func-param "Named parameter"
   1.388 -    ///for setting ProcessedMap object.
   1.389 +
   1.390 +    ///\brief \ref named-func-param "Named parameter" for setting
   1.391 +    ///the processed map.
   1.392      ///
   1.393 -    /// \ref named-func-param "Named parameter"
   1.394 -    ///for setting ProcessedMap object.
   1.395 +    ///\ref named-templ-param "Named parameter" function for setting
   1.396 +    ///the map that indicates which nodes are processed.
   1.397      template<class T>
   1.398      BfsWizard<SetProcessedMapBase<T> > processedMap(const T &t)
   1.399      {
   1.400 @@ -1194,9 +1191,9 @@
   1.401    ///
   1.402    /// This class defines the interface of the BfsVisit events, and
   1.403    /// it could be the base of a real visitor class.
   1.404 -  template <typename _Digraph>
   1.405 +  template <typename GR>
   1.406    struct BfsVisitor {
   1.407 -    typedef _Digraph Digraph;
   1.408 +    typedef GR Digraph;
   1.409      typedef typename Digraph::Arc Arc;
   1.410      typedef typename Digraph::Node Node;
   1.411      /// \brief Called for the source node(s) of the BFS.
   1.412 @@ -1224,9 +1221,9 @@
   1.413      void examine(const Arc& arc) {}
   1.414    };
   1.415  #else
   1.416 -  template <typename _Digraph>
   1.417 +  template <typename GR>
   1.418    struct BfsVisitor {
   1.419 -    typedef _Digraph Digraph;
   1.420 +    typedef GR Digraph;
   1.421      typedef typename Digraph::Arc Arc;
   1.422      typedef typename Digraph::Node Node;
   1.423      void start(const Node&) {}
   1.424 @@ -1254,17 +1251,17 @@
   1.425    /// \brief Default traits class of BfsVisit class.
   1.426    ///
   1.427    /// Default traits class of BfsVisit class.
   1.428 -  /// \tparam _Digraph The type of the digraph the algorithm runs on.
   1.429 -  template<class _Digraph>
   1.430 +  /// \tparam GR The type of the digraph the algorithm runs on.
   1.431 +  template<class GR>
   1.432    struct BfsVisitDefaultTraits {
   1.433  
   1.434      /// \brief The type of the digraph the algorithm runs on.
   1.435 -    typedef _Digraph Digraph;
   1.436 +    typedef GR Digraph;
   1.437  
   1.438      /// \brief The type of the map that indicates which nodes are reached.
   1.439      ///
   1.440      /// The type of the map that indicates which nodes are reached.
   1.441 -    /// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
   1.442 +    /// It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
   1.443      typedef typename Digraph::template NodeMap<bool> ReachedMap;
   1.444  
   1.445      /// \brief Instantiates a ReachedMap.
   1.446 @@ -1280,12 +1277,12 @@
   1.447  
   1.448    /// \ingroup search
   1.449    ///
   1.450 -  /// \brief %BFS algorithm class with visitor interface.
   1.451 +  /// \brief BFS algorithm class with visitor interface.
   1.452    ///
   1.453 -  /// This class provides an efficient implementation of the %BFS algorithm
   1.454 +  /// This class provides an efficient implementation of the BFS algorithm
   1.455    /// with visitor interface.
   1.456    ///
   1.457 -  /// The %BfsVisit class provides an alternative interface to the Bfs
   1.458 +  /// The BfsVisit class provides an alternative interface to the Bfs
   1.459    /// class. It works with callback mechanism, the BfsVisit object calls
   1.460    /// the member functions of the \c Visitor class on every BFS event.
   1.461    ///
   1.462 @@ -1294,37 +1291,37 @@
   1.463    /// events of the BFS algorithm. Otherwise consider to use Bfs or bfs()
   1.464    /// instead.
   1.465    ///
   1.466 -  /// \tparam _Digraph The type of the digraph the algorithm runs on.
   1.467 -  /// The default value is
   1.468 -  /// \ref ListDigraph. The value of _Digraph is not used directly by
   1.469 -  /// \ref BfsVisit, it is only passed to \ref BfsVisitDefaultTraits.
   1.470 -  /// \tparam _Visitor The Visitor type that is used by the algorithm.
   1.471 -  /// \ref BfsVisitor "BfsVisitor<_Digraph>" is an empty visitor, which
   1.472 +  /// \tparam GR The type of the digraph the algorithm runs on.
   1.473 +  /// The default type is \ref ListDigraph.
   1.474 +  /// The value of GR is not used directly by \ref BfsVisit,
   1.475 +  /// it is only passed to \ref BfsVisitDefaultTraits.
   1.476 +  /// \tparam VS The Visitor type that is used by the algorithm.
   1.477 +  /// \ref BfsVisitor "BfsVisitor<GR>" is an empty visitor, which
   1.478    /// does not observe the BFS events. If you want to observe the BFS
   1.479    /// events, you should implement your own visitor class.
   1.480 -  /// \tparam _Traits Traits class to set various data types used by the
   1.481 +  /// \tparam TR Traits class to set various data types used by the
   1.482    /// algorithm. The default traits class is
   1.483 -  /// \ref BfsVisitDefaultTraits "BfsVisitDefaultTraits<_Digraph>".
   1.484 +  /// \ref BfsVisitDefaultTraits "BfsVisitDefaultTraits<GR>".
   1.485    /// See \ref BfsVisitDefaultTraits for the documentation of
   1.486    /// a BFS visit traits class.
   1.487  #ifdef DOXYGEN
   1.488 -  template <typename _Digraph, typename _Visitor, typename _Traits>
   1.489 +  template <typename GR, typename VS, typename TR>
   1.490  #else
   1.491 -  template <typename _Digraph = ListDigraph,
   1.492 -            typename _Visitor = BfsVisitor<_Digraph>,
   1.493 -            typename _Traits = BfsVisitDefaultTraits<_Digraph> >
   1.494 +  template <typename GR = ListDigraph,
   1.495 +            typename VS = BfsVisitor<GR>,
   1.496 +            typename TR = BfsVisitDefaultTraits<GR> >
   1.497  #endif
   1.498    class BfsVisit {
   1.499    public:
   1.500  
   1.501      ///The traits class.
   1.502 -    typedef _Traits Traits;
   1.503 +    typedef TR Traits;
   1.504  
   1.505      ///The type of the digraph the algorithm runs on.
   1.506      typedef typename Traits::Digraph Digraph;
   1.507  
   1.508      ///The visitor type used by the algorithm.
   1.509 -    typedef _Visitor Visitor;
   1.510 +    typedef VS Visitor;
   1.511  
   1.512      ///The type of the map that indicates which nodes are reached.
   1.513      typedef typename Traits::ReachedMap ReachedMap;
   1.514 @@ -1425,8 +1422,8 @@
   1.515      /// \name Execution Control
   1.516      /// The simplest way to execute the BFS algorithm is to use one of the
   1.517      /// member functions called \ref run(Node) "run()".\n
   1.518 -    /// If you need more control on the execution, first you have to call
   1.519 -    /// \ref init(), then you can add several source nodes with
   1.520 +    /// If you need better control on the execution, you have to call
   1.521 +    /// \ref init() first, then you can add several source nodes with
   1.522      /// \ref addSource(). Finally the actual path computation can be
   1.523      /// performed with one of the \ref start() functions.
   1.524  
   1.525 @@ -1735,7 +1732,7 @@
   1.526  
   1.527      ///@{
   1.528  
   1.529 -    /// \brief Checks if a node is reached from the root(s).
   1.530 +    /// \brief Checks if the given node is reached from the root(s).
   1.531      ///
   1.532      /// Returns \c true if \c v is reached from the root(s).
   1.533      ///