Home | Documentation | Download | Platforms | Projects | Mailing Lists | Version History
Public Types | |
typedef list< node > ::const_iterator | shortest_path_node_iterator |
Iterator type for traversing nodes on one shortest path. | |
typedef list< edge > ::const_iterator | shortest_path_edge_iterator |
Iterator type for traversing edges on one shortest path. | |
Public Member Functions | |
bid_dijkstra () | |
Default constructor. | |
virtual | ~bid_dijkstra () |
Destructor. | |
void | source_target (const node &s, const node &t) |
Sets source and target node. | |
void | weights (const edge_map< double > &weight) |
Sets weights of the edges. | |
void | store_path (bool set) |
Enables or disables the storing of the shortest path. | |
virtual int | check (graph &G) |
Checks whether the preconditions for bidirectional Dijkstra are satisfied. | |
int | run (graph &G) |
Runs shortest path algorithm on G . | |
node | source () const |
Returns source node. | |
node | target () const |
Returns target node if set, node::node() else. | |
bool | store_path () const |
Returns whether the storing of the shortest path is enabled. | |
bool | reached () const |
Returns whether target is reachable from source. | |
double | distance () const |
Returns the distance from source node to target node. | |
shortest_path_node_iterator | shortest_path_nodes_begin () |
Returns an iterator to the beginning (to the source node) of the shortest node path to target node. | |
shortest_path_node_iterator | shortest_path_nodes_end () |
Returns an iterator one after the end (one after target node) of the shortest node path to target node. | |
shortest_path_edge_iterator | shortest_path_edges_begin () |
Returns an iterator to the beginning edge of the shortest edge path to target node. | |
shortest_path_edge_iterator | shortest_path_edges_end () |
Returns an iterator one after the end of a shortest edge path to target node. | |
virtual void | reset () |
Resets Dijkstra's bidirectional algorithm. |
This class implements Dijkstra's algorithm in a bidirectional manner for computing a shortest path from a single source to a single target in worst case.
bid_dijkstra::bid_dijkstra | ( | ) |
virtual bid_dijkstra::~bid_dijkstra | ( | ) | [virtual] |
Sets source and target node.
Must be executed every time before check and run of this algorithm.
s | source node | |
t | target node |
void bid_dijkstra::weights | ( | const edge_map< double > & | weight | ) |
Sets weights of the edges.
This method must be called before check and run.
weight | weights of the edges |
void bid_dijkstra::store_path | ( | bool | set | ) |
Enables or disables the storing of the shortest path.
If enabled for every node and edge on the shortest path from source to target will be stored.
set | true if path should be stored |
virtual int bid_dijkstra::check | ( | graph & | G | ) | [virtual] |
Checks whether the preconditions for bidirectional Dijkstra are satisfied.
The Precondition are that the weights of the edges have been set and that the graph has at least one node. Additionally all edge weights must be and and source and target nodes must be found in
G
.
G | graph |
algorithm::GTL_OK | if algorithm can be applied | |
algorithm::GTL_ERROR | otherwise |
dijkstra::weigths
Implements algorithm.
int bid_dijkstra::run | ( | graph & | G | ) | [virtual] |
Runs shortest path algorithm on G
.
This should return always algorithm::GTL_OK. The return value only tracks errors that might occur. Afterwards the result of the test can be accessed via access methods.
G | graph |
algorithm::GTL_OK | on success | |
algorithm::GTL_ERROR | otherwise |
Implements algorithm.
node bid_dijkstra::source | ( | ) | const |
Returns source node.
node bid_dijkstra::target | ( | ) | const |
bool bid_dijkstra::store_path | ( | ) | const |
Returns whether the storing of the shortest path is enabled.
true
iff the storing of path is enabled.bool bid_dijkstra::reached | ( | ) | const |
Returns whether target is reachable from source.
true
iff target was reached from source double bid_dijkstra::distance | ( | ) | const |
Returns the distance from source node to target node.
-1.0
else shortest_path_node_iterator bid_dijkstra::shortest_path_nodes_begin | ( | ) |
Returns an iterator to the beginning (to the source node) of the shortest node path to target node.
shortest_path_node_iterator bid_dijkstra::shortest_path_nodes_end | ( | ) |
Returns an iterator one after the end (one after target node) of the shortest node path to target node.
shortest_path_edge_iterator bid_dijkstra::shortest_path_edges_begin | ( | ) |
Returns an iterator to the beginning edge of the shortest edge path to target node.
shortest_path_edge_iterator bid_dijkstra::shortest_path_edges_end | ( | ) |
Returns an iterator one after the end of a shortest edge path to target node.
virtual void bid_dijkstra::reset | ( | ) | [virtual] |
Resets Dijkstra's bidirectional algorithm.
It prepares the algorithm to be applied again, possibly to another graph.
Implements algorithm.
University of Passau - FMI - Theoretical Computer Science