Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
Full3ComponentGeneratorEnumeration.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Graph.h>
36
37#include <functional>
38#include <limits>
39
40namespace ogdf {
41template<class E>
42class List;
43template<typename T>
44class EdgeWeightedGraph;
45
46namespace steiner_tree {
47
49template<typename T>
51public:
52 void call(const EdgeWeightedGraph<T>& G, const List<node>& terminals,
53 const NodeArray<bool>& isTerminal, const NodeArray<NodeArray<T>>& distance,
54 const NodeArray<NodeArray<edge>>& pred,
55 std::function<void(node, node, node, node, T)> generateFunction) const {
56 this->forAllTerminalTriples(terminals, distance,
57 [&](node u, node v, node w, const NodeArray<T>& uDistance,
58 const NodeArray<T>& vDistance, const NodeArray<T>& wDistance) {
59 node center = nullptr;
60 T minCost = std::numeric_limits<T>::max();
61 for (node x : G.nodes) {
62 this->updateBestCenter(x, center, minCost, uDistance, vDistance, wDistance);
63 }
64 this->checkAndGenerateFunction(u, v, w, center, minCost, pred, isTerminal,
65 generateFunction);
66 });
67 }
68};
69
70}
71}
Definition of ogdf::steiner_tree::Full3ComponentGeneratorModule class template.
Includes declaration of graph class.
Doubly linked lists (maintaining the length of the list).
Definition List.h:1451
Class for the representation of nodes.
Definition Graph_d.h:241
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
void call(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, const NodeArray< NodeArray< T > > &distance, const NodeArray< NodeArray< edge > > &pred, std::function< void(node, node, node, node, T)> generateFunction) const
Generate full components and call generateFunction for each full component.
Interface for full 3-component generation including auxiliary functions.
void updateBestCenter(node x, node &center, T &minCost, const NodeArray< T > &dist1, const NodeArray< T > &dist2, const NodeArray< T > &dist3) const
Update center node if it is the best so far.
void checkAndGenerateFunction(node u, node v, node w, node center, T minCost, const NodeArray< NodeArray< edge > > &pred, const NodeArray< bool > &isTerminal, std::function< void(node, node, node, node, T)> generateFunction) const
void forAllTerminalTriples(const List< node > &terminals, const NodeArray< NodeArray< T > > &distance, std::function< void(node, node, node, const NodeArray< T > &, const NodeArray< T > &, const NodeArray< T > &)> func) const
The namespace for all OGDF objects.