Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

MinSteinerTreeRZLoss.h
Go to the documentation of this file.
1 
33 #pragma once
34 
42 
43 #include <memory>
44 #include <set>
45 
46 #define OGDF_STEINERTREE_RZLOSS_REDUCE_ON
47 
48 namespace ogdf {
49 
61 template<typename T>
64 
65  class Main;
66  std::unique_ptr<Main> m_alg;
67 
68 public:
70 
72 
73  virtual ~MinSteinerTreeRZLoss() { }
74 
79  void setMaxComponentSize(int k) { m_restricted = k; }
80 
83  if (m_alg == nullptr) {
84  return 0;
85  }
86  return m_alg->numberOfGeneratedComponents();
87  }
88 
91  if (m_alg == nullptr) {
92  return 0;
93  }
94  return m_alg->numberOfContractedComponents();
95  }
96 
99  if (m_alg == nullptr) {
100  return 0;
101  }
102  return m_alg->numberOfComponentLookUps();
103  }
104 
105 protected:
114  virtual T computeSteinerTree(const EdgeWeightedGraph<T>& G, const List<node>& terminals,
115  const NodeArray<bool>& isTerminal, EdgeWeightedGraphCopy<T>*& finalSteinerTree) override {
116  m_alg.reset(new Main(G, terminals, isTerminal, m_restricted));
117  return m_alg->getApproximation(finalSteinerTree);
118  }
119 };
120 
121 template<typename T>
123  template<typename TYPE>
125 
128 
135  void findFullComponentsDW(const EdgeWeightedGraphCopy<T>& tree,
136  const NodeArray<NodeArray<T>>& distance, const NodeArray<NodeArray<edge>>& pred);
138  void findFullComponentsEMV(const EdgeWeightedGraphCopy<T>& tree);
140  void findFull3Components(const EdgeWeightedGraphCopy<T>& tree,
141  const NodeArray<NodeArray<T>>& distance, const NodeArray<NodeArray<edge>>& pred);
143  template<typename FCG>
144  void retrieveComponents(const FCG& fcg, const EdgeWeightedGraphCopy<T>& tree);
145 
147 
154  void generateInitialTerminalSpanningTree(EdgeWeightedGraphCopy<T>& steinerTree,
155  const NodeArray<NodeArray<T>>& distance, const NodeArray<NodeArray<edge>>& pred);
156 
159  tree.setOriginalGraph(m_G);
160 
161  if (m_restricted >= 4
163  m_G.numberOfEdges())) {
165  m_save.reset(new steiner_tree::SaveStatic<T>(tree));
166  findFullComponentsEMV(tree);
167  } else {
168  NodeArray<NodeArray<T>> distance;
170 
172  m_G, m_terminals, m_isTerminal, m_restricted);
173 
174  generateInitialTerminalSpanningTree(tree, distance, pred);
175  m_save.reset(new steiner_tree::SaveStatic<T>(tree));
176 
177  if (m_restricted >= 4) { // use Dreyfus-Wagner based full component generation
178  findFullComponentsDW(tree, distance, pred);
179  } else {
180  findFull3Components(tree, distance, pred);
181  }
182  }
183 
184  m_fullCompStore.computeAllLosses();
185  m_componentsGenerated = m_fullCompStore.size();
186  }
187 
192  void multiPass(EdgeWeightedGraphCopy<T>& steinerTree);
193 
200  double extractMaxComponent(const EdgeWeightedGraphCopy<T>& steinerTree, int& maxCompId);
201 
208  template<typename TERMINAL_CONTAINER>
209  T gain(const TERMINAL_CONTAINER& terminals, const EdgeWeightedGraphCopy<T>& steinerTree);
210 
216  void contractLoss(EdgeWeightedGraphCopy<T>& steinerTree, int compId);
217 
222  std::unique_ptr<steiner_tree::SaveStatic<T>> m_save;
225 
229 
230 public:
231  Main(const EdgeWeightedGraph<T>& G, const List<node>& terminals,
232  const NodeArray<bool>& isTerminal, int restricted);
233 
234  T getApproximation(EdgeWeightedGraphCopy<T>*& finalSteinerTree) const {
235  // obtain final Steiner Tree using (MST-based) Steiner tree approximation algorithm
236  return steiner_tree::obtainFinalSteinerTree(m_G, m_isNewTerminal, m_isTerminal,
237  finalSteinerTree);
238  }
239 
241  long numberOfGeneratedComponents() { return m_componentsGenerated; }
242 
244  long numberOfContractedComponents() { return m_componentsContracted; }
245 
247  long numberOfComponentLookUps() { return m_componentsLookUps; }
248 };
249 
250 template<typename T>
252  const NodeArray<bool>& isTerminal, int restricted)
253  : m_G(G)
254  , m_isTerminal(isTerminal)
255  , m_terminals(terminals)
256  , // copy
257  m_restricted(min(restricted, terminals.size()))
258  , m_fullCompStore(m_G, m_terminals, m_isTerminal)
259  , m_isNewTerminal(m_G, false)
260  , m_componentsGenerated(0)
261  , m_componentsContracted(0)
262  , m_componentsLookUps(0) {
264 
265  for (node v : terminals) {
266  m_isNewTerminal[v] = true;
267  }
268 
269  // init terminal-spanning tree and its save-edge data structure
270  EdgeWeightedGraphCopy<T> steinerTree; // the terminal-spanning tree to be modified
271 
272  setup(steinerTree);
273 
274  // contraction phase
275  multiPass(steinerTree);
276 
277  m_save.reset();
278 }
279 
280 template<typename T>
282  EdgeWeightedGraphCopy<T>& steinerTree, const NodeArray<NodeArray<T>>& distance,
283  const NodeArray<NodeArray<edge>>& pred) {
284  // generate complete graph
285  for (node v : m_terminals) {
286  steinerTree.newNode(v);
287  }
288  for (node u : steinerTree.nodes) {
289  const node uO = steinerTree.original(u);
290  const NodeArray<T>& dist = distance[uO];
291  const NodeArray<edge>& p = pred[uO];
292  for (node v = u->succ(); v; v = v->succ()) {
293  const node vO = steinerTree.original(v);
294  if (p[vO] != nullptr) {
295  steinerTree.newEdge(u, v, dist[vO]);
296  }
297  }
298  }
299  // compute MST
300  makeMinimumSpanningTree(steinerTree, steinerTree.edgeWeights());
301  OGDF_ASSERT(steinerTree.numberOfNodes() == steinerTree.numberOfEdges() + 1);
302 }
303 
304 template<typename T>
306  const NodeArray<NodeArray<T>>& distance, const NodeArray<NodeArray<edge>>& pred) {
308  fcg.call(m_G, m_terminals, m_isTerminal, distance, pred,
309  [&](node t0, node t1, node t2, node minCenter, T minCost) {
310  // create a full 3-component
311  EdgeWeightedGraphCopy<T> minComp;
312  minComp.setOriginalGraph(m_G);
313  node minCenterC = minComp.newNode(minCenter);
314  minComp.newEdge(minComp.newNode(t0), minCenterC, distance[t0][minCenter]);
315  minComp.newEdge(minComp.newNode(t1), minCenterC, distance[t1][minCenter]);
316  minComp.newEdge(minComp.newNode(t2), minCenterC, distance[t2][minCenter]);
317  OGDF_ASSERT(isTree(minComp));
318 #ifdef OGDF_STEINERTREE_RZLOSS_REDUCE_ON
319  if (gain(std::vector<node> {t0, t1, t2}, tree) > minCost) { // reduction
320  m_fullCompStore.insert(minComp);
321  }
322 #else
323  m_fullCompStore.insert(minComp);
324 #endif
325  });
326 }
327 
328 template<typename T>
329 template<typename FCG>
331  const EdgeWeightedGraphCopy<T>& tree) {
332  SubsetEnumerator<node> terminalSubset(m_terminals);
333  for (terminalSubset.begin(3, m_restricted); terminalSubset.valid(); terminalSubset.next()) {
334  EdgeWeightedGraphCopy<T> component;
335  List<node> terminals;
336  terminalSubset.list(terminals);
337 #ifdef OGDF_STEINERTREE_RZLOSS_REDUCE_ON
338  T cost =
339 #endif
340  fcg.getSteinerTreeFor(terminals, component);
341  if (
343  gain(terminals, tree) > cost &&
344 #endif
345  fcg.isValidComponent(component)) {
346  m_fullCompStore.insert(component);
347  }
348  }
349 }
350 
351 template<typename T>
353  const NodeArray<NodeArray<T>>& distance, const NodeArray<NodeArray<edge>>& pred) {
354  steiner_tree::FullComponentGeneratorDreyfusWagner<T> fcg(m_G, m_terminals, m_isTerminal,
355  distance, pred);
356  fcg.call(m_restricted);
357  retrieveComponents(fcg, tree);
358 }
359 
360 template<typename T>
363  m_isTerminal);
364  fcg.call(m_restricted);
365  retrieveComponents(fcg, tree);
366 }
367 
368 template<typename T>
370  while (!m_fullCompStore.isEmpty()) {
371  int maxCompId;
372  double r = extractMaxComponent(steinerTree, maxCompId);
373  if (r > 1e-9) {
374  ++m_componentsContracted;
375 
376  // convert nodes of component to terminals
377  m_fullCompStore.foreachNode(maxCompId, [&](node v) { m_isNewTerminal[v] = true; });
378 
379  contractLoss(steinerTree, maxCompId);
380  m_fullCompStore.remove(maxCompId);
381 
382  if (!m_fullCompStore.isEmpty()) {
383  m_save->rebuild();
384  }
385  } else {
386  return;
387  }
388  }
389 }
390 
391 template<typename T>
393  const EdgeWeightedGraphCopy<T>& steinerTree, int& maxCompId) {
394  maxCompId = -1;
395  double max(0);
396  for (int i = 0; i < m_fullCompStore.size();) {
397  ++m_componentsLookUps;
398  const double winAbs =
399  gain(m_fullCompStore.terminals(i), steinerTree) - m_fullCompStore.cost(i);
400  if (winAbs > 1e-9) {
401  const double r = winAbs / m_fullCompStore.loss(i);
402  if (r > max) {
403  max = r;
404  maxCompId = i;
405  }
406  ++i;
407  }
408 #ifdef OGDF_STEINERTREE_RZLOSS_REDUCE_ON
409  else {
410  // reduction
411  m_fullCompStore.remove(i);
412  }
413 #endif
414  }
415  return max;
416 }
417 
418 template<typename T>
419 template<typename TERMINAL_CONTAINER>
420 T MinSteinerTreeRZLoss<T>::Main::gain(const TERMINAL_CONTAINER& terminals,
421  const EdgeWeightedGraphCopy<T>& steinerTree) {
422  std::set<edge> saveEdges;
423  T result(0);
424 
425  // extract edges and compute their sum (result value)
426  for (auto it1 = terminals.begin(); it1 != terminals.end(); ++it1) {
427  auto next = it1;
428  ++next;
429  for (auto it2 = next; it2 != terminals.end(); ++it2) {
430  const edge e = m_save->saveEdge(*it1, *it2);
431  saveEdges.insert(e);
432  }
433  }
434 
435  for (edge e : saveEdges) {
436  result += steinerTree.weight(e);
437  }
438  return result;
439 }
440 
441 template<typename T>
443  // for every non-loss edge {st} in the component,
444  // where s belongs to the loss component of terminal u
445  // and t belongs to the loss component of terminal v,
446  // we insert edges from u to v in the terminal-spanning tree
447  for (edge e : m_fullCompStore.lossBridges(compId)) {
448  const node u = m_fullCompStore.lossTerminal(e->source());
449  OGDF_ASSERT(u);
450  const node v = m_fullCompStore.lossTerminal(e->target());
451  OGDF_ASSERT(v);
452  steinerTree.newEdge(steinerTree.copy(u), steinerTree.copy(v),
453  m_fullCompStore.graph().weight(e));
454  // parallel edges are ok, will be removed by MST
455  }
456  if (steinerTree.numberOfNodes() != steinerTree.numberOfEdges() + 1) {
457  makeMinimumSpanningTree(steinerTree, steinerTree.edgeWeights());
458  }
459 }
460 
461 }
ogdf::MinSteinerTreeRZLoss::Main::retrieveComponents
void retrieveComponents(const FCG &fcg, const EdgeWeightedGraphCopy< T > &tree)
Auxiliary function to retrieve components by Dreyfus-Wagner/Erickson et al implementation.
Definition: MinSteinerTreeRZLoss.h:330
ogdf::steiner_tree::FullComponentGeneratorDreyfusWagner::call
void call(int restricted)
Definition: FullComponentGeneratorDreyfusWagner.h:367
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::MinSteinerTreeRZLoss::Main::m_isTerminal
const NodeArray< bool > & m_isTerminal
Incidence vector for terminal nodes.
Definition: MinSteinerTreeRZLoss.h:219
ogdf::MinSteinerTreeRZLoss::setMaxComponentSize
void setMaxComponentSize(int k)
Sets the maximal number of terminals in a full component.
Definition: MinSteinerTreeRZLoss.h:79
ogdf::MinSteinerTreeRZLoss::Main::generateInitialTerminalSpanningTree
void generateInitialTerminalSpanningTree(EdgeWeightedGraphCopy< T > &steinerTree, const NodeArray< NodeArray< T >> &distance, const NodeArray< NodeArray< edge >> &pred)
Builds a minimum terminal spanning tree (via a MST call on the complete terminal graph)
Definition: MinSteinerTreeRZLoss.h:281
ogdf::SubsetEnumerator
Enumerator for k-subsets of a given type.
Definition: SubsetEnumerator.h:88
FullComponentStore.h
Definition of the FullComponentStore class template.
ogdf::MinSteinerTreeRZLoss::Main::numberOfGeneratedComponents
long numberOfGeneratedComponents()
Returns the number of generated components.
Definition: MinSteinerTreeRZLoss.h:241
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:54
ogdf::MinSteinerTreeRZLoss::Main::numberOfComponentLookUps
long numberOfComponentLookUps()
Returns the number of components lookups during execution time.
Definition: MinSteinerTreeRZLoss.h:247
SaveStatic.h
Implementation of the staticLCATree option for calculating save edges in Zelikovsky's 11/6-approximat...
ogdf::EdgeWeightedGraphCopy::setOriginalGraph
void setOriginalGraph(const Graph *wG) override
Associates the graph copy with G, but does not create any nodes or edges.
Definition: EdgeWeightedGraphCopy.h:158
ogdf::steiner_tree::FullComponentGeneratorDreyfusWagnerWithoutMatrix
A generator for restricted full components (for Steiner tree approximations) based on the Dreyfus-Wag...
Definition: FullComponentGeneratorDreyfusWagnerWithoutMatrix.h:55
ogdf::SubsetEnumerator::begin
void begin(int low, int high)
Initializes the SubsetEnumerator to enumerate subsets of cardinalities from low to high.
Definition: SubsetEnumerator.h:120
ogdf::steiner_tree::obtainFinalSteinerTree
T obtainFinalSteinerTree(const EdgeWeightedGraph< T > &G, const NodeArray< bool > &isTerminal, const NodeArray< bool > &isOriginalTerminal, EdgeWeightedGraphCopy< T > *&finalSteinerTree)
Definition: common_algorithms.h:164
ogdf::SubsetEnumerator::valid
bool valid() const
Checks if the current subset is valid. If not, the subset is either not initialized or all subsets ha...
Definition: SubsetEnumerator.h:145
ogdf::MinSteinerTreeRZLoss::Main::getApproximation
T getApproximation(EdgeWeightedGraphCopy< T > *&finalSteinerTree) const
Definition: MinSteinerTreeRZLoss.h:234
ogdf::MinSteinerTreeRZLoss::MinSteinerTreeRZLoss
MinSteinerTreeRZLoss()
Definition: MinSteinerTreeRZLoss.h:69
ogdf::MinSteinerTreeRZLoss::Main::findFullComponentsEMV
void findFullComponentsEMV(const EdgeWeightedGraphCopy< T > &tree)
Find full components using algorithm by Erickson et al.
Definition: MinSteinerTreeRZLoss.h:361
ogdf::EdgeWeightedGraphCopy::newEdge
edge newEdge(node u, node v, T weight)
Definition: EdgeWeightedGraphCopy.h:165
ogdf::steiner_tree::FullComponentGeneratorDreyfusWagner
A generator for restricted full components (for Steiner tree approximations) based on the Dreyfus-Wag...
Definition: FullComponentGeneratorDreyfusWagner.h:51
ogdf::MinSteinerTreeRZLoss::Main::extractMaxComponent
double extractMaxComponent(const EdgeWeightedGraphCopy< T > &steinerTree, int &maxCompId)
Traverses over all full components and finds the one with the highest win-objective.
Definition: MinSteinerTreeRZLoss.h:392
ogdf::steiner_tree::constructTerminalSpanningTreeUsingVoronoiRegions
T constructTerminalSpanningTreeUsingVoronoiRegions(EdgeWeightedGraphCopy< T > &terminalSpanningTree, const EdgeWeightedGraph< T > &graph, const List< node > &terminals)
Definition: MinSteinerTreeMehlhorn.h:295
ogdf::MinSteinerTreeRZLoss::Main::m_componentsLookUps
long m_componentsLookUps
Number of components lookups.
Definition: MinSteinerTreeRZLoss.h:228
ogdf::MinSteinerTreeRZLoss::~MinSteinerTreeRZLoss
virtual ~MinSteinerTreeRZLoss()
Definition: MinSteinerTreeRZLoss.h:73
ogdf::MinSteinerTreeRZLoss::computeSteinerTree
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.
Definition: MinSteinerTreeRZLoss.h:114
ogdf::MinSteinerTreeRZLoss::Main::findFullComponentsDW
void findFullComponentsDW(const EdgeWeightedGraphCopy< T > &tree, const NodeArray< NodeArray< T >> &distance, const NodeArray< NodeArray< edge >> &pred)
Find full components using algorithm by Dreyfus-Wagner.
Definition: MinSteinerTreeRZLoss.h:352
ogdf::MinSteinerTreeRZLoss::Main::setup
void setup(EdgeWeightedGraphCopy< T > &tree)
Setup (build initial terminal-spanning tree, its save data structure, and find all components)
Definition: MinSteinerTreeRZLoss.h:158
ogdf::MinSteinerTreeModule
Serves as an interface for various methods to compute or approximate minimum Steiner trees on undirec...
Definition: MinSteinerTreeModule.h:59
ogdf::MinSteinerTreeRZLoss::Main::Main
Main(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, int restricted)
Definition: MinSteinerTreeRZLoss.h:251
ogdf::MinSteinerTreeRZLoss
This class implements the loss-contracting (1.55+epsilon)-approximation algorithm for the Steiner tre...
Definition: MinSteinerTreeRZLoss.h:62
ogdf::steiner_tree::Full3ComponentGeneratorVoronoi
Full 3-component generation using Voronoi regions.
Definition: Full3ComponentGeneratorVoronoi.h:42
ogdf::SubsetEnumerator::list
void list(List< T > &subset) const
Obtains (appends) a list of the subset members.
Definition: SubsetEnumerator.h:202
FullComponentGeneratorDreyfusWagner.h
Definition of the ogdf::steiner_tree::FullComponentGeneratorDreyfusWagner class template.
r
int r[]
Definition: hierarchical-ranking.cpp:8
ogdf::Graph::nodes
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
Definition: Graph_d.h:924
ogdf::Graph::numberOfEdges
int numberOfEdges() const
Returns the number of edges in the graph.
Definition: Graph_d.h:977
ogdf::Graph::numberOfNodes
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition: Graph_d.h:974
ogdf::MinSteinerTreeRZLoss::Main::m_isNewTerminal
NodeArray< bool > m_isNewTerminal
Incidence vector for nonterminal nodes marked as terminals for improvement.
Definition: MinSteinerTreeRZLoss.h:224
ogdf::MinSteinerTreeRZLoss::Main::numberOfContractedComponents
long numberOfContractedComponents()
Returns the number of contracted components.
Definition: MinSteinerTreeRZLoss.h:244
ogdf::MinSteinerTreeModule::sortTerminals
static void sortTerminals(List< node > &terminals)
Sort terminals by index.
Definition: MinSteinerTreeModule.h:317
FullComponentGeneratorDreyfusWagnerWithoutMatrix.h
Definition of the ogdf::steiner_tree::FullComponentGeneratorDreyfusWagnerWithoutMatrix class template...
ogdf::EdgeWeightedGraph
Definition: EdgeWeightedGraph.h:39
ogdf::MinSteinerTreeRZLoss::Main::m_componentsContracted
long m_componentsContracted
Number of contracted components.
Definition: MinSteinerTreeRZLoss.h:227
FullComponentGeneratorCaller.h
Definition of the FullComponentGeneratorCaller class template.
ogdf::steiner_tree::FullComponentGeneratorCaller::computeDistanceMatrix
static void computeDistanceMatrix(NodeArray< NodeArray< T >> &distance, NodeArray< NodeArray< edge >> &pred, const EdgeWeightedGraph< T > &graph, const List< node > &terminals, const NodeArray< bool > &isTerminal, int restricted)
Computes distance and predecessor matrix.
Definition: FullComponentGeneratorCaller.h:50
ogdf::MinSteinerTreeRZLoss::numberOfContractedComponents
long numberOfContractedComponents()
Returns the number of contracted components.
Definition: MinSteinerTreeRZLoss.h:90
ogdf::GraphCopyBase::newNode
node newNode(node vOrig)
Creates a new node in the graph copy with original node vOrig.
Definition: GraphCopy.h:185
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: List.h:42
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:651
ogdf::MinSteinerTreeRZLoss::Main::m_G
const EdgeWeightedGraph< T > & m_G
The original edge-weighted graph.
Definition: MinSteinerTreeRZLoss.h:218
ogdf::MinSteinerTreeRZLoss::m_alg
std::unique_ptr< Main > m_alg
Definition: MinSteinerTreeRZLoss.h:65
ogdf::steiner_tree::FullComponentDecisions::shouldUseErickson
static bool shouldUseErickson(int n, int m)
Returns true iff the rule of thumb predicts to use the algorithm by Erickson et al instead of the Dre...
Definition: FullComponentDecisions.h:108
ogdf::MinSteinerTreeRZLoss::m_restricted
int m_restricted
Definition: MinSteinerTreeRZLoss.h:63
ogdf::GraphCopy::copy
edge copy(edge e) const override
Returns the first edge in the list of edges corresponding to edge e.
Definition: GraphCopy.h:457
ogdf::MinSteinerTreeRZLoss::Main::contractLoss
void contractLoss(EdgeWeightedGraphCopy< T > &steinerTree, int compId)
Contracts the loss of a full component and integrates it into the given terminal-spanning tree.
Definition: MinSteinerTreeRZLoss.h:442
ogdf::EdgeStandardType::tree
@ tree
for every hyperedge e a minimal subcubic tree connecting all hypernodes incident with e together is a...
OGDF_STEINERTREE_RZLOSS_REDUCE_ON
#define OGDF_STEINERTREE_RZLOSS_REDUCE_ON
Definition: MinSteinerTreeRZLoss.h:46
ogdf::MinSteinerTreeRZLoss::numberOfGeneratedComponents
long numberOfGeneratedComponents()
Returns the number of generated components.
Definition: MinSteinerTreeRZLoss.h:82
ogdf::steiner_tree::FullComponentWithLossStore
A data structure to store full components with additional "loss" functionality.
Definition: FullComponentStore.h:381
ogdf::EdgeWeightedGraphCopy::edgeWeights
const EdgeArray< T > & edgeWeights() const
Definition: EdgeWeightedGraphCopy.h:61
ogdf::EdgeWeightedGraphCopy::weight
T weight(const edge e) const
Definition: EdgeWeightedGraphCopy.h:57
ogdf::makeMinimumSpanningTree
T makeMinimumSpanningTree(Graph &G, const EdgeArray< T > &weight)
Reduce a graph to its minimum spanning tree (MST) using Kruskal's algorithm.
Definition: extended_graph_alg.h:233
ogdf::NodeElement::succ
node succ() const
Returns the successor in the list of all nodes.
Definition: Graph_d.h:285
ogdf::steiner_tree::Full3ComponentGeneratorVoronoi::call
void call(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, const NodeArray< NodeArray< T >> &distance, const NodeArray< NodeArray< edge >> &pred, std::function< void(node, node, node, node, T)> generateFunction) const
Generate full components and call generateFunction for each full component.
Definition: Full3ComponentGeneratorVoronoi.h:44
ogdf::EdgeWeightedGraphCopy
Definition: EdgeWeightedGraphCopy.h:40
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
ogdf::MinSteinerTreeRZLoss::numberOfComponentLookUps
long numberOfComponentLookUps()
Returns the number of components lookups during execution time.
Definition: MinSteinerTreeRZLoss.h:98
MinSteinerTreeMehlhorn.h
Implementation of Mehlhorn's minimum Steiner tree 2(1-1/l)-approximation algorithm.
ogdf::SubsetEnumerator::next
void next()
Obtains the next subset if possible. The result should be checked using the valid() method.
Definition: SubsetEnumerator.h:165
ogdf::MinSteinerTreeRZLoss::Main::multiPass
void multiPass(EdgeWeightedGraphCopy< T > &steinerTree)
Contraction phase of the algorithm.
Definition: MinSteinerTreeRZLoss.h:369
ogdf::steiner_tree::FullComponentGeneratorDreyfusWagnerWithoutMatrix::call
void call(int restricted)
Definition: FullComponentGeneratorDreyfusWagnerWithoutMatrix.h:491
ogdf::MinSteinerTreeRZLoss::Main::m_componentsGenerated
long m_componentsGenerated
Number of generated components.
Definition: MinSteinerTreeRZLoss.h:226
ogdf::MinSteinerTreeRZLoss::Main::m_fullCompStore
steiner_tree::FullComponentWithLossStore< T > m_fullCompStore
All generated full components.
Definition: MinSteinerTreeRZLoss.h:223
ogdf::MinSteinerTreeRZLoss::Main::m_restricted
int m_restricted
Parameter for the number of terminals in a full component.
Definition: MinSteinerTreeRZLoss.h:221
ogdf::MinSteinerTreeRZLoss::Main::m_terminals
List< node > m_terminals
List of terminal nodes (will be copied and sorted)
Definition: MinSteinerTreeRZLoss.h:220
ogdf::MinSteinerTreeRZLoss::Main::m_save
std::unique_ptr< steiner_tree::SaveStatic< T > > m_save
The save data structure.
Definition: MinSteinerTreeRZLoss.h:222
Full3ComponentGeneratorVoronoi.h
Definition of ogdf::steiner_tree::Full3ComponentGeneratorVoronoi class template.
ogdf::MinSteinerTreeRZLoss::MinSteinerTreeRZLoss
MinSteinerTreeRZLoss(int v)
Definition: MinSteinerTreeRZLoss.h:71
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::MinSteinerTreeRZLoss::Main
Definition: MinSteinerTreeRZLoss.h:122
ogdf::isTree
bool isTree(const Graph &G)
Returns true iff G is a tree, i.e. contains no undirected cycle and is connected.
Definition: simple_graph_alg.h:914
ogdf::steiner_tree::SaveStatic
This class behaves basically the same as SaveDynamic except that the update of the weighted graph is ...
Definition: SaveStatic.h:48
ogdf::GraphCopyBase::original
const Graph & original() const
Returns a reference to the original graph.
Definition: GraphCopy.h:98
ogdf::MinSteinerTreeRZLoss::Main::findFull3Components
void findFull3Components(const EdgeWeightedGraphCopy< T > &tree, const NodeArray< NodeArray< T >> &distance, const NodeArray< NodeArray< edge >> &pred)
Find full components of size 3.
Definition: MinSteinerTreeRZLoss.h:305
ogdf::MinSteinerTreeRZLoss::Main::gain
T gain(const TERMINAL_CONTAINER &terminals, const EdgeWeightedGraphCopy< T > &steinerTree)
Definition: MinSteinerTreeRZLoss.h:420