COIN-OR::LEMON - Graph Library

Changeset 2335:27aa03cd3121 in lemon-0.x for lemon/dijkstra.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/dijkstra.h

    r2269 r2335  
    2828#include <lemon/list_graph.h>
    2929#include <lemon/bin_heap.h>
     30#include <lemon/bits/path_dump.h>
    3031#include <lemon/bits/invalid.h>
    3132#include <lemon/error.h>
    3233#include <lemon/maps.h>
     34
    3335
    3436namespace lemon {
     
    718720    ///@{
    719721
    720     ///Copies the shortest path to \c t into \c p
    721    
    722     ///This function copies the shortest path to \c t into \c p.
    723     ///If it \c t is a source itself or unreachable, then it does not
    724     ///alter \c p.
    725     ///\return Returns \c true if a path to \c t was actually copied to \c p,
    726     ///\c false otherwise.
    727     ///\sa DirPath
    728     template<class P>
    729     bool getPath(P &p,Node t)
    730     {
    731       if(reached(t)) {
    732         p.clear();
    733         typename P::Builder b(p);
    734         for(b.setStartNode(t);predEdge(t)!=INVALID;t=predNode(t))
    735           b.pushFront(predEdge(t));
    736         b.commit();
    737         return true;
    738       }
    739       return false;
    740     }
    741          
     722    typedef PredMapPath<Graph, PredMap> Path;
     723
     724    ///Gives back the shortest path.
     725   
     726    ///Gives back the shortest path.
     727    ///\pre The \c t should be reachable from the source.
     728    Path path(Node t)
     729    {
     730      return Path(*G, *_pred, t);
     731    }
     732
    742733    ///The distance of a node from the root.
    743734
Note: See TracChangeset for help on using the changeset viewer.