Index: lemon/dfs.h
===================================================================
--- lemon/dfs.h	(revision 956)
+++ lemon/dfs.h	(revision 1007)
@@ -3,5 +3,5 @@
  * This file is a part of LEMON, a generic C++ optimization library.
  *
- * Copyright (C) 2003-2010
+ * Copyright (C) 2003-2008
  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
  * (Egervary Research Group on Combinatorial Optimization, EGRES).
@@ -48,11 +48,11 @@
     ///The type of the map that stores the predecessor
     ///arcs of the %DFS paths.
-    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
+    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
-    ///Instantiates a \c PredMap.
-
-    ///This function instantiates a \ref PredMap.
+    ///Instantiates a PredMap.
+
+    ///This function instantiates a PredMap.
     ///\param g is the digraph, to which we would like to define the
-    ///\ref PredMap.
+    ///PredMap.
     static PredMap *createPredMap(const Digraph &g)
     {
@@ -63,12 +63,11 @@
 
     ///The type of the map that indicates which nodes are processed.
-    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
-    ///By default, it is a NullMap.
+    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
-    ///Instantiates a \c ProcessedMap.
-
-    ///This function instantiates a \ref ProcessedMap.
+    ///Instantiates a ProcessedMap.
+
+    ///This function instantiates a ProcessedMap.
     ///\param g is the digraph, to which
-    ///we would like to define the \ref ProcessedMap.
+    ///we would like to define the ProcessedMap
 #ifdef DOXYGEN
     static ProcessedMap *createProcessedMap(const Digraph &g)
@@ -83,12 +82,11 @@
 
     ///The type of the map that indicates which nodes are reached.
-    ///It must conform to
-    ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
+    ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     typedef typename Digraph::template NodeMap<bool> ReachedMap;
-    ///Instantiates a \c ReachedMap.
-
-    ///This function instantiates a \ref ReachedMap.
+    ///Instantiates a ReachedMap.
+
+    ///This function instantiates a ReachedMap.
     ///\param g is the digraph, to which
-    ///we would like to define the \ref ReachedMap.
+    ///we would like to define the ReachedMap.
     static ReachedMap *createReachedMap(const Digraph &g)
     {
@@ -99,11 +97,11 @@
 
     ///The type of the map that stores the distances of the nodes.
-    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
+    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     typedef typename Digraph::template NodeMap<int> DistMap;
-    ///Instantiates a \c DistMap.
-
-    ///This function instantiates a \ref DistMap.
+    ///Instantiates a DistMap.
+
+    ///This function instantiates a DistMap.
     ///\param g is the digraph, to which we would like to define the
-    ///\ref DistMap.
+    ///DistMap.
     static DistMap *createDistMap(const Digraph &g)
     {
@@ -122,10 +120,11 @@
   ///
   ///\tparam GR The type of the digraph the algorithm runs on.
-  ///The default type is \ref ListDigraph.
-  ///\tparam TR The traits class that defines various types used by the
-  ///algorithm. By default, it is \ref DfsDefaultTraits
-  ///"DfsDefaultTraits<GR>".
-  ///In most cases, this parameter should not be set directly,
-  ///consider to use the named template parameters instead.
+  ///The default value is \ref ListDigraph. The value of GR is not used
+  ///directly by \ref Dfs, it is only passed to \ref DfsDefaultTraits.
+  ///\tparam TR Traits class to set various data types used by the algorithm.
+  ///The default traits class is
+  ///\ref DfsDefaultTraits "DfsDefaultTraits<GR>".
+  ///See \ref DfsDefaultTraits for the documentation of
+  ///a Dfs traits class.
 #ifdef DOXYGEN
   template <typename GR,
@@ -153,5 +152,5 @@
     typedef PredMapPath<Digraph, PredMap> Path;
 
-    ///The \ref DfsDefaultTraits "traits class" of the algorithm.
+    ///The traits class.
     typedef TR Traits;
 
@@ -214,5 +213,5 @@
     typedef Dfs Create;
 
-    ///\name Named Template Parameters
+    ///\name Named template parameters
 
     ///@{
@@ -228,9 +227,8 @@
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///\c PredMap type.
+    ///PredMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///\c PredMap type.
-    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
+    ///PredMap type.
     template <class T>
     struct SetPredMap : public Dfs<Digraph, SetPredMapTraits<T> > {
@@ -248,9 +246,8 @@
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///\c DistMap type.
+    ///DistMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///\c DistMap type.
-    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
+    ///DistMap type.
     template <class T>
     struct SetDistMap : public Dfs< Digraph, SetDistMapTraits<T> > {
@@ -268,10 +265,8 @@
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///\c ReachedMap type.
+    ///ReachedMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///\c ReachedMap type.
-    ///It must conform to
-    ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
+    ///ReachedMap type.
     template <class T>
     struct SetReachedMap : public Dfs< Digraph, SetReachedMapTraits<T> > {
@@ -289,9 +284,8 @@
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///\c ProcessedMap type.
+    ///ProcessedMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///\c ProcessedMap type.
-    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
+    ///ProcessedMap type.
     template <class T>
     struct SetProcessedMap : public Dfs< Digraph, SetProcessedMapTraits<T> > {
@@ -307,8 +301,8 @@
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///\c ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
+    ///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///\c ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
+    ///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
     ///If you don't set it explicitly, it will be automatically allocated.
     struct SetStandardProcessedMap :
@@ -345,8 +339,7 @@
 
     ///Sets the map that stores the predecessor arcs.
-    ///If you don't use this function before calling \ref run(Node) "run()"
-    ///or \ref init(), an instance will be allocated automatically.
-    ///The destructor deallocates this automatically allocated map,
-    ///of course.
+    ///If you don't use this function before calling \ref run(),
+    ///it will allocate one. The destructor deallocates this
+    ///automatically allocated map, of course.
     ///\return <tt> (*this) </tt>
     Dfs &predMap(PredMap &m)
@@ -363,8 +356,7 @@
 
     ///Sets the map that indicates which nodes are reached.
-    ///If you don't use this function before calling \ref run(Node) "run()"
-    ///or \ref init(), an instance will be allocated automatically.
-    ///The destructor deallocates this automatically allocated map,
-    ///of course.
+    ///If you don't use this function before calling \ref run(),
+    ///it will allocate one. The destructor deallocates this
+    ///automatically allocated map, of course.
     ///\return <tt> (*this) </tt>
     Dfs &reachedMap(ReachedMap &m)
@@ -381,8 +373,7 @@
 
     ///Sets the map that indicates which nodes are processed.
-    ///If you don't use this function before calling \ref run(Node) "run()"
-    ///or \ref init(), an instance will be allocated automatically.
-    ///The destructor deallocates this automatically allocated map,
-    ///of course.
+    ///If you don't use this function before calling \ref run(),
+    ///it will allocate one. The destructor deallocates this
+    ///automatically allocated map, of course.
     ///\return <tt> (*this) </tt>
     Dfs &processedMap(ProcessedMap &m)
@@ -400,8 +391,7 @@
     ///Sets the map that stores the distances of the nodes calculated by
     ///the algorithm.
-    ///If you don't use this function before calling \ref run(Node) "run()"
-    ///or \ref init(), an instance will be allocated automatically.
-    ///The destructor deallocates this automatically allocated map,
-    ///of course.
+    ///If you don't use this function before calling \ref run(),
+    ///it will allocate one. The destructor deallocates this
+    ///automatically allocated map, of course.
     ///\return <tt> (*this) </tt>
     Dfs &distMap(DistMap &m)
@@ -417,18 +407,20 @@
   public:
 
-    ///\name Execution Control
-    ///The simplest way to execute the DFS algorithm is to use one of the
-    ///member functions called \ref run(Node) "run()".\n
-    ///If you need better control on the execution, you have to call
-    ///\ref init() first, then you can add a source node with \ref addSource()
-    ///and perform the actual computation with \ref start().
-    ///This procedure can be repeated if there are nodes that have not
-    ///been reached.
+    ///\name Execution control
+    ///The simplest way to execute the algorithm is to use
+    ///one of the member functions called \ref lemon::Dfs::run() "run()".
+    ///\n
+    ///If you need more control on the execution, first you must call
+    ///\ref lemon::Dfs::init() "init()", then you can add a source node
+    ///with \ref lemon::Dfs::addSource() "addSource()".
+    ///Finally \ref lemon::Dfs::start() "start()" will perform the
+    ///actual path computation.
 
     ///@{
 
-    ///\brief Initializes the internal data structures.
-    ///
     ///Initializes the internal data structures.
+
+    ///Initializes the internal data structures.
+    ///
     void init()
     {
@@ -447,8 +439,9 @@
     ///Adds a new source node to the set of nodes to be processed.
     ///
-    ///\pre The stack must be empty. Otherwise the algorithm gives
-    ///wrong results. (One of the outgoing arcs of all the source nodes
-    ///except for the last one will not be visited and distances will
-    ///also be wrong.)
+    ///\pre The stack must be empty. (Otherwise the algorithm gives
+    ///false results.)
+    ///
+    ///\warning Distances will be wrong (or at least strange) in case of
+    ///multiple sources.
     void addSource(Node s)
     {
@@ -514,14 +507,14 @@
     }
 
-    ///Returns \c false if there are nodes to be processed.
-
-    ///Returns \c false if there are nodes to be processed
-    ///in the queue (stack).
+    ///\brief Returns \c false if there are nodes
+    ///to be processed.
+    ///
+    ///Returns \c false if there are nodes
+    ///to be processed in the queue (stack).
     bool emptyQueue() const { return _stack_head<0; }
 
     ///Returns the number of the nodes to be processed.
 
-    ///Returns the number of the nodes to be processed
-    ///in the queue (stack).
+    ///Returns the number of the nodes to be processed in the queue (stack).
     int queueSize() const { return _stack_head+1; }
 
@@ -566,5 +559,5 @@
     void start(Node t)
     {
-      while ( !emptyQueue() && G->target(_stack[_stack_head])!=t )
+      while ( !emptyQueue() && !(*_reached)[t] )
         processNextArc();
     }
@@ -641,6 +634,10 @@
     ///Runs the algorithm to visit all nodes in the digraph.
 
-    ///This method runs the %DFS algorithm in order to visit all nodes
-    ///in the digraph.
+    ///This method runs the %DFS algorithm in order to compute the
+    ///%DFS path to each node.
+    ///
+    ///The algorithm computes
+    ///- the %DFS tree,
+    ///- the distance of each node from the root in the %DFS tree.
     ///
     ///\note <tt>d.run()</tt> is just a shortcut of the following code.
@@ -667,58 +664,58 @@
 
     ///\name Query Functions
-    ///The results of the DFS algorithm can be obtained using these
+    ///The result of the %DFS algorithm can be obtained using these
     ///functions.\n
-    ///Either \ref run(Node) "run()" or \ref start() should be called
-    ///before using them.
+    ///Either \ref lemon::Dfs::run() "run()" or \ref lemon::Dfs::start()
+    ///"start()" must be called before using them.
 
     ///@{
 
-    ///The DFS path to the given node.
-
-    ///Returns the DFS path to the given node from the root(s).
-    ///
-    ///\warning \c t should be reached from the root(s).
-    ///
-    ///\pre Either \ref run(Node) "run()" or \ref init()
-    ///must be called before using this function.
+    ///The DFS path to a node.
+
+    ///Returns the DFS path to a node.
+    ///
+    ///\warning \c t should be reachable from the root.
+    ///
+    ///\pre Either \ref run() or \ref start() must be called before
+    ///using this function.
     Path path(Node t) const { return Path(*G, *_pred, t); }
 
-    ///The distance of the given node from the root(s).
-
-    ///Returns the distance of the given node from the root(s).
-    ///
-    ///\warning If node \c v is not reached from the root(s), then
+    ///The distance of a node from the root.
+
+    ///Returns the distance of a node from the root.
+    ///
+    ///\warning If node \c v is not reachable from the root, then
     ///the return value of this function is undefined.
     ///
-    ///\pre Either \ref run(Node) "run()" or \ref init()
-    ///must be called before using this function.
+    ///\pre Either \ref run() or \ref start() must be called before
+    ///using this function.
     int dist(Node v) const { return (*_dist)[v]; }
 
-    ///Returns the 'previous arc' of the %DFS tree for the given node.
+    ///Returns the 'previous arc' of the %DFS tree for a node.
 
     ///This function returns the 'previous arc' of the %DFS tree for the
-    ///node \c v, i.e. it returns the last arc of a %DFS path from a
-    ///root to \c v. It is \c INVALID if \c v is not reached from the
-    ///root(s) or if \c v is a root.
+    ///node \c v, i.e. it returns the last arc of a %DFS path from the
+    ///root to \c v. It is \c INVALID
+    ///if \c v is not reachable from the root(s) or if \c v is a root.
     ///
     ///The %DFS tree used here is equal to the %DFS tree used in
-    ///\ref predNode() and \ref predMap().
-    ///
-    ///\pre Either \ref run(Node) "run()" or \ref init()
-    ///must be called before using this function.
+    ///\ref predNode().
+    ///
+    ///\pre Either \ref run() or \ref start() must be called before using
+    ///this function.
     Arc predArc(Node v) const { return (*_pred)[v];}
 
-    ///Returns the 'previous node' of the %DFS tree for the given node.
+    ///Returns the 'previous node' of the %DFS tree.
 
     ///This function returns the 'previous node' of the %DFS
     ///tree for the node \c v, i.e. it returns the last but one node
-    ///of a %DFS path from a root to \c v. It is \c INVALID
-    ///if \c v is not reached from the root(s) or if \c v is a root.
+    ///from a %DFS path from the root to \c v. It is \c INVALID
+    ///if \c v is not reachable from the root(s) or if \c v is a root.
     ///
     ///The %DFS tree used here is equal to the %DFS tree used in
-    ///\ref predArc() and \ref predMap().
-    ///
-    ///\pre Either \ref run(Node) "run()" or \ref init()
-    ///must be called before using this function.
+    ///\ref predArc().
+    ///
+    ///\pre Either \ref run() or \ref start() must be called before
+    ///using this function.
     Node predNode(Node v) const { return (*_pred)[v]==INVALID ? INVALID:
                                   G->source((*_pred)[v]); }
@@ -730,5 +727,5 @@
     ///distances of the nodes calculated by the algorithm.
     ///
-    ///\pre Either \ref run(Node) "run()" or \ref init()
+    ///\pre Either \ref run() or \ref init()
     ///must be called before using this function.
     const DistMap &distMap() const { return *_dist;}
@@ -738,15 +735,14 @@
     ///
     ///Returns a const reference to the node map that stores the predecessor
-    ///arcs, which form the DFS tree (forest).
-    ///
-    ///\pre Either \ref run(Node) "run()" or \ref init()
+    ///arcs, which form the DFS tree.
+    ///
+    ///\pre Either \ref run() or \ref init()
     ///must be called before using this function.
     const PredMap &predMap() const { return *_pred;}
 
-    ///Checks if the given node. node is reached from the root(s).
-
-    ///Returns \c true if \c v is reached from the root(s).
-    ///
-    ///\pre Either \ref run(Node) "run()" or \ref init()
+    ///Checks if a node is reachable from the root(s).
+
+    ///Returns \c true if \c v is reachable from the root(s).
+    ///\pre Either \ref run() or \ref start()
     ///must be called before using this function.
     bool reached(Node v) const { return (*_reached)[v]; }
@@ -770,5 +766,5 @@
     ///The type of the map that stores the predecessor
     ///arcs of the %DFS paths.
-    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
+    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
     ///Instantiates a PredMap.
@@ -785,6 +781,6 @@
 
     ///The type of the map that indicates which nodes are processed.
-    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
-    ///By default, it is a NullMap.
+    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+    ///By default it is a NullMap.
     typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
     ///Instantiates a ProcessedMap.
@@ -805,6 +801,5 @@
 
     ///The type of the map that indicates which nodes are reached.
-    ///It must conform to
-    ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
+    ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     typedef typename Digraph::template NodeMap<bool> ReachedMap;
     ///Instantiates a ReachedMap.
@@ -821,5 +816,5 @@
 
     ///The type of the map that stores the distances of the nodes.
-    ///It must conform to the \ref concepts::WriteMap "WriteMap" concept.
+    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     typedef typename Digraph::template NodeMap<int> DistMap;
     ///Instantiates a DistMap.
@@ -836,5 +831,5 @@
 
     ///The type of the DFS paths.
-    ///It must conform to the \ref concepts::Path "Path" concept.
+    ///It must meet the \ref concepts::Path "Path" concept.
     typedef lemon::Path<Digraph> Path;
   };
@@ -842,6 +837,10 @@
   /// Default traits class used by DfsWizard
 
-  /// Default traits class used by DfsWizard.
-  /// \tparam GR The type of the digraph.
+  /// To make it easier to use Dfs algorithm
+  /// we have created a wizard class.
+  /// This \ref DfsWizard class needs default traits,
+  /// as well as the \ref Dfs class.
+  /// The \ref DfsWizardBase is a class to be the default traits of the
+  /// \ref DfsWizard class.
   template<class GR>
   class DfsWizardBase : public DfsWizardDefaultTraits<GR>
@@ -871,5 +870,5 @@
     /// Constructor.
 
-    /// This constructor does not require parameters, it initiates
+    /// This constructor does not require parameters, therefore it initiates
     /// all of the attributes to \c 0.
     DfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
@@ -891,12 +890,9 @@
   /// This auxiliary class is created to implement the
   /// \ref dfs() "function-type interface" of \ref Dfs algorithm.
-  /// It does not have own \ref run(Node) "run()" method, it uses the
-  /// functions and features of the plain \ref Dfs.
+  /// It does not have own \ref run() method, it uses the functions
+  /// and features of the plain \ref Dfs.
   ///
   /// This class should only be used through the \ref dfs() function,
   /// which makes it easier to use the algorithm.
-  ///
-  /// \tparam TR The traits class that defines various types used by the
-  /// algorithm.
   template<class TR>
   class DfsWizard : public TR
@@ -904,4 +900,5 @@
     typedef TR Base;
 
+    ///The type of the digraph the algorithm runs on.
     typedef typename TR::Digraph Digraph;
 
@@ -911,8 +908,14 @@
     typedef typename Digraph::OutArcIt OutArcIt;
 
+    ///\brief The type of the map that stores the predecessor
+    ///arcs of the DFS paths.
     typedef typename TR::PredMap PredMap;
+    ///\brief The type of the map that stores the distances of the nodes.
     typedef typename TR::DistMap DistMap;
+    ///\brief The type of the map that indicates which nodes are reached.
     typedef typename TR::ReachedMap ReachedMap;
+    ///\brief The type of the map that indicates which nodes are processed.
     typedef typename TR::ProcessedMap ProcessedMap;
+    ///The type of the DFS paths
     typedef typename TR::Path Path;
 
@@ -984,6 +987,6 @@
     ///Runs DFS algorithm to visit all nodes in the digraph.
 
-    ///This method runs DFS algorithm in order to visit all nodes
-    ///in the digraph.
+    ///This method runs DFS algorithm in order to compute
+    ///the DFS path to each node.
     void run()
     {
@@ -997,10 +1000,9 @@
       SetPredMapBase(const TR &b) : TR(b) {}
     };
-
-    ///\brief \ref named-templ-param "Named parameter" for setting
-    ///the predecessor map.
-    ///
-    ///\ref named-templ-param "Named parameter" function for setting
-    ///the map that stores the predecessor arcs of the nodes.
+    ///\brief \ref named-func-param "Named parameter"
+    ///for setting PredMap object.
+    ///
+    ///\ref named-func-param "Named parameter"
+    ///for setting PredMap object.
     template<class T>
     DfsWizard<SetPredMapBase<T> > predMap(const T &t)
@@ -1016,10 +1018,9 @@
       SetReachedMapBase(const TR &b) : TR(b) {}
     };
-
-    ///\brief \ref named-templ-param "Named parameter" for setting
-    ///the reached map.
-    ///
-    ///\ref named-templ-param "Named parameter" function for setting
-    ///the map that indicates which nodes are reached.
+    ///\brief \ref named-func-param "Named parameter"
+    ///for setting ReachedMap object.
+    ///
+    /// \ref named-func-param "Named parameter"
+    ///for setting ReachedMap object.
     template<class T>
     DfsWizard<SetReachedMapBase<T> > reachedMap(const T &t)
@@ -1035,11 +1036,9 @@
       SetDistMapBase(const TR &b) : TR(b) {}
     };
-
-    ///\brief \ref named-templ-param "Named parameter" for setting
-    ///the distance map.
-    ///
-    ///\ref named-templ-param "Named parameter" function for setting
-    ///the map that stores the distances of the nodes calculated
-    ///by the algorithm.
+    ///\brief \ref named-func-param "Named parameter"
+    ///for setting DistMap object.
+    ///
+    /// \ref named-func-param "Named parameter"
+    ///for setting DistMap object.
     template<class T>
     DfsWizard<SetDistMapBase<T> > distMap(const T &t)
@@ -1055,10 +1054,9 @@
       SetProcessedMapBase(const TR &b) : TR(b) {}
     };
-
-    ///\brief \ref named-func-param "Named parameter" for setting
-    ///the processed map.
-    ///
-    ///\ref named-templ-param "Named parameter" function for setting
-    ///the map that indicates which nodes are processed.
+    ///\brief \ref named-func-param "Named parameter"
+    ///for setting ProcessedMap object.
+    ///
+    /// \ref named-func-param "Named parameter"
+    ///for setting ProcessedMap object.
     template<class T>
     DfsWizard<SetProcessedMapBase<T> > processedMap(const T &t)
@@ -1113,5 +1111,6 @@
   ///  bool reached = dfs(g).path(p).dist(d).run(s,t);
   ///\endcode
-  ///\warning Don't forget to put the \ref DfsWizard::run(Node) "run()"
+
+  ///\warning Don't forget to put the \ref DfsWizard::run() "run()"
   ///to the end of the parameter list.
   ///\sa DfsWizard
@@ -1129,7 +1128,7 @@
   /// This class defines the interface of the DfsVisit events, and
   /// it could be the base of a real visitor class.
-  template <typename GR>
+  template <typename _Digraph>
   struct DfsVisitor {
-    typedef GR Digraph;
+    typedef _Digraph Digraph;
     typedef typename Digraph::Arc Arc;
     typedef typename Digraph::Node Node;
@@ -1167,7 +1166,7 @@
   };
 #else
-  template <typename GR>
+  template <typename _Digraph>
   struct DfsVisitor {
-    typedef GR Digraph;
+    typedef _Digraph Digraph;
     typedef typename Digraph::Arc Arc;
     typedef typename Digraph::Node Node;
@@ -1202,15 +1201,14 @@
   /// Default traits class of DfsVisit class.
   /// \tparam _Digraph The type of the digraph the algorithm runs on.
-  template<class GR>
+  template<class _Digraph>
   struct DfsVisitDefaultTraits {
 
     /// \brief The type of the digraph the algorithm runs on.
-    typedef GR Digraph;
+    typedef _Digraph Digraph;
 
     /// \brief The type of the map that indicates which nodes are reached.
     ///
     /// The type of the map that indicates which nodes are reached.
-    /// It must conform to the
-    /// \ref concepts::ReadWriteMap "ReadWriteMap" concept.
+    /// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     typedef typename Digraph::template NodeMap<bool> ReachedMap;
 
@@ -1228,10 +1226,10 @@
   /// \ingroup search
   ///
-  /// \brief DFS algorithm class with visitor interface.
+  /// \brief %DFS algorithm class with visitor interface.
   ///
-  /// This class provides an efficient implementation of the DFS algorithm
+  /// This class provides an efficient implementation of the %DFS algorithm
   /// with visitor interface.
   ///
-  /// The DfsVisit class provides an alternative interface to the Dfs
+  /// The %DfsVisit class provides an alternative interface to the Dfs
   /// class. It works with callback mechanism, the DfsVisit object calls
   /// the member functions of the \c Visitor class on every DFS event.
@@ -1242,23 +1240,23 @@
   /// instead.
   ///
-  /// \tparam GR The type of the digraph the algorithm runs on.
-  /// The default type is \ref ListDigraph.
-  /// The value of GR is not used directly by \ref DfsVisit,
-  /// it is only passed to \ref DfsVisitDefaultTraits.
-  /// \tparam VS The Visitor type that is used by the algorithm.
-  /// \ref DfsVisitor "DfsVisitor<GR>" is an empty visitor, which
+  /// \tparam _Digraph The type of the digraph the algorithm runs on.
+  /// The default value is
+  /// \ref ListDigraph. The value of _Digraph is not used directly by
+  /// \ref DfsVisit, it is only passed to \ref DfsVisitDefaultTraits.
+  /// \tparam _Visitor The Visitor type that is used by the algorithm.
+  /// \ref DfsVisitor "DfsVisitor<_Digraph>" is an empty visitor, which
   /// does not observe the DFS events. If you want to observe the DFS
   /// events, you should implement your own visitor class.
-  /// \tparam TR The traits class that defines various types used by the
-  /// algorithm. By default, it is \ref DfsVisitDefaultTraits
-  /// "DfsVisitDefaultTraits<GR>".
-  /// In most cases, this parameter should not be set directly,
-  /// consider to use the named template parameters instead.
+  /// \tparam _Traits Traits class to set various data types used by the
+  /// algorithm. The default traits class is
+  /// \ref DfsVisitDefaultTraits "DfsVisitDefaultTraits<_Digraph>".
+  /// See \ref DfsVisitDefaultTraits for the documentation of
+  /// a DFS visit traits class.
 #ifdef DOXYGEN
-  template <typename GR, typename VS, typename TR>
+  template <typename _Digraph, typename _Visitor, typename _Traits>
 #else
-  template <typename GR = ListDigraph,
-            typename VS = DfsVisitor<GR>,
-            typename TR = DfsVisitDefaultTraits<GR> >
+  template <typename _Digraph = ListDigraph,
+            typename _Visitor = DfsVisitor<_Digraph>,
+            typename _Traits = DfsVisitDefaultTraits<_Digraph> >
 #endif
   class DfsVisit {
@@ -1266,5 +1264,5 @@
 
     ///The traits class.
-    typedef TR Traits;
+    typedef _Traits Traits;
 
     ///The type of the digraph the algorithm runs on.
@@ -1272,5 +1270,5 @@
 
     ///The visitor type used by the algorithm.
-    typedef VS Visitor;
+    typedef _Visitor Visitor;
 
     ///The type of the map that indicates which nodes are reached.
@@ -1312,5 +1310,5 @@
     typedef DfsVisit Create;
 
-    /// \name Named Template Parameters
+    /// \name Named template parameters
 
     ///@{
@@ -1354,8 +1352,7 @@
     ///
     /// Sets the map that indicates which nodes are reached.
-    /// If you don't use this function before calling \ref run(Node) "run()"
-    /// or \ref init(), an instance will be allocated automatically.
-    /// The destructor deallocates this automatically allocated map,
-    /// of course.
+    /// If you don't use this function before calling \ref run(),
+    /// it will allocate one. The destructor deallocates this
+    /// automatically allocated map, of course.
     /// \return <tt> (*this) </tt>
     DfsVisit &reachedMap(ReachedMap &m) {
@@ -1370,12 +1367,14 @@
   public:
 
-    /// \name Execution Control
-    /// The simplest way to execute the DFS algorithm is to use one of the
-    /// member functions called \ref run(Node) "run()".\n
-    /// If you need better control on the execution, you have to call
-    /// \ref init() first, then you can add a source node with \ref addSource()
-    /// and perform the actual computation with \ref start().
-    /// This procedure can be repeated if there are nodes that have not
-    /// been reached.
+    /// \name Execution control
+    /// The simplest way to execute the algorithm is to use
+    /// one of the member functions called \ref lemon::DfsVisit::run()
+    /// "run()".
+    /// \n
+    /// If you need more control on the execution, first you must call
+    /// \ref lemon::DfsVisit::init() "init()", then you can add several
+    /// source nodes with \ref lemon::DfsVisit::addSource() "addSource()".
+    /// Finally \ref lemon::DfsVisit::start() "start()" will perform the
+    /// actual path computation.
 
     /// @{
@@ -1393,12 +1392,13 @@
     }
 
-    /// \brief Adds a new source node.
-    ///
-    /// Adds a new source node to the set of nodes to be processed.
-    ///
-    /// \pre The stack must be empty. Otherwise the algorithm gives
-    /// wrong results. (One of the outgoing arcs of all the source nodes
-    /// except for the last one will not be visited and distances will
-    /// also be wrong.)
+    ///Adds a new source node.
+
+    ///Adds a new source node to the set of nodes to be processed.
+    ///
+    ///\pre The stack must be empty. (Otherwise the algorithm gives
+    ///false results.)
+    ///
+    ///\warning Distances will be wrong (or at least strange) in case of
+    ///multiple sources.
     void addSource(Node s)
     {
@@ -1414,5 +1414,4 @@
           } else {
             _visitor->leave(s);
-            _visitor->stop(s);
           }
         }
@@ -1513,5 +1512,5 @@
     /// with addSource() before using this function.
     void start(Node t) {
-      while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != t )
+      while ( !emptyQueue() && !(*_reached)[t] )
         processNextArc();
     }
@@ -1587,6 +1586,10 @@
     /// \brief Runs the algorithm to visit all nodes in the digraph.
 
-    /// This method runs the %DFS algorithm in order to visit all nodes
-    /// in the digraph.
+    /// This method runs the %DFS algorithm in order to
+    /// compute the %DFS path to each node.
+    ///
+    /// The algorithm computes
+    /// - the %DFS tree,
+    /// - the distance of each node from the root in the %DFS tree.
     ///
     /// \note <tt>d.run()</tt> is just a shortcut of the following code.
@@ -1613,18 +1616,17 @@
 
     /// \name Query Functions
-    /// The results of the DFS algorithm can be obtained using these
+    /// The result of the %DFS algorithm can be obtained using these
     /// functions.\n
-    /// Either \ref run(Node) "run()" or \ref start() should be called
-    /// before using them.
-
+    /// Either \ref lemon::DfsVisit::run() "run()" or
+    /// \ref lemon::DfsVisit::start() "start()" must be called before
+    /// using them.
     ///@{
 
-    /// \brief Checks if the given node is reached from the root(s).
-    ///
-    /// Returns \c true if \c v is reached from the root(s).
-    ///
-    /// \pre Either \ref run(Node) "run()" or \ref init()
+    /// \brief Checks if a node is reachable from the root(s).
+    ///
+    /// Returns \c true if \c v is reachable from the root(s).
+    /// \pre Either \ref run() or \ref start()
     /// must be called before using this function.
-    bool reached(Node v) const { return (*_reached)[v]; }
+    bool reached(Node v) { return (*_reached)[v]; }
 
     ///@}
