41 namespace steiner_tree {
130 #ifdef OGDF_SAVEDYNAMIC_CHANGE_TST 143 if (save1 == save2) {
159 #ifdef OGDF_SAVEDYNAMIC_CHANGE_TST 160 const node newNode0 = v, newNode1 = currentNode;
170 if (v1level < v2level) {
172 swap(v1level, v2level);
174 if (v0level < v1level) {
176 swap(v0level, v1level);
178 if (v1level < v2level) {
180 swap(v1level, v2level);
185 swap(v1level, v2level);
189 swap(v0level, v1level);
195 for(
adjEntry adj : currentNode->adjEntries) {
197 if (e->
target() == currentNode) {
234 #ifdef OGDF_SAVEDYNAMIC_CHANGE_TST 235 edge newEdge0, newEdge1;
274 #ifndef OGDF_SAVEDYNAMIC_CHANGE_TST node target() const
Returns the target node of the edge.
node lca(node u, node v) const
Returns the node in m_tree that is the LCA of two nodes.
Implements the <O(n log n), O(1)>-time "sparse table" algorithm by Bender and Farach-Colton to comput...
virtual T gain(node u, node v, node w) const
Returns the gain (sum of save edge costs) of the given triple, calculated by an LCA query...
edge theEdge() const
Returns the edge associated with this adjacency entry.
Data type for general directed graphs (adjacency list representation).
virtual void delNode(node v)
Removes node v and all incident edges from the graph.
int level(node v) const
Returns the level of a node. The level of the root is 0.
Dynamically updatable weighted Tree for determining save edges via LCA computation.
node buildHeaviestEdgeInComponentTree(const EdgeWeightedGraphCopy< T > &inputTree, NodeArray< node > &externalNodes, NodeArray< edge > &treeEdge, Graph &outputTree)
Given an edge-weighted tree, builds an auxiliary arborescence where each arc of the input tree is a n...
T weight(edge e) const
Returns the weight of an edge in the terminal tree or 0.
virtual void delEdge(edge e)
Removes edge e from the graph.
NodeArray< edge > m_treeEdge
Maps each inner node of m_tree to an edge in m_steinerTree.
node call(node u, node v) const
Returns the LCA of two nodes u and v.
node m_root
The root node of the weighted binary tree.
NodeArray< node > m_cTerminals
Connects terminal nodes in the terminal spanning tree to their leafs in the weighted tree...
Dynamic arrays indexed with nodes.
edge newEdge(node v, node w)
Creates a new edge (v,w) and returns it.
virtual void update(const Triple< T > &t)
Updates the weighted tree data structure given a contracted triple.
T weight(node v) const
Returns the associated weight of a node v in m_tree, or 0 if it is not associated.
Class for the representation of edges.
LCA * m_lca
Data structure for calculating the LCAs.
Class for the representation of nodes.
The Sparse Table Algorithm for the Least Common Ancestor problem as proposed by Bender and Farach-Col...
Definition of a Triple used in contraction-based approximation algorithm for the minimum Steiner tree...
SaveDynamic(EdgeWeightedGraphCopy< T > &steinerTree)
Builds a weighted binary tree based on the given terminal spanning tree.
const EdgeWeightedGraphCopy< T > * m_steinerTree
The underlying terminal spanning tree this weighted tree instance represents.
Interface for various LCA methods.
virtual edge saveEdge(node u, node v) const
Determines the save edge between two nodes by a LCA query.
node source() const
Returns the source node of the edge.
Algorithms used by at least two functions of Steiner tree code or its internal helpers.
Graph m_tree
The weighted binary tree to represent the edge weight hierarchy.
The namespace for all OGDF objects.
node newNode()
Creates a new node and returns it.
This class serves as an interface for different approaches concerning the calculation of save edges...
virtual T saveWeight(node u, node v) const
Determines the weight of the save edge between two nodes by a LCA query.
Class for adjacency list elements.
void contractTripleInSteinerTree(const Triple< T > &t, EdgeWeightedGraphCopy< T > &st, edge save0, edge save1, edge save2, edge &ne0, edge &ne1)
Updates the Steiner tree by deleting save edges, removing all direct connections between the terminal...
This class represents a triple used by various contraction-based minimum Steiner tree approximations...
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.