 |
Open Graph Drawing Framework |
v. 2022.02 (Dogwood)
|
|
|
Go to the documentation of this file.
112 for (
node v : terminals) {
113 completeTerminalGraph.
newNode(v);
119 calculateCompleteGraph(G, terminals, ssspPred, completeTerminalGraph);
127 reinsertShortestPaths(completeTerminalGraph, ssspPred, mstPred, *finalSteinerTree, G);
145 predecessor[e].clear();
146 for (
node t = completeTerminalGraph.
original(v);
pi[t]; t =
pi[t]->opposite(t)) {
147 predecessor[e].pushBack(
pi[t]);
160 for(
node u : completeTerminalGraph.
nodes) {
162 insertPath(ssspPred[mstPred[u]], finalSteinerTree, wG);
170 for (
edge e : ssspPred)
172 if (e !=
nullptr && finalSteinerTree.
chain(e).
size() == 0)
174 node edgeSource = e->source();
175 node edgeTarget = e->target();
177 node stSource = finalSteinerTree.
copy(edgeSource);
178 if (stSource ==
nullptr) {
179 stSource = finalSteinerTree.
newNode(edgeSource);
182 node stTarget = finalSteinerTree.
copy(edgeTarget);
183 if (stTarget ==
nullptr) {
184 stTarget = finalSteinerTree.
newNode(edgeTarget);
187 if (e->source() == finalSteinerTree.
original(stSource)) {
189 finalSteinerTree.
setEdge(e, newE);
The namespace for all OGDF objects.
const Graph & original() const
Returns a reference to the original graph.
T weight(const edge e) const
virtual ~MinSteinerTreeKou()
void reinsertShortestPaths(const EdgeWeightedGraphCopy< T > &completeTerminalGraph, const EdgeArray< List< edge >> &ssspPred, const NodeArray< edge > &mstPred, EdgeWeightedGraphCopy< T > &finalSteinerTree, const EdgeWeightedGraph< T > &wG)
Swaps an edge in the complete terminal graph with the corresponding shortest path in the original gra...
T computeMinST(const Graph &G, const EdgeArray< T > &weight, EdgeArray< bool > &isInTree)
Computes a minimum spanning tree using Prim's algorithm.
edge newEdge(node u, node v, T weight)
Dynamic arrays indexed with edges.
node copy(node v) const
Returns the node in the graph copy corresponding to v.
Extends the GraphCopy concept to weighted graphs.
Serves as an interface for various methods to compute or approximate minimum Steiner trees on undirec...
Declaration of ogdf::MinSteinerTreeModule.
Dijkstra's single source shortest path algorithm.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
static T pruneAllDanglingSteinerPaths(EdgeWeightedGraphCopy< T > &steinerTree, const NodeArray< bool > &isTerminal)
Prunes nonterminal leaves and their paths to terminal or branching nodes.
const List< edge > & chain(edge e) const
Returns the list of edges coresponding to edge e.
const EdgeArray< T > & edgeWeights() const
void call(const Graph &G, const EdgeArray< T > &weight, const List< node > &sources, NodeArray< edge > &predecessor, NodeArray< T > &distance, bool directed=false, bool arcsReversed=false, node target=nullptr, T maxLength=std::numeric_limits< T >::max())
Calculates, based on the graph G with corresponding edge costs and source nodes, the shortest paths a...
node firstNode() const
Returns the first node in the list of all nodes.
Implementation of Dijkstra's single source shortest path algorithm.
Doubly linked lists (maintaining the length of the list).
constexpr double pi
The constant .
void setEdge(edge eOrig, edge eCopy)
sets eOrig to be the corresponding original edge of eCopy and vice versa
virtual T computeSteinerTree(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, EdgeWeightedGraphCopy< T > *&finalSteinerTree) override
Builds a minimum Steiner tree given a weighted graph and a list of terminals.
const EdgeArray< T > & edgeWeights() const
T makeMinimumSpanningTree(Graph &G, const EdgeArray< T > &weight)
Reduce a graph to its minimum spanning tree (MST) using Kruskal's algorithm.
node succ() const
Returns the successor in the list of all nodes.
void createEmpty(const Graph &wG)
void insertPath(const List< edge > &ssspPred, EdgeWeightedGraphCopy< T > &finalSteinerTree, const EdgeWeightedGraph< T > &wG)
Inserts a shortest path corresponding to an edge in the complete terminal graph.
Class for the representation of edges.
Declaration of doubly linked lists and iterators.
int size() const
Returns the number of elements in the list.
This class implements the Minimum Steiner Tree 2-approximation algorithm by Kou et al.
Class for the representation of nodes.
node newNode(node vOrig)
Creates a new node in the graph copy with original node vOrig.
void calculateCompleteGraph(const EdgeWeightedGraph< T > &wG, const List< node > &terminals, EdgeArray< List< edge >> &predecessor, EdgeWeightedGraphCopy< T > &completeTerminalGraph)
Builds a complete terminal graph.