51 template<
typename T,
template<
typename P,
class C>
class H = PairingHeap>
66 bool directed =
false)
69 distance.
init(G, numeric_limits<T>::max());
70 predecessor.
init(G,
nullptr);
74 queue.
push(v, distance[v]);
76 for (
node s : sources) {
77 queue.
decrease(s, (distance[s] = 0));
86 while (!queue.
empty()) {
90 && m_eps.
greater(distance[v], static_cast<T>(0))) {
96 if (directed && e->
target() == v) {
99 if (m_eps.
greater(distance[w], distance[v] + weight[e])) {
100 OGDF_ASSERT(numeric_limits<T>::max() - weight[e] >= distance[v]);
101 queue.
decrease(w, (distance[w] = distance[v] + weight[e]));
117 bool directed =
false)
121 call(G, weight, sources, predecessor, distance, directed);
node target() const
Returns the target node of the edge.
void pop()
Removes the topmost element from the queue.
edge theEdge() const
Returns the edge associated with this adjacency entry.
Dijkstra's single source shortest path algorithm.
iterator pushBack(const E &x)
Adds element x at the end of the list.
Data type for general directed graphs (adjacency list representation).
void push(const E &element, const P &priority)
Adds a new element to the queue.
void init()
Reinitializes the array. Associates the array with no graph.
void call(const Graph &G, const EdgeArray< T > &weight, const List< node > &sources, NodeArray< edge > &predecessor, NodeArray< T > &distance, bool directed=false)
Calculates, based on the graph G with corresponding edge costs and source nodes, the shortest paths a...
Dynamic arrays indexed with edges.
Prioritized queue interface wrapper for heaps.
Compare floating point numbers with epsilons and integral numbers with normal compare operators...
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Dynamic arrays indexed with nodes.
const E & topElement() const
Returns the topmost element in the queue.
Doubly linked lists (maintaining the length of the list).
void decrease(const E &element, const P &priority)
Decreases the priority of the given element.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Class for the representation of edges.
Class for the representation of nodes.
Priority queue interface wrapping various heaps.
std::enable_if< std::is_integral< T >::value, bool >::type greater(const T &x, const T &y) const
Compare if x is GREATER than y for integral types.
void call(const Graph &G, const EdgeArray< T > &weight, node s, NodeArray< edge > &predecessor, NodeArray< T > &distance, bool directed=false)
Calculates, based on the graph G with corresponding edge costs and a source node s, the shortest paths and distances to all other nodes by Dijkstra's algorithm.
Includes declaration of graph class.
bool empty() const
Checks whether the queue is empty.
EpsilonTest m_eps
For floating point comparisons (if floating point is used)
The namespace for all OGDF objects.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
Class for adjacency list elements.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.