This class implements the loss-contracting (1.55+epsilon)-approximation algorithm for the Steiner tree problem by Robins and Zelikovsky. More...
#include <ogdf/graphalg/MinSteinerTreeRZLoss.h>
Inheritance diagram for ogdf::MinSteinerTreeRZLoss< T >:Public Types | |
| template<typename TYPE > | |
| using | SaveStatic = steiner_tree::SaveStatic< TYPE > |
Public Member Functions | |
| MinSteinerTreeRZLoss () | |
| MinSteinerTreeRZLoss (int v) | |
| virtual | ~MinSteinerTreeRZLoss () |
| virtual T | call (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. More... | |
| void | forceAPSP (bool force=true) |
| For the 3-restricted case, it is sufficient to compute an SSSP from every terminal instead of doing a full APSP. More... | |
| long | numberOfComponentLookUps () |
| Returns the number of components lookups during execution time. More... | |
| long | numberOfContractedComponents () |
| Returns the number of contracted components. More... | |
| long | numberOfGeneratedComponents () |
| Returns the number of generated components. More... | |
| void | setMaxComponentSize (int k) |
| Sets the maximal number of terminals in a full component. More... | |
Public Member Functions inherited from ogdf::MinSteinerTreeModule< T > | |
| MinSteinerTreeModule () | |
| virtual | ~MinSteinerTreeModule () |
Protected Member Functions | |
| 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. More... | |
Private Member Functions | |
| void | contractLoss (EdgeWeightedGraphCopy< T > &steinerTree, int compId) |
| Contracts the loss of a full component and integrates it into the given terminal-spanning tree. More... | |
| double | extractMaxComponent (const EdgeWeightedGraphCopy< T > &steinerTree, int &maxCompId, SaveStatic< T > &save) |
| Traverses over all full components and finds the one with the highest win-objective. More... | |
| void | findFull3Components (SubsetEnumerator< node > &terminalSubset, const EdgeWeightedGraphCopy< T > &tree, const SaveStatic< T > &save) |
| void | findFullComponents (const EdgeWeightedGraphCopy< T > &tree, const SaveStatic< T > &save) |
| Finds all k-restricted full components (except 2-components). More... | |
| template<typename TERMINAL_CONTAINER > | |
| T | gain (const TERMINAL_CONTAINER &terminals, const EdgeWeightedGraphCopy< T > &steinerTree, const SaveStatic< T > &save) |
| Calculates the gain for a full component. More... | |
| void | generateInitialTerminalSpanningTree (EdgeWeightedGraphCopy< T > &steinerTree) |
| Builds a minimum terminal spanning tree (via a MST call on the complete terminal graph) More... | |
| bool | isValidComponent (const EdgeWeightedGraphCopy< T > &graph) |
| void | multiPass (SaveStatic< T > &save, EdgeWeightedGraphCopy< T > &steinerTree, NodeArray< bool > &isNewTerminal) |
| Contraction phase of the algorithm. More... | |
Private Attributes | |
| long | m_componentsContracted |
| Number of contracted components. More... | |
| long | m_componentsGenerated |
| Number of generated components. More... | |
| long | m_componentsLookUps |
| Number of components lookups. More... | |
| NodeArray< NodeArray< T > > | m_distance |
| steiner_tree::FullComponentWithLossStore< T > * | m_fullCompStore |
| All generated full components. More... | |
| const NodeArray< bool > * | m_isTerminal |
| Incidence vector for terminal nodes. More... | |
| List< node > | m_nonterminals |
| List of Steiner (non-terminal) nodes. More... | |
| const EdgeWeightedGraph< T > * | m_originalGraph |
| The original edge-weighted graph. More... | |
| NodeArray< NodeArray< edge > > | m_pred |
| int | m_restricted |
| Parameter for the number of terminals in a full component. More... | |
| bool | m_ssspDistances |
| True iff we only compute SSSP from terminals instead of APSP for full component construction. More... | |
| List< node > | m_terminals |
| List of terminal nodes (will be copied and sorted) More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from ogdf::MinSteinerTreeModule< T > | |
| static void | allPairShortestPaths (const EdgeWeightedGraph< T > &G, const List< node > &nonterminals, NodeArray< NodeArray< T > > &distance, NodeArray< NodeArray< edge > > &pred) |
| Undirected All-pair-shortest-paths (Floyd-Warshall) over non-terminal nodes of G. More... | |
| static void | allPairShortestPathsDetour (const EdgeWeightedGraph< T > &G, const List< node > &nonterminals, NodeArray< NodeArray< T > > &distance, NodeArray< NodeArray< edge > > &pred) |
| static void | allPairShortestPathsStrict (const EdgeWeightedGraph< T > &G, const NodeArray< bool > &isTerminal, NodeArray< NodeArray< T > > &distance, NodeArray< NodeArray< edge > > &pred) |
| static void | drawSteinerTreeSVG (const EdgeWeightedGraphCopy< T > &steinerTree, const NodeArray< bool > &isTerminal, const char *filename) |
| Writes a SVG that shows only the given Steiner tree. More... | |
| static void | drawSVG (const EdgeWeightedGraph< T > &G, const NodeArray< bool > &isTerminal, const EdgeWeightedGraphCopy< T > &steinerTree, const char *filename) |
| Writes an SVG file of a minimum Steiner tree in the original graph. More... | |
| static bool | isQuasiBipartite (const EdgeWeightedGraph< T > &G, const NodeArray< bool > &isTerminal) |
| Checks in O(n + m) time if a given Steiner tree problem instance is quasi-bipartite. More... | |
| static bool | isSteinerTree (const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, const EdgeWeightedGraphCopy< T > &steinerTree) |
| Checks in O(n) time if a given tree is acually a Steiner Tree. More... | |
| static T | pruneAllDanglingSteinerPaths (EdgeWeightedGraphCopy< T > &steinerTree, const NodeArray< bool > &isTerminal) |
| Prune Steiner nodes with degree 1 and their paths to terminal or branching nodes. More... | |
| static T | pruneDanglingSteinerPathFrom (EdgeWeightedGraphCopy< T > &steinerTree, const NodeArray< bool > &isTerminal, node start) |
| Prune the dangling Steiner path beginning at a given node only. More... | |
| static T | pruneDanglingSteinerPathsFrom (EdgeWeightedGraphCopy< T > &steinerTree, const NodeArray< bool > &isTerminal, const List< node > &start) |
| Prune dangling Steiner paths beginning at given nodes only. More... | |
| static T | removeCyclesFrom (EdgeWeightedGraphCopy< T > &steinerTree, const NodeArray< bool > &isTerminal) |
| Remove remaining cycles from an Steiner "almost" tree. More... | |
| static void | singleSourceShortestPaths (const EdgeWeightedGraph< T > &G, node source, const NodeArray< bool > &isTerminal, NodeArray< T > &distance, NodeArray< edge > &pred) |
| Undirected Single-source-shortest-paths (Dijkstra) over non-terminal nodes of G. More... | |
| static void | singleSourceShortestPathsDetour (const EdgeWeightedGraph< T > &G, node source, const NodeArray< bool > &isTerminal, NodeArray< T > &distance, NodeArray< edge > &pred) |
| static void | singleSourceShortestPathsStrict (const EdgeWeightedGraph< T > &G, node source, const NodeArray< bool > &isTerminal, NodeArray< T > &distance, NodeArray< edge > &pred) |
This class implements the loss-contracting (1.55+epsilon)-approximation algorithm for the Steiner tree problem by Robins and Zelikovsky.
This implementation is based on:
(G. Robins, A. Zelikovsky, Improved Steiner Tree Approximation in Graphs, SODA 2000, pages 770-779, SIAM, 2000)
Definition at line 61 of file MinSteinerTreeRZLoss.h.
| using ogdf::MinSteinerTreeRZLoss< T >::SaveStatic = steiner_tree::SaveStatic<TYPE> |
Definition at line 63 of file MinSteinerTreeRZLoss.h.
|
inline |
Definition at line 65 of file MinSteinerTreeRZLoss.h.
|
inline |
Definition at line 71 of file MinSteinerTreeRZLoss.h.
|
inlinevirtual |
Definition at line 77 of file MinSteinerTreeRZLoss.h.
|
inlineoverridevirtual |
Builds a minimum Steiner tree given a weighted graph and a list of terminals.
| G | The weighted input graph |
| terminals | The list of terminal nodes |
| isTerminal | A bool array of terminals |
| finalSteinerTree | The final Steiner tree |
Reimplemented from ogdf::MinSteinerTreeModule< T >.
Definition at line 79 of file MinSteinerTreeRZLoss.h.
|
overrideprotectedvirtual |
Builds a minimum Steiner tree given a weighted graph and a list of terminals.
| G | The weighted input graph |
| terminals | The list of terminal nodes |
| isTerminal | A bool array of terminals |
| finalSteinerTree | The final Steiner tree |
Implements ogdf::MinSteinerTreeModule< T >.
Definition at line 220 of file MinSteinerTreeRZLoss.h.
|
private |
Contracts the loss of a full component and integrates it into the given terminal-spanning tree.
| steinerTree | The Steiner tree into which the full component is integrated |
| compId | The full component to be contracted and inserted |
Definition at line 465 of file MinSteinerTreeRZLoss.h.
|
private |
Traverses over all full components and finds the one with the highest win-objective.
| steinerTree | Current Steiner tree |
| maxCompId | The index of the full component with highest win-objective |
| save | Data structure for calculating save values |
Definition at line 412 of file MinSteinerTreeRZLoss.h.
|
private |
Definition at line 302 of file MinSteinerTreeRZLoss.h.
|
private |
Finds all k-restricted full components (except 2-components).
| tree | Current minimal terminal spanning tree |
| save | Data structure for calculating save edges |
Definition at line 355 of file MinSteinerTreeRZLoss.h.
|
inline |
For the 3-restricted case, it is sufficient to compute an SSSP from every terminal instead of doing a full APSP.
In case a full APSP is faster, use this method.
| force | True to force APSP instead of SSSP. |
Definition at line 101 of file MinSteinerTreeRZLoss.h.
|
private |
Calculates the gain for a full component.
| terminals | The terminals of the full component |
| steinerTree | Current Steiner tree |
| save | Data structure for calculating save values |
Definition at line 443 of file MinSteinerTreeRZLoss.h.
|
private |
Builds a minimum terminal spanning tree (via a MST call on the complete terminal graph)
| steinerTree | The resulting minimum terminal spanning tree |
Definition at line 279 of file MinSteinerTreeRZLoss.h.
|
inlineprivate |
Definition at line 137 of file MinSteinerTreeRZLoss.h.
|
private |
Contraction phase of the algorithm.
| save | save data structure |
| steinerTree | the terminal-spanning tree to be modified |
| isNewTerminal | true for nodes to be interpreted as terminals |
Definition at line 386 of file MinSteinerTreeRZLoss.h.
|
inline |
Returns the number of components lookups during execution time.
Definition at line 117 of file MinSteinerTreeRZLoss.h.
|
inline |
Returns the number of contracted components.
Definition at line 112 of file MinSteinerTreeRZLoss.h.
|
inline |
Returns the number of generated components.
Definition at line 107 of file MinSteinerTreeRZLoss.h.
|
inline |
Sets the maximal number of terminals in a full component.
| k | the maximal number of terminals in a full component |
Definition at line 91 of file MinSteinerTreeRZLoss.h.
|
private |
Number of contracted components.
Definition at line 215 of file MinSteinerTreeRZLoss.h.
|
private |
Number of generated components.
Definition at line 214 of file MinSteinerTreeRZLoss.h.
|
private |
Number of components lookups.
Definition at line 216 of file MinSteinerTreeRZLoss.h.
|
private |
Definition at line 211 of file MinSteinerTreeRZLoss.h.
|
private |
All generated full components.
Definition at line 209 of file MinSteinerTreeRZLoss.h.
|
private |
Incidence vector for terminal nodes.
Definition at line 205 of file MinSteinerTreeRZLoss.h.
|
private |
List of Steiner (non-terminal) nodes.
Definition at line 207 of file MinSteinerTreeRZLoss.h.
|
private |
The original edge-weighted graph.
Definition at line 204 of file MinSteinerTreeRZLoss.h.
|
private |
Definition at line 212 of file MinSteinerTreeRZLoss.h.
|
private |
Parameter for the number of terminals in a full component.
Definition at line 208 of file MinSteinerTreeRZLoss.h.
|
private |
True iff we only compute SSSP from terminals instead of APSP for full component construction.
Definition at line 210 of file MinSteinerTreeRZLoss.h.
|
private |
List of terminal nodes (will be copied and sorted)
Definition at line 206 of file MinSteinerTreeRZLoss.h.