lemon/min_mean_cycle.h
changeset 2517 d9cfac072869
parent 2509 a8081c9cd96a
child 2529 93de38566e6c
     1.1 --- a/lemon/min_mean_cycle.h	Tue Nov 20 15:06:03 2007 +0000
     1.2 +++ b/lemon/min_mean_cycle.h	Tue Nov 20 21:40:55 2007 +0000
     1.3 @@ -250,8 +250,8 @@
     1.4      ///
     1.5      /// \return \c true if a cycle exists in the graph.
     1.6      ///
     1.7 -    /// \note Apart from the return value, m.run() is just a shortcut
     1.8 -    /// of the following code.
     1.9 +    /// \note Apart from the return value, <tt>m.run()</tt> is just a
    1.10 +    /// shortcut of the following code.
    1.11      /// \code
    1.12      ///   m.init();
    1.13      ///   m.findMinMean();
    1.14 @@ -264,6 +264,10 @@
    1.15      }
    1.16  
    1.17      /// \brief Initializes the internal data structures.
    1.18 +    ///
    1.19 +    /// Initializes the internal data structures.
    1.20 +    ///
    1.21 +    /// \sa reset()
    1.22      void init() {
    1.23        comp_num = stronglyConnectedComponents(graph, comp);
    1.24        if (!cycle_path) {
    1.25 @@ -341,6 +345,8 @@
    1.26      /// Resets the internal data structures so that \ref findMinMean()
    1.27      /// and \ref findCycle() can be called again (e.g. when the
    1.28      /// underlaying graph has been modified).
    1.29 +    ///
    1.30 +    /// \sa init()
    1.31      void reset() {
    1.32        for (NodeIt u(graph); u != INVALID; ++u)
    1.33  	dmap[u].clear();
    1.34 @@ -353,7 +359,9 @@
    1.35      ///
    1.36      /// Returns the total length of the found cycle.
    1.37      ///
    1.38 -    /// \pre \ref run() must be called before using this function.
    1.39 +    /// \pre \ref run() or \ref findCycle() must be called before
    1.40 +    /// using this function. If only \ref findMinMean() is called,
    1.41 +    /// the return value is not valid.
    1.42      Length cycleLength() const {
    1.43        return cycle_length;
    1.44      }
    1.45 @@ -362,7 +370,9 @@
    1.46      ///
    1.47      /// Returns the number of edges in the found cycle.
    1.48      ///
    1.49 -    /// \pre \ref run() must be called before using this function.
    1.50 +    /// \pre \ref run() or \ref findCycle() must be called before
    1.51 +    /// using this function. If only \ref findMinMean() is called,
    1.52 +    /// the return value is not valid.
    1.53      int cycleEdgeNum() const {
    1.54        return cycle_size;
    1.55      }
    1.56 @@ -371,14 +381,19 @@
    1.57      ///
    1.58      /// Returns the mean length of the found cycle.
    1.59      ///
    1.60 -    /// \pre \ref run() must be called before using this function.
    1.61 +    /// \pre \ref run() or \ref findMinMean() must be called before
    1.62 +    /// using this function.
    1.63      ///
    1.64      /// \warning LengthMap::Value must be convertible to double.
    1.65      ///
    1.66 -    /// \note m.minMean() is just a shortcut of the following code.
    1.67 +    /// \note <tt>m.minMean()</tt> is just a shortcut of the following
    1.68 +    /// code.
    1.69      /// \code
    1.70 -    ///   return m.cycleEdgeNum() / double(m.cycleLength());
    1.71 +    ///   return m.cycleLength() / double(m.cycleEdgeNum());
    1.72      /// \endcode
    1.73 +    /// However if only \ref findMinMean() is called before using this
    1.74 +    /// function, <tt>m.cycleLength()</tt> and <tt>m.cycleEdgeNum()</tt>
    1.75 +    /// are not valid alone, only their ratio is valid.
    1.76      double minMean() const {
    1.77        return cycle_length / (double)cycle_size;
    1.78      }