[Lemon-commits] kpeter: r3394 - lemon/trunk/lemon

Lemon SVN svn at lemon.cs.elte.hu
Tue Nov 20 22:40:55 CET 2007


Author: kpeter
Date: Tue Nov 20 22:40:55 2007
New Revision: 3394

Modified:
   lemon/trunk/lemon/bellman_ford.h
   lemon/trunk/lemon/min_mean_cycle.h

Log:
Small changes in the documentation.


Modified: lemon/trunk/lemon/bellman_ford.h
==============================================================================
--- lemon/trunk/lemon/bellman_ford.h	(original)
+++ lemon/trunk/lemon/bellman_ford.h	Tue Nov 20 22:40:55 2007
@@ -435,7 +435,7 @@
     /// after each iteration the \ref predMap() map and manually build
     /// the path.
     ///
-    /// \return %True when the algorithm have not found more shorter
+    /// \return \c true when the algorithm have not found more shorter
     /// paths.
     bool processNextRound() {
       for (int i = 0; i < int(_process.size()); ++i) {
@@ -472,7 +472,7 @@
     /// This function does not make it possible to calculate strictly the
     /// at most k length minimal paths, this is why it is
     /// called just weak round.
-    /// \return %True when the algorithm have not found more shorter paths.
+    /// \return \c true when the algorithm have not found more shorter paths.
     bool processNextWeakRound() {
       for (int i = 0; i < int(_process.size()); ++i) {
 	_mask->set(_process[i], false);
@@ -517,14 +517,15 @@
     /// \brief Executes the algorithm and checks the negative cycles.
     ///
     /// \pre init() must be called and at least one node should be added
-    /// with addSource() before using this function. If there is
-    /// a negative cycle in the graph it gives back false.
+    /// with addSource() before using this function. 
     ///
     /// This method runs the %BellmanFord algorithm from the root node(s)
     /// in order to compute the shortest path to each node. The algorithm 
     /// computes 
     /// - The shortest path tree.
     /// - The distance of each node from the root(s).
+    /// 
+    /// \return \c false if there is a negative cycle in the graph.
     bool checkedStart() {
       int num = countNodes(*graph);
       for (int i = 0; i < num; ++i) {

Modified: lemon/trunk/lemon/min_mean_cycle.h
==============================================================================
--- lemon/trunk/lemon/min_mean_cycle.h	(original)
+++ lemon/trunk/lemon/min_mean_cycle.h	Tue Nov 20 22:40:55 2007
@@ -250,8 +250,8 @@
     ///
     /// \return \c true if a cycle exists in the graph.
     ///
-    /// \note Apart from the return value, m.run() is just a shortcut
-    /// of the following code.
+    /// \note Apart from the return value, <tt>m.run()</tt> is just a
+    /// shortcut of the following code.
     /// \code
     ///   m.init();
     ///   m.findMinMean();
@@ -264,6 +264,10 @@
     }
 
     /// \brief Initializes the internal data structures.
+    ///
+    /// Initializes the internal data structures.
+    ///
+    /// \sa reset()
     void init() {
       comp_num = stronglyConnectedComponents(graph, comp);
       if (!cycle_path) {
@@ -341,6 +345,8 @@
     /// Resets the internal data structures so that \ref findMinMean()
     /// and \ref findCycle() can be called again (e.g. when the
     /// underlaying graph has been modified).
+    ///
+    /// \sa init()
     void reset() {
       for (NodeIt u(graph); u != INVALID; ++u)
 	dmap[u].clear();
@@ -353,7 +359,9 @@
     ///
     /// Returns the total length of the found cycle.
     ///
-    /// \pre \ref run() must be called before using this function.
+    /// \pre \ref run() or \ref findCycle() must be called before
+    /// using this function. If only \ref findMinMean() is called,
+    /// the return value is not valid.
     Length cycleLength() const {
       return cycle_length;
     }
@@ -362,7 +370,9 @@
     ///
     /// Returns the number of edges in the found cycle.
     ///
-    /// \pre \ref run() must be called before using this function.
+    /// \pre \ref run() or \ref findCycle() must be called before
+    /// using this function. If only \ref findMinMean() is called,
+    /// the return value is not valid.
     int cycleEdgeNum() const {
       return cycle_size;
     }
@@ -371,14 +381,19 @@
     ///
     /// Returns the mean length of the found cycle.
     ///
-    /// \pre \ref run() must be called before using this function.
+    /// \pre \ref run() or \ref findMinMean() must be called before
+    /// using this function.
     ///
     /// \warning LengthMap::Value must be convertible to double.
     ///
-    /// \note m.minMean() is just a shortcut of the following code.
+    /// \note <tt>m.minMean()</tt> is just a shortcut of the following
+    /// code.
     /// \code
-    ///   return m.cycleEdgeNum() / double(m.cycleLength());
+    ///   return m.cycleLength() / double(m.cycleEdgeNum());
     /// \endcode
+    /// However if only \ref findMinMean() is called before using this
+    /// function, <tt>m.cycleLength()</tt> and <tt>m.cycleEdgeNum()</tt>
+    /// are not valid alone, only their ratio is valid.
     double minMean() const {
       return cycle_length / (double)cycle_size;
     }



More information about the Lemon-commits mailing list