42template<
typename Graph,
typename Flags = datastructure::TimestampFlags>
45 using Node =
typename Graph::Node;
46 using Edge =
typename Graph::Edge;
60 static bool expand_all(
typename Graph::Node,
typename Graph::Edge) {
return true; }
77 template<
typename Range,
typename FWeight,
typename FSettle,
typename FExpand,
typename FTraverse>
78 bool traverse(
const Range& sources, FWeight&& weight, FSettle&& settle, FExpand&& expand,
79 FTraverse&& f_traverse) {
83 for (
auto v : sources) {
91 const double current_weight =
distances[v->index()];
94 settle(v, current_weight);
96 const Node w = e->opposite(v);
98 if (!
visited.is_set(w->index())) {
100 distances[w->index()] = current_weight + weight(v, e);
103 }
else if (current_weight + weight(v, e) <
distances[w->index()]) {
104 distances[w->index()] = current_weight + weight(v, e);
120 template<
typename FWeight,
typename FSettle,
typename FExpand,
typename FTraverse>
122 FTraverse&& f_traverse) {
123 return traverse(std::vector<Node>(1, source), weight, settle, expand, f_traverse);
Priority queue interface wrapping various heaps.
Data type for general directed graphs (adjacency list representation).
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
void pop()
Removes the top element from the heap.
void clear()
Removes all the entries from the queue.
bool empty() const
Checks whether the queue is empty.
Simple before-C++20 version for std::ranges::ref_view.
typename Graph::Node Node
bool traverse_single(const Node &source, FWeight &&weight, FSettle &&settle, FExpand &&expand, FTraverse &&f_traverse)
bool traverse(const Range &sources, FWeight &&weight, FSettle &&settle, FExpand &&expand, FTraverse &&f_traverse)
static void traverse_nothing(typename Graph::Node, typename Graph::Edge)
typename Graph::Edge Edge
static bool expand_all(typename Graph::Node, typename Graph::Edge)
std::vector< double > distances
Dijkstra(const Graph &_graph)
static void settle_nothing(typename Graph::Node, double weight)
std::vector< Element > reference
typename Heap::Handle Element
Defines a queue for handling prioritized elements.
const E & topElement() const
Returns the topmost element in the queue.
Handle push(const E &element, const P &priority)
Pushes a new element with the respective priority to the queue.
typename SuperQueue::handle Handle
The type of handle for accessing the elements of this queue.
void decrease(Handle pos, const P &priority)
The namespace for all OGDF objects.