1.1 --- a/lemon/suurballe.h Fri Jan 05 10:59:18 2007 +0000
1.2 +++ b/lemon/suurballe.h Mon Jan 08 10:39:59 2007 +0000
1.3 @@ -26,6 +26,7 @@
1.4
1.5 #include <lemon/maps.h>
1.6 #include <vector>
1.7 +#include <lemon/path.h>
1.8 #include <lemon/ssp_min_cost_flow.h>
1.9
1.10 namespace lemon {
1.11 @@ -82,7 +83,7 @@
1.12 SspMinCostFlow<Graph, LengthMap, ConstMap> min_cost_flow;
1.13
1.14 //Container to store found paths
1.15 - std::vector< std::vector<Edge> > paths;
1.16 + std::vector<SimplePath<Graph> > paths;
1.17
1.18 public :
1.19
1.20 @@ -134,7 +135,7 @@
1.21 ++e;
1.22 }
1.23 n = G.target(e);
1.24 - paths[j].push_back(e);
1.25 + paths[j].addBack(e);
1.26 reversed[e] = 1-reversed[e];
1.27 }
1.28
1.29 @@ -170,6 +171,8 @@
1.30 return min_cost_flow.checkComplementarySlackness();
1.31 }
1.32
1.33 + typedef SimplePath<Graph> Path;
1.34 +
1.35 /// \brief Read the found paths.
1.36 ///
1.37 /// This function gives back the \c j-th path in argument p.
1.38 @@ -181,25 +184,17 @@
1.39 /// previous \c run, then the result here will be an empty path
1.40 /// (\c j can be 0 as well).
1.41 ///
1.42 - /// \param Path The type of the path structure to put the result
1.43 - /// to (must meet lemon path concept).
1.44 - /// \param p The path to put the result to.
1.45 /// \param j Which path you want to get from the found paths (in a
1.46 /// real application you would get the found paths iteratively).
1.47 - template<typename Path>
1.48 - void getPath(Path& p, size_t j){
1.49 + Path path(int j) const {
1.50 + return paths[j];
1.51 + }
1.52
1.53 - p.clear();
1.54 - if (j>paths.size()-1){
1.55 - return;
1.56 - }
1.57 - typename Path::Builder B(p);
1.58 - for(typename std::vector<Edge>::iterator i=paths[j].begin();
1.59 - i!=paths[j].end(); ++i ){
1.60 - B.pushBack(*i);
1.61 - }
1.62 -
1.63 - B.commit();
1.64 + /// \brief Gives back the number of the paths.
1.65 + ///
1.66 + /// Gives back the number of the constructed paths.
1.67 + int pathNum() const {
1.68 + return paths.size();
1.69 }
1.70
1.71 }; //class Suurballe