All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
List of all members | Public Member Functions
BellmanFordWizard< TR > Class Template Reference

Detailed Description

template<class TR>
class lemon::BellmanFordWizard< TR >

This auxiliary class is created to implement the function-type interface of the Bellman-Ford algorithm. It does not have own run() method, it uses the functions and features of the plain BellmanFord.

This class should only be used through the bellmanFord() function, which makes it easier to use the algorithm.

Template Parameters
TRThe traits class that defines various types used by the algorithm.

#include <lemon/bellman_ford.h>

Inherits TR.

Public Member Functions

 BellmanFordWizard ()
 Constructor.
 
 BellmanFordWizard (const Digraph &gr, const LengthMap &len)
 Constructor that requires parameters.
 
 BellmanFordWizard (const TR &b)
 Copy constructor.
 
void run (Node s)
 Runs the Bellman-Ford algorithm from the given source node.
 
bool run (Node s, Node t)
 Runs the Bellman-Ford algorithm to find the shortest path between s and t.
 
template<class T >
BellmanFordWizard
< SetPredMapBase< T > > 
predMap (const T &t)
 Named parameter for setting the predecessor map.
 
template<class T >
BellmanFordWizard
< SetDistMapBase< T > > 
distMap (const T &t)
 Named parameter for setting the distance map.
 
template<class T >
BellmanFordWizard< SetPathBase
< T > > 
path (const T &t)
 
BellmanFordWizard dist (const Value &d)
 

Constructor & Destructor Documentation

BellmanFordWizard ( const Digraph &  gr,
const LengthMap &  len 
)
inline

Constructor that requires parameters. These parameters will be the default values for the traits class.

Parameters
grThe digraph the algorithm runs on.
lenThe length map.

Member Function Documentation

void run ( Node  s)
inline

This method runs the Bellman-Ford algorithm from the given source node in order to compute the shortest path to each node.

bool run ( Node  s,
Node  t 
)
inline

This method runs the Bellman-Ford algorithm from node s in order to compute the shortest path to node t. Actually, it computes the shortest path to each node, but using this function you can retrieve the distance and the shortest path for a single target node easier.

Returns
true if t is reachable form s.
BellmanFordWizard<SetPredMapBase<T> > predMap ( const T &  t)
inline

Named parameter for setting the map that stores the predecessor arcs of the nodes.

BellmanFordWizard<SetDistMapBase<T> > distMap ( const T &  t)
inline

Named parameter for setting the map that stores the distances of the nodes calculated by the algorithm.

BellmanFordWizard<SetPathBase<T> > path ( const T &  t)
inline

Named parameter for getting the shortest path to the target node.

BellmanFordWizard dist ( const Value &  d)
inline

Named parameter for getting the distance of the target node.