Index: lemon/bfs.h
===================================================================
--- lemon/bfs.h	(revision 2438)
+++ lemon/bfs.h	(revision 2443)
@@ -516,16 +516,15 @@
 
     ///Processes the next node. And checks that at least one of
-    ///reached node has true value in the \c nm nodemap. If one node
+    ///reached node has true value in the \c nm node map. If one node
     ///with true value is reachable from the processed node then the
-    ///reached parameter will be set true. The reached parameter
-    ///should be initially false.
-    ///
-    ///\param nm The nodemaps of possible targets.
-    ///\retval reach Indicates that one of the target nodes is reached.
+    ///rnode parameter will be set to the first of such nodes.
+    ///
+    ///\param nm The node map of possible targets.
+    ///\retval rnode The reached target node.
     ///\return The processed node.
     ///
     ///\warning The queue must not be empty!
     template<class NM>
-    Node processNextNode(const NM& nm, bool& reach)
+    Node processNextNode(const NM& nm, Node& rnode)
     {
       if(_queue_tail==_queue_next_dist) {
@@ -542,5 +541,5 @@
 	  _pred->set(m,e);
 	  _dist->set(m,_curr_dist);
-          reach = reach || nm[m];
+	  if (nm[m] && rnode == INVALID) rnode = m;
 	}
       return n;
@@ -567,5 +566,4 @@
     
     ///Returns the number of the nodes to be processed in the queue.
-    ///
     int queueSize() { return _queue_head-_queue_tail; }
     
@@ -583,5 +581,4 @@
     ///- The shortest path tree.
     ///- The distance of each node from the root(s).
-    ///
     void start()
     {
@@ -602,5 +599,4 @@
     ///- The shortest path to \c  dest.
     ///- The distance of \c dest from the root(s).
-    ///
     void start(Node dest)
     {
@@ -617,12 +613,17 @@
     ///
     ///\param nm must be a bool (or convertible) node map. The
-    ///algorithm will stop when it reached a node \c v with
+    ///algorithm will stop when it reaches a node \c v with
     /// <tt>nm[v]</tt> true.
-    ///\todo query the reached target
+    ///
+    ///\return The reached node \c v with <tt>nm[v]<\tt> true or
+    ///\c INVALID if no such node was found.
     template<class NM>
-    void start(const NM &nm)
-    {
-      bool reach = false;
-      while ( !emptyQueue() && !reach ) processNextNode(nm, reach);
+    Node start(const NM &nm)
+    {
+      Node rnode = INVALID;
+      while ( !emptyQueue() && rnode == INVALID ) {
+	processNextNode(nm, rnode);
+      }
+      return rnode;
     }
     
@@ -1434,16 +1435,15 @@
     ///
     /// Processes the next node. And checks that at least one of
-    /// reached node has true value in the \c nm nodemap. If one node
+    /// reached node has true value in the \c nm node map. If one node
     /// with true value is reachable from the processed node then the
-    /// reached parameter will be set true. The reached parameter
-    /// should be initially false.
-    ///
-    /// \param nm The nodemaps of possible targets.
-    /// \retval reached Indicates that one of the target nodes is reached.
+    /// rnode parameter will be set to the first of such nodes.
+    ///
+    /// \param nm The node map of possible targets.
+    /// \retval rnode The reached target node.
     /// \return The processed node.
     ///
     /// \warning The queue must not be empty!
     template <typename NM>
-    Node processNextNode(const NM& nm, bool& reach) {
+    Node processNextNode(const NM& nm, Node& rnode) {
       Node n = _list[++_list_front];
       _visitor->process(n);
@@ -1456,5 +1456,5 @@
           _reached->set(m, true);
           _list[++_list_back] = m;
-          reach = reach || nm[m];
+          if (nm[m] && rnode == INVALID) rnode = m;
         } else {
           _visitor->examine(e);
@@ -1515,10 +1515,16 @@
     ///
     ///\param nm must be a bool (or convertible) node map. The
-    ///algorithm will stop when it reached a node \c v with
+    ///algorithm will stop when it reaches a node \c v with
     /// <tt>nm[v]</tt> true.
+    ///
+    ///\return The reached node \c v with <tt>nm[v]<\tt> true or
+    ///\c INVALID if no such node was found.
     template <typename NM>
-    void start(const NM &nm) {
-      bool reach = false;
-      while ( !emptyQueue() && !reach ) processNextNode(nm, reach);
+    Node start(const NM &nm) {
+      Node rnode = INVALID;
+      while ( !emptyQueue() && rnode == INVALID ) {
+	processNextNode(nm, rnode);
+      }
+      return rnode;
     }
 
Index: lemon/dfs.h
===================================================================
--- lemon/dfs.h	(revision 2439)
+++ lemon/dfs.h	(revision 2443)
@@ -565,7 +565,7 @@
     ///
     ///\param em must be a bool (or convertible) edge map. The algorithm
-    ///will stop when it reaches an edge \c e with <tt>em[e]==true<\tt>.
-    ///
-    ///\return The reached edge \c e with <tt>em[e]==true<\tt> or
+    ///will stop when it reaches an edge \c e with <tt>em[e]<\tt> true.
+    ///
+    ///\return The reached edge \c e with <tt>em[e]<\tt> true or
     ///\c INVALID if no such edge was found.
     ///
@@ -1459,7 +1459,7 @@
     ///
     /// \param em must be a bool (or convertible) edge map. The algorithm
-    /// will stop when it reaches an edge \c e with <tt>em[e]==true<\tt>.
-    ///
-    ///\return The reached edge \c e with <tt>em[e]==true<\tt> or
+    /// will stop when it reaches an edge \c e with <tt>em[e]<\tt> true.
+    ///
+    ///\return The reached edge \c e with <tt>em[e]<\tt> true or
     ///\c INVALID if no such edge was found.
     ///
Index: lemon/dijkstra.h
===================================================================
--- lemon/dijkstra.h	(revision 2439)
+++ lemon/dijkstra.h	(revision 2443)
@@ -664,7 +664,7 @@
     ///
     ///\param nm must be a bool (or convertible) node map. The algorithm
-    ///will stop when it reaches a node \c v with <tt>nm[v]==true</tt>.
-    ///
-    ///\return The reached node \c v with <tt>nm[v]==true<\tt> or
+    ///will stop when it reaches a node \c v with <tt>nm[v]</tt> true.
+    ///
+    ///\return The reached node \c v with <tt>nm[v]<\tt> true or
     ///\c INVALID if no such node was found.
     template<class NodeBoolMap>
