|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
58 namespace steiner_tree {
86 node edgeNode =
nullptr;
88 edgeNode = outputTree.
newNode();
89 edge e = sortEdges[i].item();
90 treeEdge[edgeNode] = e;
94 if (externalNodes[u]) {
95 node* uRoot = root[externalNodes[u]];
97 while (root[*uRoot] != uRoot) {
98 *uRoot = *root[*uRoot];
102 outputTree.
newEdge(edgeNode, *uRoot);
103 root[edgeNode] = uRoot;
104 if (externalNodes[v]) {
105 node* vRoot = root[externalNodes[v]];
107 while (root[*vRoot] != vRoot) {
108 *vRoot = *root[*vRoot];
109 vRoot = root[*vRoot];
112 outputTree.
newEdge(edgeNode, *vRoot);
115 externalNodes[v] = edgeNode;
118 externalNodes[u] = edgeNode;
119 if (externalNodes[v]) {
120 node* vRoot = root[externalNodes[v]];
122 while (root[*vRoot] != vRoot) {
123 *vRoot = *root[*vRoot];
124 vRoot = root[*vRoot];
127 outputTree.
newEdge(edgeNode, *vRoot);
128 root[edgeNode] = vRoot;
130 root[edgeNode] =
new node;
132 externalNodes[v] = edgeNode;
135 *root[edgeNode] = edgeNode;
140 for (
node* p : garbage) {
161 if (save0 == save1) {
185 finalSteinerTree =
nullptr;
187 #ifdef OGDF_COMMON_ALG_FIND_BEST_TAKAHASHI_ROOT
189 T bestMstWeight = std::numeric_limits<T>::max();
190 for (
node v : terminals) {
192 T tmpMstWeight = mstt.
call(G, terminals, isTerminal, isOriginalTerminal, tmpSteinerTree, v);
193 if (tmpMstWeight < bestMstWeight) {
194 bestMstWeight = tmpMstWeight;
195 delete finalSteinerTree;
196 finalSteinerTree = tmpSteinerTree;
198 delete tmpSteinerTree;
201 return bestMstWeight;
203 return mstt.
call(G, terminals, isTerminal, isOriginalTerminal, finalSteinerTree);
The namespace for all OGDF objects.
Includes declaration of graph class.
Implementation of the 2(1-1/l)-approximation algorithm for the minimum Steiner tree problem by Matsuy...
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.
virtual T call(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, EdgeWeightedGraphCopy< T > *&finalSteinerTree, const node startNode)
An extended call method with specific start node.
T obtainFinalSteinerTree(const EdgeWeightedGraph< T > &G, const NodeArray< bool > &isTerminal, const NodeArray< bool > &isOriginalTerminal, EdgeWeightedGraphCopy< T > *&finalSteinerTree)
edge newEdge(node u, node v, T weight)
Extends the GraphCopy concept to weighted graphs.
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...
Declaration of ogdf::MinSteinerTreeModule.
int numberOfEdges() const
Returns the number of edges in the graph.
The parameterized class Array implements dynamic arrays of type E.
node source() const
Returns the source node of the edge.
NodeElement * node
The type of nodes.
Doubly linked lists (maintaining the length of the list).
RegisteredArray for nodes, edges and adjEntries of a graph.
Data type for general directed graphs (adjacency list representation).
edge copy(edge e) const override
Returns the first edge in the list of edges corresponding to edge e.
void delEdge(edge e) override
Removes edge e and clears the list of edges corresponding to e's original edge.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
This class implements the minimum Steiner tree 2-approximation algorithm by Takahashi and Matsuyama w...
Basic declarations, included by all source files.
node newNode(int index=-1)
Creates a new node and returns it.
T weight(const edge e) const
Declaration and implementation of Array class and Array algorithms.
Augments any data elements of type X with keys of type Priority. This class is also its own Comparer.
Class for the representation of edges.
Declaration of doubly linked lists and iterators.
void quicksort()
Sorts array using Quicksort.
static void getTerminals(List< node > &terminals, const EdgeWeightedGraph< T > &G, const NodeArray< bool > &isTerminal)
Generates a list (as List<node>) of all terminals.
node target() const
Returns the target node of the edge.
edge newEdge(node v, node w, int index=-1)
Creates a new edge (v,w) and returns it.
Declarations for Comparer objects.
Class for the representation of nodes.
iterator pushBack(const E &x)
Adds element x at the end of the list.