# HG changeset patch # User deba # Date 1140685398 0 # Node ID 81c8efe927066ce7c6bd4e5c49ab97ed8dc48592 # Parent a954b780e3abeab3d88894347eb2e9c1d6c2dab0 Little bugfixes, spellchecks and improvements diff -r a954b780e3ab -r 81c8efe92706 lemon/bits/graph_extender.h --- a/lemon/bits/graph_extender.h Thu Feb 23 08:55:54 2006 +0000 +++ b/lemon/bits/graph_extender.h Thu Feb 23 09:03:18 2006 +0000 @@ -379,7 +379,7 @@ /// Returns a directed edge corresponding to the specified UEdge. /// If the given bool is true the given undirected edge and the /// returned edge have the same source node. - Edge direct(const UEdge &ue, bool d) const { + static Edge direct(const UEdge &ue, bool d) { return Edge(ue, d); } @@ -388,7 +388,7 @@ /// /// \todo reference to the corresponding point of the undirected graph /// concept. "What does the direction of an undirected edge mean?" - bool direction(const Edge &e) const { return e.forward; } + static bool direction(const Edge &e) { return e.forward; } using Parent::first; diff -r a954b780e3ab -r 81c8efe92706 lemon/dfs.h --- a/lemon/dfs.h Thu Feb 23 08:55:54 2006 +0000 +++ b/lemon/dfs.h Thu Feb 23 09:03:18 2006 +0000 @@ -573,6 +573,34 @@ while ( !emptyQueue() && !em[_stack[_stack_head]] ) processNextEdge(); } + ///Runs %DFS algorithm to visit all nodes in the graph. + + ///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 d.run() is just a shortcut of the following code. + ///\code + /// d.init(); + /// for (NodeIt it(graph); it != INVALID; ++it) { + /// if (!d.reached(it)) { + /// d.addSource(it); + /// d.start(); + /// } + /// } + ///\endcode + void run() { + init(); + for (NodeIt it(*G); it != INVALID; ++it) { + if (!reached(it)) { + addSource(it); + start(); + } + } + } + ///Runs %DFS algorithm from node \c s. ///This method runs the %DFS algorithm from a root node \c s @@ -651,8 +679,8 @@ ///Returns the distance of a node from the root(s). ///\pre \ref run() must be called before using this function. - ///\warning If node \c v is unreachable from the root(s) then the return value - ///of this funcion is undefined. + ///\warning If node \c v is unreachable from the root(s) then the return + ///value of this funcion is undefined. int dist(Node v) const { return (*_dist)[v]; } ///Returns the 'previous edge' of the %DFS tree. @@ -1440,7 +1468,7 @@ while (!emptyQueue() && !em[_stack[_stack_head]]) processNextEdge(); } - /// \brief Runs %DFS algorithm from node \c s. + /// \brief Runs %DFSVisit algorithm from node \c s. /// /// This method runs the %DFS algorithm from a root node \c s. /// \note d.run(s) is just a shortcut of the following code. @@ -1454,6 +1482,33 @@ addSource(s); start(); } + + /// \brief Runs %DFSVisit algorithm to visit all nodes in the graph. + + /// 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 d.run() is just a shortcut of the following code. + ///\code + /// d.init(); + /// for (NodeIt it(graph); it != INVALID; ++it) { + /// if (!d.reached(it)) { + /// d.addSource(it); + /// d.start(); + /// } + /// } + ///\endcode + void run() { + init(); + for (NodeIt it(*_graph); it != INVALID; ++it) { + if (!reached(it)) { + addSource(it); + start(); + } + } + } ///@} /// \name Query Functions diff -r a954b780e3ab -r 81c8efe92706 lemon/dijkstra.h --- a/lemon/dijkstra.h Thu Feb 23 08:55:54 2006 +0000 +++ b/lemon/dijkstra.h Thu Feb 23 09:03:18 2006 +0000 @@ -484,7 +484,7 @@ ///Sets the heap and the cross reference used by algorithm. ///If you don't use this function before calling \ref run(), ///it will allocate one. The destuctor deallocates this - ///automatically allocated map, of course. + ///automatically allocated heap and cross reference, of course. ///\return (*this) Dijkstra &heap(Heap& heap, HeapCrossRef &crossRef) { diff -r a954b780e3ab -r 81c8efe92706 lemon/graph_utils.h --- a/lemon/graph_utils.h Thu Feb 23 08:55:54 2006 +0000 +++ b/lemon/graph_utils.h Thu Feb 23 09:03:18 2006 +0000 @@ -566,7 +566,7 @@ return edgeRefMap; } - void run() {} + void run() const {} private: @@ -777,7 +777,7 @@ return uEdgeRefMap; } - void run() {} + void run() const {} private: