COIN-OR::LEMON - Graph Library

Changeset 2335:27aa03cd3121 in lemon-0.x for lemon/suurballe.h


Ignore:
Timestamp:
01/08/07 11:39:59 (17 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3123
Message:

New path concept and path structures

TODO: BellmanFord::negativeCycle()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/suurballe.h

    r2276 r2335  
    2727#include <lemon/maps.h>
    2828#include <vector>
     29#include <lemon/path.h>
    2930#include <lemon/ssp_min_cost_flow.h>
    3031
     
    8384
    8485    //Container to store found paths
    85     std::vector< std::vector<Edge> > paths;
     86    std::vector<SimplePath<Graph> > paths;
    8687
    8788  public :
     
    135136          }
    136137          n = G.target(e);
    137           paths[j].push_back(e);
     138          paths[j].addBack(e);
    138139          reversed[e] = 1-reversed[e];
    139140        }
     
    171172    }
    172173
     174    typedef SimplePath<Graph> Path;
     175
    173176    /// \brief Read the found paths.
    174177    ///
     
    182185    /// (\c j can be 0 as well).
    183186    ///
    184     /// \param Path The type of the path structure to put the result
    185     /// to (must meet lemon path concept).
    186     /// \param p The path to put the result to.
    187187    /// \param j Which path you want to get from the found paths (in a
    188188    /// real application you would get the found paths iteratively).
    189     template<typename Path>
    190     void getPath(Path& p, size_t j){
    191 
    192       p.clear();
    193       if (j>paths.size()-1){
    194         return;
    195       }
    196       typename Path::Builder B(p);
    197       for(typename std::vector<Edge>::iterator i=paths[j].begin();
    198           i!=paths[j].end(); ++i ){
    199         B.pushBack(*i);
    200       }
    201 
    202       B.commit();
     189    Path path(int j) const {
     190      return paths[j];
     191    }
     192
     193    /// \brief Gives back the number of the paths.
     194    ///
     195    /// Gives back the number of the constructed paths.
     196    int pathNum() const {
     197      return paths.size();
    203198    }
    204199
Note: See TracChangeset for help on using the changeset viewer.