#include <Bellman_Ford.H>
Public Member Functions | |
| Bellman_Ford (const GT &__g, Distance d=Distance(), SA __sa=SA()) | |
| bool | paint_spanning_tree (Node *start) |
| bool | faster_paint_spanning_tree (Node *start) |
| bool | has_negative_cycle (Node *start) |
| bool | has_negative_cycle () |
| Path< GT > | test_negative_cycle (Node *start) |
| Path< GT > | test_negative_cycle () |
| tuple< Path< GT >, size_t > | search_negative_cycle (Node *start, double it_factor, const size_t step) |
| Path< GT > | search_negative_cycle (Node *start) |
| tuple< Path< GT >, size_t > | search_negative_cycle (double it_factor, const size_t step) |
| Path< GT > | search_negative_cycle () |
| DynArray< Arc * > | extract_mim_spanning_tree () |
| void | build_tree (GT &tree, bool with_map=true) |
| bool | test_negative_cycle (typename GT::Node *s, Path< GT > &cycle) |
| bool | test_negative_cycle (Path< GT > &cycle) |
| Distance_Type | get_min_path (typename GT::Node *end, Path< GT > &path) |
| DynMapTree< Node *, Distance_Type > | compute_nodes_weights () |
Algorithms associated to Bellman-Ford algorithm for searching minimal paths in a graph.
|
inline |
Extract from the graph a previously painted minimal spanning tree of minimal paths.
This method requires that a minimal spanning tree has been executed with a paint() method.
| [in] | tree | a graph where the minimal spanning tree will be put. |
| [in] | with_map | if true the the extracted tree is mapped through the cookies with the graph. |
Here is the call graph for this function:
|
inline |
Retorna en el mapeo avl los pesos asociados a cada nodo obtenidos luego de ejecutar el algoritmo de Bellman-Ford a partir de un nodo ficticio. Esta rutina está concebida especÃficamente para el algoritmo de Jhonson de cálculo de todos los caminos mÃnimos a partir de un nodo dado.
| [in] | m | un mapeo avl dinámico de la forma Node*–>w de puntero a nodo a peso asociado al nodo. |
Here is the call graph for this function:
|
inline |
Extract the minimal spanning tree in a compressed form.
On a previously painted minimal spanning tree of shortest paths starting on source node, this method extract the tree and loads it in an array of arcs.
| domain_error | if the minimal spanning tree has not previously built |
Here is the call graph for this function:
|
inline |
faster minimal spaning tree painting from a start node.
This methods executes a probably faster version of Bellman-Ford algorithm
| [in] | start | source node from which the minimal path will be computed |
false is returned and the minimal spanning tree is painted with the bit Spanning_Tree
Here is the call graph for this function:
|
inline |
Returns true if it exists a negative cycle in any path starting from node start
Here is the call graph for this function:
|
inline |
Paint the minimal spaning tree for the a start node.
| [in] | start | source node from which the minimal path will be computed |
false is returned and the minimal spanning tree is painted with the bit Spanning_Tree
|
inline |
Searches a negative cycle using the faster version of Bellman-Ford algorithm and iteratively searching the cycle before finishing up.
Normally, the Bellman-Ford algorith certainly detects a negative cycle if during an additional arcs scanning an arc is relaxed. However, very frequently the cycle appears in graph used for representing the partial spanning tree.
This version could be seen as thus:
threshold = it_factor*|V|;
for (int i = 0; i < |V|; ++i)
{
for (e in Arcs) // for each arc e
relax e;
if (i >= threshold)
{
search a cycle in the graph representing the spanning tree threshold += step; if negative cylce is found return it; } }
So, from the threshold-th iteration, the algoritm try to find a negative cycle on the hope that if this exists, then the algorithm will finish too much before the normal completion.
| [in] | start | node from which the spanning tree is build. |
| [in] | it_factor | iterative factor since then the negative cycle is searched. |
| [in] | step | next step from which the next negative cycle will be done. |
get<0> value corresponds to the found negative cycle (if this one exists) and get<1> value is the external iteration when the cyle was found. The idea of this second field is to give feedback in order to eventually refine the it_factor value.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Searches a negative cycle using the faster version of Bellman-Ford algorithm and iteratively searching the cycle before finishing up.
This overloaded version searches for negatives cycles in all the graph. For that, a dummy and temporal node is inserted into the graph and the search is perfomed using the dummy node as starting node.
Here is the call graph for this function:
|
inline |
Searches a negative cycle using the faster version of Bellman-Ford algorithm.
| [in] | start | node from which the spanning tree is build. |
| [in] | it_factor | iterative factor since then the negative cycle is searched. |
| [in] | step | next step from which the next negative cycle will be done. |
get<0> value corresponds to the found negative cycle (if this one exists) and get<1> value is the external iteration when the cyle was found. The idea of this second field is to give feedback in order to eventually refine the it_factor value.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Here is the call graph for this function:
|
inline |
Search a negative cycle on the all possible paths starting from start node.
If a negative cycle is found, the the Tarjan algorithm is executed for retrieving it. In this case the cyle is returned. Otherwise (tehere is no negative cycle), the returned path is empty.
| [in] | start | stating node |
Here is the call graph for this function:
|
inline |
Searches and returns a negative cycle (if it exists).