|
AntHocNet 2.0.0
Paper-faithful ant-colony ad hoc routing: the shared core and its adapters
|
#include <anthocnet/core/shortest_path.h>
Public Member Functions | |
| ShortestPathGraph (int nodeCount) | |
| A graph over node ids [0, nodeCount). | |
| int | nodeCount () const |
| void | addEdge (int from, int to, double weight=1.0) |
| Add a DIRECTED edge. | |
| std::size_t | edgeCount () const |
| Number of directed edges added (the oracle reports it as a diagnostic). | |
| void | computeFrom (int source) |
Run Dijkstra from source. Results are readable until the next call. | |
| int | source () const |
| The source of the last computeFrom(), or kNoNode before the first. | |
| double | distanceTo (int node) const |
| Cost of the shortest path source -> node, or unreachable(). | |
| int | firstHopTo (int node) const |
The node after source on the chosen shortest path to node: kNoNode when unreachable, and kNoNode for the source itself (a node needs no first hop to reach itself). | |
Static Public Member Functions | |
| static double | unreachable () |
| Returned by distanceTo() when there is no path. | |
Static Public Attributes | |
| static const int | kNoNode = -1 |
| Returned by firstHopTo() when there is no path (and for the source). | |
Definition at line 50 of file shortest_path.h.
|
explicit |
A graph over node ids [0, nodeCount).
|
inlinestatic |
Returned by distanceTo() when there is no path.
Definition at line 55 of file shortest_path.h.
|
inline |
Definition at line 60 of file shortest_path.h.
| void anthocnet::core::ShortestPathGraph::addEdge | ( | int | from, |
| int | to, | ||
| double | weight = 1.0 |
||
| ) |
Add a DIRECTED edge.
Callers modelling a bidirectional radio/ISL link add both directions; the oracle does, because a one-way link is not a usable route.
Throws std::invalid_argument on an out-of-range endpoint or a negative weight — both are caller bugs that would otherwise surface as a wrong route rather than as a failure.
|
inline |
Number of directed edges added (the oracle reports it as a diagnostic).
Definition at line 74 of file shortest_path.h.
| void anthocnet::core::ShortestPathGraph::computeFrom | ( | int | source | ) |
Run Dijkstra from source. Results are readable until the next call.
|
inline |
The source of the last computeFrom(), or kNoNode before the first.
Definition at line 80 of file shortest_path.h.
| double anthocnet::core::ShortestPathGraph::distanceTo | ( | int | node | ) | const |
Cost of the shortest path source -> node, or unreachable().
| int anthocnet::core::ShortestPathGraph::firstHopTo | ( | int | node | ) | const |
The node after source on the chosen shortest path to node: kNoNode when unreachable, and kNoNode for the source itself (a node needs no first hop to reach itself).
|
static |
Returned by firstHopTo() when there is no path (and for the source).
Definition at line 53 of file shortest_path.h.