COIN-OR::LEMON - Graph Library

Changeset 860:3577b3db6089 in lemon-0.x for src/hugo/minlengthpaths.h


Ignore:
Timestamp:
09/16/04 12:26:14 (20 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1160
Message:

Completed documentation for mincostflows and minlengthpaths.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/hugo/minlengthpaths.h

    r853 r860  
    88
    99
    10 //#include <hugo/dijkstra.h>
    11 //#include <hugo/graph_wrapper.h>
    1210#include <hugo/maps.h>
    1311#include <vector>
     
    1917/// @{
    2018
    21   ///\brief Implementation of an algorithm for finding k paths between 2 nodes
     19  ///\brief Implementation of an algorithm for finding k edge-disjoint paths between 2 nodes
    2220  /// of minimal total length
    2321  ///
    24   /// The class \ref hugo::MinLengthPaths "MinLengthPaths" implements
     22  /// The class \ref hugo::MinLengthPaths implements
    2523  /// an algorithm for finding k edge-disjoint paths
    2624  /// from a given source node to a given target node in an
    27   /// edge-weighted directed graph having minimal total weigth (length).
     25  /// edge-weighted directed graph having minimal total weight (length).
    2826  ///
    29   ///\warning It is assumed that the lengths are positive, since the
    30   /// general flow-decomposition is not implemented yet.
     27  ///\warning Length values should be nonnegative.
     28  ///
     29  ///\param Graph The directed graph type the algorithm runs on.
     30  ///\param LengthMap The type of the length map (values should be nonnegative).
    3131  ///
    3232  ///\author Attila Bernath
     
    6060
    6161
     62    /// The constructor of the class.
     63   
     64    ///\param _G The directed graph the algorithm runs on.
     65    ///\param _length The length (weight or cost) of the edges.
    6266    MinLengthPaths(Graph& _G, LengthMap& _length) : G(_G),
    6367      const1map(1), mincost_flow(_G, _length, const1map){}
     
    6872    ///Returns k if there are at least k edge-disjoint paths from s to t.
    6973    ///Otherwise it returns the number of found edge-disjoint paths from s to t.
     74    ///
     75    ///\param s The source node.
     76    ///\param t The target node.
     77    ///\param k How many paths are we looking for?
     78    ///
    7079    int run(Node s, Node t, int k) {
    7180
    7281      int i = mincost_flow.run(s,t,k);
    73      
    74 
     82   
    7583
    7684      //Let's find the paths
     
    112120
    113121   
    114     ///Total length of the paths
     122    ///Returns the total length of the paths
    115123   
    116124    ///This function gives back the total length of the found paths.
     
    121129    }
    122130
    123     ///Return the found flow.
     131    ///Returns the found flow.
    124132
    125133    ///This function returns a const reference to the EdgeMap \c flow.
     
    128136    const EdgeIntMap &getFlow() const { return mincost_flow.flow;}
    129137
    130     /// Return the optimal dual solution
     138    /// Returns the optimal dual solution
    131139   
    132140    ///This function returns a const reference to the NodeMap
     
    137145    ///Checks whether the complementary slackness holds.
    138146
    139     ///This function checks, whether the given solution is optimal
    140     ///Running after a \c run() should return with true
     147    ///This function checks, whether the given solution is optimal.
     148    ///It should return true after calling \ref run()
    141149    ///Currently this function only checks optimality,
    142150    ///doesn't bother with feasibility
     151    ///It is meant for testing purposes.
    143152    ///
    144     ///\todo Is this OK here?
    145153    bool checkComplementarySlackness(){
    146154      return mincost_flow.checkComplementarySlackness();
     
    155163    ///If \c j is not less than the result of previous \c run,
    156164    ///then the result here will be an empty path (\c j can be 0 as well).
     165    ///
     166    ///\param Path The type of the path structure to put the result to (must meet hugo path concept).
     167    ///\param p The path to put the result to
     168    ///\param j Which path you want to get from the found paths (in a real application you would get the found paths iteratively)
    157169    template<typename Path>
    158170    void getPath(Path& p, size_t j){
    159      
     171
    160172      p.clear();
    161173      if (j>paths.size()-1){
Note: See TracChangeset for help on using the changeset viewer.