Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

ogdf::MinSteinerTreeMehlhorn< T > Class Template Reference

This class implements the Minimum Steiner Tree 2-approximation algorithm by Mehlhorn. More...

#include <ogdf/graphalg/MinSteinerTreeMehlhorn.h>

+ Inheritance diagram for ogdf::MinSteinerTreeMehlhorn< T >:

Classes

struct  MehlhornTriple
 Represents a triple as specified in the algorithms description (see paper) More...
 
class  MehlhornTripleBucketMaxFunc
 Helper class to sort MehlhornTriples lexicographically. More...
 
class  MehlhornTripleBucketMinFunc
 Helper class to sort MehlhornTriples lexicographically. More...
 

Public Member Functions

 MinSteinerTreeMehlhorn ()
 
virtual ~MinSteinerTreeMehlhorn ()
 
- Public Member Functions inherited from ogdf::MinSteinerTreeModule< T >
 MinSteinerTreeModule ()
 
virtual ~MinSteinerTreeModule ()
 
virtual T call (const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, EdgeWeightedGraphCopy< T > *&finalSteinerTree)
 Builds a minimum Steiner tree given a weighted graph and a list of terminals. More...
 

Static Public Member Functions

static void calculateCompleteGraph (const EdgeWeightedGraph< T > &wG, const List< node > &terminals, const Voronoi< T > &voronoi, EdgeArray< edge > &bridges, EdgeWeightedGraphCopy< T > &completeTerminalGraph)
 Builds a complete terminal graph. More...
 
- 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)
 

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...
 
void insertPath (node u, const Voronoi< T > &voronoi, EdgeWeightedGraphCopy< T > &finalSteinerTree, const EdgeWeightedGraph< T > &wG)
 Inserts a shortest path corresponding to an edge in the complete terminal graph. More...
 
void reinsertShortestPaths (EdgeWeightedGraphCopy< T > &completeTerminalGraph, const Voronoi< T > &voronoi, const NodeArray< edge > &mstPred, const EdgeArray< edge > &bridges, EdgeWeightedGraphCopy< T > &finalSteinerTree, const EdgeWeightedGraph< T > &wG)
 Swaps an edge in the complete terminal graph with the corresponding shortest path in the original graph. More...
 

Detailed Description

template<typename T>
class ogdf::MinSteinerTreeMehlhorn< T >

This class implements the Minimum Steiner Tree 2-approximation algorithm by Mehlhorn.

This implementation is based on:

(K. Mehlhorn, A faster approximation algorithm for the Steiner problem in graphs, Information Processing Letters, volume 27, number 3, pages 125-128, 1998)

Definition at line 56 of file MinSteinerTreeMehlhorn.h.

Constructor & Destructor Documentation

◆ MinSteinerTreeMehlhorn()

template<typename T >
ogdf::MinSteinerTreeMehlhorn< T >::MinSteinerTreeMehlhorn ( )
inline

Definition at line 58 of file MinSteinerTreeMehlhorn.h.

◆ ~MinSteinerTreeMehlhorn()

template<typename T >
virtual ogdf::MinSteinerTreeMehlhorn< T >::~MinSteinerTreeMehlhorn ( )
inlinevirtual

Definition at line 60 of file MinSteinerTreeMehlhorn.h.

Member Function Documentation

◆ calculateCompleteGraph()

template<typename T >
void ogdf::MinSteinerTreeMehlhorn< T >::calculateCompleteGraph ( const EdgeWeightedGraph< T > &  wG,
const List< node > &  terminals,
const Voronoi< T > &  voronoi,
EdgeArray< edge > &  bridges,
EdgeWeightedGraphCopy< T > &  completeTerminalGraph 
)
static

Builds a complete terminal graph.

Parameters
wGthe original graph
terminalslist of terminals
voronoiVoronoi regions (providing a mapping from each edge in the complete terminal graph to the shortest path in the original graph)
bridgeslist of edges connecting terminal nodes by voronoi regions
completeTerminalGraphthe resulting complete terminal graph

Definition at line 185 of file MinSteinerTreeMehlhorn.h.

◆ computeSteinerTree()

template<typename T >
T ogdf::MinSteinerTreeMehlhorn< T >::computeSteinerTree ( const EdgeWeightedGraph< T > &  G,
const List< node > &  terminals,
const NodeArray< bool > &  isTerminal,
EdgeWeightedGraphCopy< T > *&  finalSteinerTree 
)
overrideprotectedvirtual

Builds a minimum Steiner tree given a weighted graph and a list of terminals.

Parameters
GThe weighted input graph
terminalsThe list of terminal nodes
isTerminalA bool array of terminals
finalSteinerTreeThe final Steiner tree
Returns
The objective value (sum of edge costs) of the final Steiner tree

Implements ogdf::MinSteinerTreeModule< T >.

Definition at line 159 of file MinSteinerTreeMehlhorn.h.

◆ insertPath()

template<typename T >
void ogdf::MinSteinerTreeMehlhorn< T >::insertPath ( node  u,
const Voronoi< T > &  voronoi,
EdgeWeightedGraphCopy< T > &  finalSteinerTree,
const EdgeWeightedGraph< T > &  wG 
)
protected

Inserts a shortest path corresponding to an edge in the complete terminal graph.

Parameters
uterminal node needed to access the according predecessor edge in the minimum terminal spanning tree
voronoiVoronoi regions (contains shortest paths)
finalSteinerTreethe resulting Steiner tree
wGthe original graph

Definition at line 273 of file MinSteinerTreeMehlhorn.h.

◆ reinsertShortestPaths()

template<typename T >
void ogdf::MinSteinerTreeMehlhorn< T >::reinsertShortestPaths ( EdgeWeightedGraphCopy< T > &  completeTerminalGraph,
const Voronoi< T > &  voronoi,
const NodeArray< edge > &  mstPred,
const EdgeArray< edge > &  bridges,
EdgeWeightedGraphCopy< T > &  finalSteinerTree,
const EdgeWeightedGraph< T > &  wG 
)
protected

Swaps an edge in the complete terminal graph with the corresponding shortest path in the original graph.

Parameters
completeTerminalGraphthe complete terminal graph
voronoiVoronoi regions (providing a mapping from each edge in the complete terminal graph to the shortest path in the original graph)
mstPredpredecessor data structure of a minimum terminal spanning tree
bridgeslist of edges connecting terminal nodes by voronoi regions
finalSteinerTreethe resulting Steiner tree
wGthe original graph

Definition at line 252 of file MinSteinerTreeMehlhorn.h.


The documentation for this class was generated from the following file: