37 /// The class \ref lemon::Suurballe implements |
37 /// The class \ref lemon::Suurballe implements |
38 /// an algorithm for finding k edge-disjoint paths |
38 /// an algorithm for finding k edge-disjoint paths |
39 /// from a given source node to a given target node in an |
39 /// from a given source node to a given target node in an |
40 /// edge-weighted directed graph having minimal total weight (length). |
40 /// edge-weighted directed graph having minimal total weight (length). |
41 /// |
41 /// |
42 ///\warning Length values should be nonnegative. |
42 ///\warning Length values should be nonnegative! |
43 /// |
43 /// |
44 ///\param Graph The directed graph type the algorithm runs on. |
44 ///\param Graph The directed graph type the algorithm runs on. |
45 ///\param LengthMap The type of the length map (values should be nonnegative). |
45 ///\param LengthMap The type of the length map (values should be nonnegative). |
46 /// |
46 /// |
47 ///\note It it questionable whether it is correct to call this method after |
47 ///\note It it questionable whether it is correct to call this method after |
164 |
162 |
165 ///Checks whether the complementary slackness holds. |
163 ///Checks whether the complementary slackness holds. |
166 |
164 |
167 ///This function checks, whether the given solution is optimal. |
165 ///This function checks, whether the given solution is optimal. |
168 ///Currently this function only checks optimality, |
166 ///Currently this function only checks optimality, |
169 ///doesn't bother with feasibility |
167 ///doesn't bother with feasibility. |
170 ///It is meant for testing purposes. |
168 ///It is meant for testing purposes. |
171 bool checkComplementarySlackness(){ |
169 bool checkComplementarySlackness(){ |
172 return min_cost_flow.checkComplementarySlackness(); |
170 return min_cost_flow.checkComplementarySlackness(); |
173 } |
171 } |
174 |
172 |
175 ///Read the found paths. |
173 ///Read the found paths. |
176 |
174 |
177 ///This function gives back the \c j-th path in argument p. |
175 ///This function gives back the \c j-th path in argument p. |
178 ///Assumes that \c run() has been run and nothing changed since then. |
176 ///Assumes that \c run() has been run and nothing has changed since then. |
179 /// \warning It is assumed that \c p is constructed to |
177 /// \warning It is assumed that \c p is constructed to |
180 ///be a path of graph \c G. |
178 ///be a path of graph \c G. |
181 ///If \c j is not less than the result of previous \c run, |
179 ///If \c j is not less than the result of previous \c run, |
182 ///then the result here will be an empty path (\c j can be 0 as well). |
180 ///then the result here will be an empty path (\c j can be 0 as well). |
183 /// |
181 /// |
184 ///\param Path The type of the path structure to put the result to (must meet lemon path concept). |
182 ///\param Path The type of the path structure to put the result to (must meet lemon path concept). |
185 ///\param p The path to put the result to |
183 ///\param p The path to put the result to. |
186 ///\param j Which path you want to get from the found paths (in a real application you would get the found paths iteratively) |
184 ///\param j Which path you want to get from the found paths (in a real application you would get the found paths iteratively). |
187 template<typename Path> |
185 template<typename Path> |
188 void getPath(Path& p, size_t j){ |
186 void getPath(Path& p, size_t j){ |
189 |
187 |
190 p.clear(); |
188 p.clear(); |
191 if (j>paths.size()-1){ |
189 if (j>paths.size()-1){ |