72 const node startNode) {
135 for (
node u : G.nodes) {
161 queue.push(v, distance[v]);
171 if (isTerminal[v] && distance[v] > 0) {
175 while (distance[v] > 0) {
177 queue.push(v, distance[v]);
179 const edge e = predecessor[v];
199 const node w = adj->twinNode();
200 const edge e = adj->theEdge();
201 if (distance[w] > distance[v] +
wG.weight(e) &&
bestDistance[w] >= distance[w]) {
202 distance[w] = distance[v] +
wG.weight(e);
204 queue.push(w, distance[w]);
207 queue.decrease(w, distance[w]);
Extends the GraphCopy concept to weighted graphs.
Declaration of doubly linked lists and iterators.
Declaration of ogdf::MinSteinerTreeModule.
Class for adjacency list elements.
Class for the representation of edges.
node opposite(node v) const
Returns the adjacent node different from v.
node target() const
Returns the target node of the edge.
Doubly linked lists (maintaining the length of the list).
int size() const
Returns the number of elements in the list.
const_reference front() const
Returns a const reference to the first element.
Serves as an interface for various methods to compute or approximate minimum Steiner trees on undirec...
static T pruneAllDanglingSteinerPaths(EdgeWeightedGraphCopy< T > &steinerTree, const NodeArray< bool > &isTerminal)
Prunes nonterminal leaves and their paths to terminal or branching nodes.
This class implements the minimum Steiner tree 2-approximation algorithm by Takahashi and Matsuyama w...
MinSteinerTreeTakahashi()
virtual T call(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, const NodeArray< bool > &isOriginalTerminal, EdgeWeightedGraphCopy< T > *&finalSteinerTree)
An extended call method with intermediate and final (original) terminals.
virtual ~MinSteinerTreeTakahashi()
T terminalDijkstra(const EdgeWeightedGraph< T > &wG, EdgeWeightedGraphCopy< T > &intermediateTerminalSpanningTree, const node s, int numberOfTerminals, const NodeArray< bool > &isTerminal)
Modified Dijkstra algorithm to solve the Minimum Steiner Tree problem.
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.
virtual T computeSteinerTree(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, EdgeWeightedGraphCopy< T > *&finalSteinerTree) override
Computes the actual Steiner tree.
Dynamic arrays indexed with nodes.
Class for the representation of nodes.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
Prioritized queue interface wrapper for heaps.
Declaration of extended graph algorithms.
bool isConnected(const Graph &G)
Returns true iff G is connected.
T makeMinimumSpanningTree(Graph &G, const EdgeArray< T > &weight)
Reduce a graph to its minimum spanning tree (MST) using Kruskal's algorithm.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.