40namespace steiner_tree {
53 std::vector<std::vector<node>>
chains;
71 const int right,
const std::vector<T>&
baseArray)
const {
77 int middle = (left + right) >> 1;
125 if (ancestor ==
nullptr) {
138 for (
int i = 0; i < (
int)
chains.size(); ++i) {
158 for (
int i = 0; i < (
int)
chains.size(); ++i) {
183 edge e = adj->theEdge();
227 while (left <= right) {
228 middle = (left + right) >> 1;
Extends the GraphCopy concept to weighted graphs.
Class for adjacency list elements.
INDEX size() const
Returns the size (number of elements) of the array.
Class for the representation of edges.
Doubly linked lists (maintaining the length of the list).
Dynamic arrays indexed with nodes.
Class for the representation of nodes.
int degree() const
Returns the degree of the node (indegree + outdegree).
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
An implementation of the heavy path decomposition on trees.
List< node > terminals
list of terminals of the desc tree
NodeArray< int > chainOfNode
the index of a node's chain
NodeArray< int > nodeLevel
the level of a node in the tree
NodeArray< int > positionOnChain
position of a node on his chain
void buildMaxSegmentTree(std::vector< T > &segmentTree, const int nodeIndex, const int left, const int right, const std::vector< T > &baseArray) const
builds a max segment tree on the baseArray
std::vector< node > fatherOfChain
the first node from bottom up that does not belong to the chain
std::vector< std::vector< T > > longestDistToSteinerAncestorOnChain
the max of the interval 0..i for every i on chains
void computeBottleneckOnBranch(node x, node ancestor, T &longestPathDistance, T &fromLowestToAncestor) const
computes for the path from x to ancestor the maximum distance (sum of edges) between any two consecut...
std::vector< std::vector< node > > chains
list of chains of nodes corresponding to the decomposition
T getMaxSegmentTree(const std::vector< T > &segmentTree, const int nodeIndex, const int left, const int right, const int queryLeft, const int queryRight) const
extracts the maximum on the required interval
std::vector< std::vector< node > > chainsOfTerminals
list of chains only of terminals corresponding to the decomposition
NodeArray< T > distanceToRoot
the length of the edge to his father
const EdgeWeightedGraphCopy< T > & tree
constant ref to the tree to be decomposed
NodeArray< node > closestSteinerAncestor
the highest-level Steiner ancestor of the current node
void dfsHeavyPathDecomposition(node v, node closestSteinerUpNode)
performs the heavy path decomposition on the tree belonging to the class updates the fields of the cl...
node lowestCommonAncestor(node x, node y) const
computes the lowest common ancestor of nodes x and y using the hpd
T getBottleneckSteinerDistance(node x, node y) const
computes in the bottleneck distance between terminals x and y
HeavyPathDecomposition(const EdgeWeightedGraphCopy< T > &treeEWGraphCopy)
T distanceToAncestor(node v, node ancestor) const
computes the sum of all edges on the path from v to ancestor v must be in ancestor's subtree
const NodeArray< bool > isTerminal
isTerminal of the desc tree
void computeLongestDistToSteinerAncestorOnChain()
creates for every chain an array with the maximum of every prefix of a fictive array which keeps for ...
std::vector< std::vector< T > > longestDistToSteinerAncestorSegTree
segment tree for segment maxs on every chain
NodeArray< int > weightOfSubtree
weight of the subtree rooted in one node
node binarySearchUpmostTerminal(node v, const std::vector< node > &chainOfTerminals) const
performs a binary search on chainOfTerminals, searches for the closest node to the root on chainOfTer...
void computeLongestDistToSteinerAncestorSegTree()
creates for every chain a segment tree built on a fictive array which keeps for every node the sum of...
Reverse< T > reverse(T &container)
Provides iterators for container to make it easily iterable in reverse.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
void updateMax(T &max, const T &newValue)
Stores the maximum of max and newValue in max.
The namespace for all OGDF objects.