Changeset 806:d66ff32624e2 in lemon for lemon/min_mean_cycle.h
 Timestamp:
 08/03/09 14:35:38 (15 years ago)
 Branch:
 default
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/min_mean_cycle.h
r805 r806 123 123 /// 124 124 /// If you don't call this function before calling \ref run() or 125 /// \ref init(), it will allocate a local \ref Path "path"125 /// \ref findMinMean(), it will allocate a local \ref Path "path" 126 126 /// structure. The destuctor deallocates this automatically 127 127 /// allocated object, of course. … … 145 145 /// The simplest way to execute the algorithm is to call the \ref run() 146 146 /// function.\n 147 /// If you only need the minimum mean length, you may call \ref init() 148 /// and \ref findMinMean(). 149 /// If you would like to run the algorithm again (e.g. the underlying 150 /// digraph and/or the arc lengths has been modified), you may not 151 /// create a new instance of the class, rather call \ref reset(), 152 /// \ref findMinMean() and \ref findCycle() instead. 147 /// If you only need the minimum mean length, you may call 148 /// \ref findMinMean(). 153 149 154 150 /// @{ … … 157 153 /// 158 154 /// This function runs the algorithm. 155 /// It can be called more than once (e.g. if the underlying digraph 156 /// and/or the arc lengths have been modified). 159 157 /// 160 158 /// \return \c true if a directed cycle exists in the digraph. 161 159 /// 162 /// \note Apart from the return value, <tt>mmc.run()</tt> is just a 163 /// shortcut of the following code. 160 /// \note <tt>mmc.run()</tt> is just a shortcut of the following code. 164 161 /// \code 165 /// mmc.init(); 166 /// mmc.findMinMean(); 167 /// mmc.findCycle(); 162 /// return mmc.findMinMean() && mmc.findCycle(); 168 163 /// \endcode 169 164 bool run() { 170 init();171 165 return findMinMean() && findCycle(); 172 166 } 173 167 174 /// \brief Initialize the internal data structures. 175 /// 176 /// This function initializes the internal data structures. 177 /// 178 /// \sa reset() 179 void init() { 168 /// \brief Find the minimum cycle mean. 169 /// 170 /// This function finds the minimum mean length of the directed 171 /// cycles in the digraph. 172 /// 173 /// \return \c true if a directed cycle exists in the digraph. 174 bool findMinMean() { 175 // Initialize 180 176 _tol.epsilon(1e6); 181 177 if (!_cycle_path) { … … 183 179 _cycle_path = new Path; 184 180 } 181 _cycle_path>clear(); 185 182 _cycle_found = false; 183 184 // Find the minimum cycle mean in the components 186 185 _comp_num = stronglyConnectedComponents(_gr, _comp); 187 }188 189 /// \brief Reset the internal data structures.190 ///191 /// This function resets the internal data structures so that192 /// findMinMean() and findCycle() can be called again (e.g. when the193 /// underlying digraph and/or the arc lengths has been modified).194 ///195 /// \sa init()196 void reset() {197 if (_cycle_path) _cycle_path>clear();198 _cycle_found = false;199 _comp_num = stronglyConnectedComponents(_gr, _comp);200 }201 202 /// \brief Find the minimum cycle mean.203 ///204 /// This function computes all the required data and finds the205 /// minimum mean length of the directed cycles in the digraph.206 ///207 /// \return \c true if a directed cycle exists in the digraph.208 ///209 /// \pre \ref init() must be called before using this function.210 bool findMinMean() {211 // Find the minimum cycle mean in the components212 186 for (int comp = 0; comp < _comp_num; ++comp) { 213 187 if (!initCurrentComponent(comp)) continue; … … 228 202 /// \return \c true if a directed cycle exists in the digraph. 229 203 /// 230 /// \pre \ref init() and \ref findMinMean() must be called before 231 /// using this function. 204 /// \pre \ref findMinMean() must be called before using this function. 232 205 bool findCycle() { 233 206 if (!_cycle_found) return false; … … 243 216 244 217 /// \name Query Functions 245 /// The result of the algorithm can be obtained using these218 /// The results of the algorithm can be obtained using these 246 219 /// functions.\n 247 220 /// The algorithm should be executed before using them.
Note: See TracChangeset
for help on using the changeset viewer.