COIN-OR::LEMON - Graph Library

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


Ignore:
Timestamp:
01/08/07 11:39:59 (13 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/floyd_warshall.h

    r2260 r2335  
    2727#include <lemon/list_graph.h>
    2828#include <lemon/graph_utils.h>
     29#include <lemon/bits/path_dump.h>
    2930#include <lemon/bits/invalid.h>
    3031#include <lemon/error.h>
     
    481482    ///@{
    482483
    483     /// \brief Copies the shortest path to \c t into \c p
    484     ///   
    485     /// This function copies the shortest path to \c t into \c p.
    486     /// If it \c t is a source itself or unreachable, then it does not
    487     /// alter \c p.
    488     /// \return Returns \c true if a path to \c t was actually copied to \c p,
    489     /// \c false otherwise.
    490     /// \sa DirPath
    491     template <typename Path>
    492     bool getPath(Path &p, Node source, Node target) {
    493       if (connected(source, target)) {
    494         p.clear();
    495         typename Path::Builder b(target);
    496         for(b.setStartNode(target); predEdge(source, target) != INVALID;
    497             target = predNode(target)) {
    498           b.pushFront(predEdge(source, target));
    499         }
    500         b.commit();
    501         return true;
    502       }
    503       return false;
     484    typedef PredMatrixMapPath<Graph, PredMap> Path;
     485
     486    ///Gives back the shortest path.
     487   
     488    ///Gives back the shortest path.
     489    ///\pre The \c t should be reachable from the \c t.
     490    Path path(Node s, Node t)
     491    {
     492      return Path(*graph, *_pred, s, t);
    504493    }
    505494         
Note: See TracChangeset for help on using the changeset viewer.