Suurballe Class Template Reference
[Path and Flow Algorithms]

#include <suurballe.h>

Collaboration diagram for Suurballe:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<typename Graph, typename LengthMap>
class lemon::Suurballe< Graph, LengthMap >

The class lemon::Suurballe implements an algorithm for finding k edge-disjoint paths from a given source node to a given target node in an edge-weighted directed graph having minimal total weight (length).

Warning:
Length values should be nonnegative.
Parameters:
Graph The directed graph type the algorithm runs on.
LengthMap The type of the length map (values should be nonnegative).
Note:
It it questionable if it is correct to call this method after Suurballe for it is just a special case of Edmond's and Karp's algorithm for finding minimum cost flows. In fact, this implementation is just wraps the MinCostFlow algorithms. The paper of both Suurballe and Edmonds-Karp published in 1972, therefore it is possibly right to state that they are independent results. Most frequently this special case is referred as Suurballe method in the literature, especially in communication network context.
Author:
Attila Bernath

Definition at line 58 of file suurballe.h.

Public Member Functions

 Suurballe (Graph &_G, LengthMap &_length)
 The constructor of the class.
int run (Node s, Node t, int k)
 Runs the algorithm.
Length totalLength ()
 Returns the total length of the paths.
const EdgeIntMap & getFlow () const
 Returns the found flow.
const EdgeIntMap & getPotential () const
 Returns the optimal dual solution.
bool checkComplementarySlackness ()
 Checks whether the complementary slackness holds.
template<typename Path> void getPath (Path &p, size_t j)
 Read the found paths.


Constructor & Destructor Documentation

Suurballe Graph &  _G,
LengthMap &  _length
[inline]
 

Parameters:
_G The directed graph the algorithm runs on.
_length The length (weight or cost) of the edges.
Definition at line 90 of file suurballe.h.


Member Function Documentation

int run Node  s,
Node  t,
int  k
[inline]
 

Runs the algorithm. Returns k if there are at least k edge-disjoint paths from s to t. Otherwise it returns the number of found edge-disjoint paths from s to t.

Parameters:
s The source node.
t The target node.
k How many paths are we looking for?
Definition at line 103 of file suurballe.h.

References MinCostFlow::getFlow(), lemon::INVALID, and MinCostFlow::run().

Here is the call graph for this function:

Length totalLength  )  [inline]
 

This function gives back the total length of the found paths.

Precondition:
run() must be called before using this function.
Definition at line 151 of file suurballe.h.

References MinCostFlow::totalLength().

Here is the call graph for this function:

const EdgeIntMap& getFlow  )  const [inline]
 

This function returns a const reference to the EdgeMap flow.

Precondition:
run() must be called before using this function.
Definition at line 160 of file suurballe.h.

References MinCostFlow::flow.

const EdgeIntMap& getPotential  )  const [inline]
 

This function returns a const reference to the NodeMap potential (the dual solution).

Precondition:
run() must be called before using this function.
Definition at line 167 of file suurballe.h.

References MinCostFlow::potential.

bool checkComplementarySlackness  )  [inline]
 

This function checks, whether the given solution is optimal. It should return true after calling run() Currently this function only checks optimality, doesn't bother with feasibility It is meant for testing purposes. Definition at line 177 of file suurballe.h.

References MinCostFlow::checkComplementarySlackness().

Here is the call graph for this function:

void getPath Path &  p,
size_t  j
[inline]
 

This function gives back the j-th path in argument p. Assumes that run() has been run and nothing changed since then.

Warning:
It is assumed that p is constructed to be a path of graph G. If j is not less than the result of previous run, then the result here will be an empty path (j can be 0 as well).
Parameters:
Path The type of the path structure to put the result to (must meet lemon path concept).
p The path to put the result to
j Which path you want to get from the found paths (in a real application you would get the found paths iteratively)
Definition at line 194 of file suurballe.h.


The documentation for this class was generated from the following file:
Generated on Thu Sep 30 12:18:39 2004 for LEMON by doxygen 1.3.8