Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

MinSteinerTreeRZLoss.h
Go to the documentation of this file.
1 
33 #pragma once
34 
35 #include <ogdf/basic/Graph.h>
36 #include <ogdf/basic/List.h>
38 #include <ogdf/basic/basic.h>
52 
53 #include <algorithm>
54 #include <memory>
55 #include <set>
56 #include <vector>
57 
58 namespace ogdf {
59 template<typename T>
60 class EdgeWeightedGraph;
61 } // namespace ogdf
62 
63 #define OGDF_STEINERTREE_RZLOSS_REDUCE_ON
64 
65 namespace ogdf {
66 
78 template<typename T>
81 
82  class Main;
83 
84  std::unique_ptr<Main> m_alg;
85 
86 public:
88 
90 
91  virtual ~MinSteinerTreeRZLoss() { }
92 
97  void setMaxComponentSize(int k) { m_restricted = k; }
98 
101  if (m_alg == nullptr) {
102  return 0;
103  }
104  return m_alg->numberOfGeneratedComponents();
105  }
106 
109  if (m_alg == nullptr) {
110  return 0;
111  }
112  return m_alg->numberOfContractedComponents();
113  }
114 
117  if (m_alg == nullptr) {
118  return 0;
119  }
120  return m_alg->numberOfComponentLookUps();
121  }
122 
123 protected:
132  virtual T computeSteinerTree(const EdgeWeightedGraph<T>& G, const List<node>& terminals,
133  const NodeArray<bool>& isTerminal, EdgeWeightedGraphCopy<T>*& finalSteinerTree) override {
134  m_alg.reset(new Main(G, terminals, isTerminal, m_restricted));
135  return m_alg->getApproximation(finalSteinerTree);
136  }
137 };
138 
139 template<typename T>
141  template<typename TYPE>
143 
146 
153  void findFullComponentsDW(const EdgeWeightedGraphCopy<T>& tree,
154  const NodeArray<NodeArray<T>>& distance, const NodeArray<NodeArray<edge>>& pred);
156  void findFullComponentsEMV(const EdgeWeightedGraphCopy<T>& tree);
158  void findFull3Components(const EdgeWeightedGraphCopy<T>& tree,
159  const NodeArray<NodeArray<T>>& distance, const NodeArray<NodeArray<edge>>& pred);
161  template<typename FCG>
162  void retrieveComponents(const FCG& fcg, const EdgeWeightedGraphCopy<T>& tree);
163 
165 
172  void generateInitialTerminalSpanningTree(EdgeWeightedGraphCopy<T>& steinerTree,
173  const NodeArray<NodeArray<T>>& distance, const NodeArray<NodeArray<edge>>& pred);
174 
177  tree.setOriginalGraph(m_G);
178 
179  if (m_restricted >= 4
181  m_G.numberOfEdges())) {
183  m_save.reset(new steiner_tree::SaveStatic<T>(tree));
184  findFullComponentsEMV(tree);
185  } else {
186  NodeArray<NodeArray<T>> distance;
188 
190  m_G, m_terminals, m_isTerminal, m_restricted);
191 
192  generateInitialTerminalSpanningTree(tree, distance, pred);
193  m_save.reset(new steiner_tree::SaveStatic<T>(tree));
194 
195  if (m_restricted >= 4) { // use Dreyfus-Wagner based full component generation
196  findFullComponentsDW(tree, distance, pred);
197  } else {
198  findFull3Components(tree, distance, pred);
199  }
200  }
201 
202  m_fullCompStore.computeAllLosses();
203  m_componentsGenerated = m_fullCompStore.size();
204  }
205 
210  void multiPass(EdgeWeightedGraphCopy<T>& steinerTree);
211 
218  double extractMaxComponent(const EdgeWeightedGraphCopy<T>& steinerTree, int& maxCompId);
219 
226  template<typename TERMINAL_CONTAINER>
227  T gain(const TERMINAL_CONTAINER& terminals, const EdgeWeightedGraphCopy<T>& steinerTree);
228 
234  void contractLoss(EdgeWeightedGraphCopy<T>& steinerTree, int compId);
235 
240  std::unique_ptr<steiner_tree::SaveStatic<T>> m_save;
243 
247 
248 public:
249  Main(const EdgeWeightedGraph<T>& G, const List<node>& terminals,
250  const NodeArray<bool>& isTerminal, int restricted);
251 
252  T getApproximation(EdgeWeightedGraphCopy<T>*& finalSteinerTree) const {
253  // obtain final Steiner Tree using (MST-based) Steiner tree approximation algorithm
254  return steiner_tree::obtainFinalSteinerTree(m_G, m_isNewTerminal, m_isTerminal,
255  finalSteinerTree);
256  }
257 
259  long numberOfGeneratedComponents() { return m_componentsGenerated; }
260 
262  long numberOfContractedComponents() { return m_componentsContracted; }
263 
265  long numberOfComponentLookUps() { return m_componentsLookUps; }
266 };
267 
268 template<typename T>
270  const NodeArray<bool>& isTerminal, int restricted)
271  : m_G(G)
272  , m_isTerminal(isTerminal)
273  , m_terminals(terminals)
274  , // copy
275  m_restricted(min(restricted, terminals.size()))
276  , m_fullCompStore(m_G, m_terminals, m_isTerminal)
277  , m_isNewTerminal(m_G, false)
278  , m_componentsGenerated(0)
279  , m_componentsContracted(0)
280  , m_componentsLookUps(0) {
282 
283  for (node v : terminals) {
284  m_isNewTerminal[v] = true;
285  }
286 
287  // init terminal-spanning tree and its save-edge data structure
288  EdgeWeightedGraphCopy<T> steinerTree; // the terminal-spanning tree to be modified
289 
290  setup(steinerTree);
291 
292  // contraction phase
293  multiPass(steinerTree);
294 
295  m_save.reset();
296 }
297 
298 template<typename T>
300  EdgeWeightedGraphCopy<T>& steinerTree, const NodeArray<NodeArray<T>>& distance,
301  const NodeArray<NodeArray<edge>>& pred) {
302  // generate complete graph
303  for (node v : m_terminals) {
304  steinerTree.newNode(v);
305  }
306  for (node u : steinerTree.nodes) {
307  const node uO = steinerTree.original(u);
308  const NodeArray<T>& dist = distance[uO];
309  const NodeArray<edge>& p = pred[uO];
310  for (node v = u->succ(); v; v = v->succ()) {
311  const node vO = steinerTree.original(v);
312  if (p[vO] != nullptr) {
313  steinerTree.newEdge(u, v, dist[vO]);
314  }
315  }
316  }
317  // compute MST
318  makeMinimumSpanningTree(steinerTree, steinerTree.edgeWeights());
319  OGDF_ASSERT(steinerTree.numberOfNodes() == steinerTree.numberOfEdges() + 1);
320 }
321 
322 template<typename T>
324  const NodeArray<NodeArray<T>>& distance, const NodeArray<NodeArray<edge>>& pred) {
326  fcg.call(m_G, m_terminals, m_isTerminal, distance, pred,
327  [&](node t0, node t1, node t2, node minCenter, T minCost) {
328  // create a full 3-component
329  EdgeWeightedGraphCopy<T> minComp;
330  minComp.setOriginalGraph(m_G);
331  node minCenterC = minComp.newNode(minCenter);
332  minComp.newEdge(minComp.newNode(t0), minCenterC, distance[t0][minCenter]);
333  minComp.newEdge(minComp.newNode(t1), minCenterC, distance[t1][minCenter]);
334  minComp.newEdge(minComp.newNode(t2), minCenterC, distance[t2][minCenter]);
335  OGDF_ASSERT(isTree(minComp));
336 #ifdef OGDF_STEINERTREE_RZLOSS_REDUCE_ON
337  if (gain(std::vector<node> {t0, t1, t2}, tree) > minCost) { // reduction
338  m_fullCompStore.insert(minComp);
339  }
340 #else
341  m_fullCompStore.insert(minComp);
342 #endif
343  });
344 }
345 
346 template<typename T>
347 template<typename FCG>
349  const EdgeWeightedGraphCopy<T>& tree) {
350  SubsetEnumerator<node> terminalSubset(m_terminals);
351  for (terminalSubset.begin(3, m_restricted); terminalSubset.valid(); terminalSubset.next()) {
352  EdgeWeightedGraphCopy<T> component;
353  List<node> terminals;
354  terminalSubset.list(terminals);
355 #ifdef OGDF_STEINERTREE_RZLOSS_REDUCE_ON
356  T cost =
357 #endif
358  fcg.getSteinerTreeFor(terminals, component);
359  if (
361  gain(terminals, tree) > cost &&
362 #endif
363  fcg.isValidComponent(component)) {
364  m_fullCompStore.insert(component);
365  }
366  }
367 }
368 
369 template<typename T>
371  const NodeArray<NodeArray<T>>& distance, const NodeArray<NodeArray<edge>>& pred) {
372  steiner_tree::FullComponentGeneratorDreyfusWagner<T> fcg(m_G, m_terminals, m_isTerminal,
373  distance, pred);
374  fcg.call(m_restricted);
375  retrieveComponents(fcg, tree);
376 }
377 
378 template<typename T>
381  m_isTerminal);
382  fcg.call(m_restricted);
383  retrieveComponents(fcg, tree);
384 }
385 
386 template<typename T>
388  while (!m_fullCompStore.isEmpty()) {
389  int maxCompId;
390  double r = extractMaxComponent(steinerTree, maxCompId);
391  if (r > 1e-9) {
392  ++m_componentsContracted;
393 
394  // convert nodes of component to terminals
395  m_fullCompStore.foreachNode(maxCompId, [&](node v) { m_isNewTerminal[v] = true; });
396 
397  contractLoss(steinerTree, maxCompId);
398  m_fullCompStore.remove(maxCompId);
399 
400  if (!m_fullCompStore.isEmpty()) {
401  m_save->rebuild();
402  }
403  } else {
404  return;
405  }
406  }
407 }
408 
409 template<typename T>
411  const EdgeWeightedGraphCopy<T>& steinerTree, int& maxCompId) {
412  maxCompId = -1;
413  double max(0);
414  for (int i = 0; i < m_fullCompStore.size();) {
415  ++m_componentsLookUps;
416  const double winAbs =
417  gain(m_fullCompStore.terminals(i), steinerTree) - m_fullCompStore.cost(i);
418  if (winAbs > 1e-9) {
419  const double r = winAbs / m_fullCompStore.loss(i);
420  if (r > max) {
421  max = r;
422  maxCompId = i;
423  }
424  ++i;
425  }
426 #ifdef OGDF_STEINERTREE_RZLOSS_REDUCE_ON
427  else {
428  // reduction
429  m_fullCompStore.remove(i);
430  }
431 #endif
432  }
433  return max;
434 }
435 
436 template<typename T>
437 template<typename TERMINAL_CONTAINER>
438 T MinSteinerTreeRZLoss<T>::Main::gain(const TERMINAL_CONTAINER& terminals,
439  const EdgeWeightedGraphCopy<T>& steinerTree) {
440  std::set<edge> saveEdges;
441  T result(0);
442 
443  // extract edges and compute their sum (result value)
444  for (auto it1 = terminals.begin(); it1 != terminals.end(); ++it1) {
445  auto next = it1;
446  ++next;
447  for (auto it2 = next; it2 != terminals.end(); ++it2) {
448  const edge e = m_save->saveEdge(*it1, *it2);
449  saveEdges.insert(e);
450  }
451  }
452 
453  for (edge e : saveEdges) {
454  result += steinerTree.weight(e);
455  }
456  return result;
457 }
458 
459 template<typename T>
461  // for every non-loss edge {st} in the component,
462  // where s belongs to the loss component of terminal u
463  // and t belongs to the loss component of terminal v,
464  // we insert edges from u to v in the terminal-spanning tree
465  for (edge e : m_fullCompStore.lossBridges(compId)) {
466  const node u = m_fullCompStore.lossTerminal(e->source());
467  OGDF_ASSERT(u);
468  const node v = m_fullCompStore.lossTerminal(e->target());
469  OGDF_ASSERT(v);
470  steinerTree.newEdge(steinerTree.copy(u), steinerTree.copy(v),
471  m_fullCompStore.graph().weight(e));
472  // parallel edges are ok, will be removed by MST
473  }
474  if (steinerTree.numberOfNodes() != steinerTree.numberOfEdges() + 1) {
475  makeMinimumSpanningTree(steinerTree, steinerTree.edgeWeights());
476  }
477 }
478 
479 }
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:348
ogdf::steiner_tree::FullComponentGeneratorDreyfusWagner::call
void call(int restricted)
Definition: FullComponentGeneratorDreyfusWagner.h:377
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::MinSteinerTreeRZLoss::Main::m_isTerminal
const NodeArray< bool > & m_isTerminal
Incidence vector for terminal nodes.
Definition: MinSteinerTreeRZLoss.h:237
Graph.h
Includes declaration of graph class.
ogdf::MinSteinerTreeRZLoss::setMaxComponentSize
void setMaxComponentSize(int k)
Sets the maximal number of terminals in a full component.
Definition: MinSteinerTreeRZLoss.h:97
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:299
ogdf::SubsetEnumerator
Enumerator for k-subsets of a given type.
Definition: SubsetEnumerator.h:97
FullComponentStore.h
Definition of the FullComponentStore class template.
ogdf::MinSteinerTreeRZLoss::Main::numberOfGeneratedComponents
long numberOfGeneratedComponents()
Returns the number of generated components.
Definition: MinSteinerTreeRZLoss.h:259
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:66
ogdf::MinSteinerTreeRZLoss::Main::numberOfComponentLookUps
long numberOfComponentLookUps()
Returns the number of components lookups during execution time.
Definition: MinSteinerTreeRZLoss.h:265
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:162
ogdf::steiner_tree::FullComponentGeneratorDreyfusWagnerWithoutMatrix
A generator for restricted full components (for Steiner tree approximations) based on the Dreyfus-Wag...
Definition: FullComponentGeneratorDreyfusWagnerWithoutMatrix.h:65
ogdf::SubsetEnumerator::begin
void begin(int low, int high)
Initializes the SubsetEnumerator to enumerate subsets of cardinalities from low to high.
Definition: SubsetEnumerator.h:129
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:180
extended_graph_alg.h
Declaration of extended graph algorithms.
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:154
ogdf::MinSteinerTreeRZLoss::Main::getApproximation
T getApproximation(EdgeWeightedGraphCopy< T > *&finalSteinerTree) const
Definition: MinSteinerTreeRZLoss.h:252
ogdf::MinSteinerTreeRZLoss::MinSteinerTreeRZLoss
MinSteinerTreeRZLoss()
Definition: MinSteinerTreeRZLoss.h:87
ogdf::MinSteinerTreeRZLoss::Main::findFullComponentsEMV
void findFullComponentsEMV(const EdgeWeightedGraphCopy< T > &tree)
Find full components using algorithm by Erickson et al.
Definition: MinSteinerTreeRZLoss.h:379
ogdf::EdgeWeightedGraphCopy::newEdge
edge newEdge(node u, node v, T weight)
Definition: EdgeWeightedGraphCopy.h:169
ogdf::steiner_tree::FullComponentGeneratorDreyfusWagner
A generator for restricted full components (for Steiner tree approximations) based on the Dreyfus-Wag...
Definition: FullComponentGeneratorDreyfusWagner.h:61
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:410
FullComponentDecisions.h
Definition of the FullComponentDecisions class.
ogdf::steiner_tree::constructTerminalSpanningTreeUsingVoronoiRegions
T constructTerminalSpanningTreeUsingVoronoiRegions(EdgeWeightedGraphCopy< T > &terminalSpanningTree, const EdgeWeightedGraph< T > &graph, const List< node > &terminals)
Definition: MinSteinerTreeMehlhorn.h:300
ogdf::MinSteinerTreeRZLoss::Main::m_componentsLookUps
long m_componentsLookUps
Number of components lookups.
Definition: MinSteinerTreeRZLoss.h:246
ogdf::MinSteinerTreeRZLoss::~MinSteinerTreeRZLoss
virtual ~MinSteinerTreeRZLoss()
Definition: MinSteinerTreeRZLoss.h:91
EdgeWeightedGraphCopy.h
Extends the GraphCopy concept to weighted graphs.
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:132
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:370
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:176
ogdf::MinSteinerTreeModule
Serves as an interface for various methods to compute or approximate minimum Steiner trees on undirec...
Definition: MinSteinerTreeModule.h:72
ogdf::MinSteinerTreeRZLoss::Main::Main
Main(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, int restricted)
Definition: MinSteinerTreeRZLoss.h:269
MinSteinerTreeModule.h
Declaration of ogdf::MinSteinerTreeModule.
ogdf::MinSteinerTreeRZLoss
This class implements the loss-contracting (1.55+epsilon)-approximation algorithm for the Steiner tre...
Definition: MinSteinerTreeRZLoss.h:79
ogdf::steiner_tree::Full3ComponentGeneratorVoronoi
Full 3-component generation using Voronoi regions.
Definition: Full3ComponentGeneratorVoronoi.h:51
ogdf::SubsetEnumerator::list
void list(List< T > &subset) const
Obtains (appends) a list of the subset members.
Definition: SubsetEnumerator.h:211
FullComponentGeneratorDreyfusWagner.h
Definition of the ogdf::steiner_tree::FullComponentGeneratorDreyfusWagner class template.
r
int r[]
Definition: hierarchical-ranking.cpp:13
ogdf::Graph::nodes
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
Definition: Graph_d.h:932
ogdf::Graph::numberOfEdges
int numberOfEdges() const
Returns the number of edges in the graph.
Definition: Graph_d.h:985
common_algorithms.h
Algorithms used by at least two functions of Steiner tree code or its internal helpers.
ogdf::Graph::numberOfNodes
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition: Graph_d.h:982
ogdf::MinSteinerTreeRZLoss::Main::m_isNewTerminal
NodeArray< bool > m_isNewTerminal
Incidence vector for nonterminal nodes marked as terminals for improvement.
Definition: MinSteinerTreeRZLoss.h:242
ogdf::MinSteinerTreeRZLoss::Main::numberOfContractedComponents
long numberOfContractedComponents()
Returns the number of contracted components.
Definition: MinSteinerTreeRZLoss.h:262
ogdf::MinSteinerTreeModule::sortTerminals
static void sortTerminals(List< node > &terminals)
Sort terminals by index.
Definition: MinSteinerTreeModule.h:330
FullComponentGeneratorDreyfusWagnerWithoutMatrix.h
Definition of the ogdf::steiner_tree::FullComponentGeneratorDreyfusWagnerWithoutMatrix class template...
ogdf::EdgeWeightedGraph
Definition: GraphIO.h:56
ogdf::MinSteinerTreeRZLoss::Main::m_componentsContracted
long m_componentsContracted
Number of contracted components.
Definition: MinSteinerTreeRZLoss.h:245
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:55
ogdf::MinSteinerTreeRZLoss::numberOfContractedComponents
long numberOfContractedComponents()
Returns the number of contracted components.
Definition: MinSteinerTreeRZLoss.h:108
ogdf::GraphCopyBase::newNode
node newNode(node vOrig)
Creates a new node in the graph copy with original node vOrig.
Definition: GraphCopy.h:192
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: DfsMakeBiconnected.h:40
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::MinSteinerTreeRZLoss::Main::m_G
const EdgeWeightedGraph< T > & m_G
The original edge-weighted graph.
Definition: MinSteinerTreeRZLoss.h:236
ogdf::MinSteinerTreeRZLoss::m_alg
std::unique_ptr< Main > m_alg
Definition: MinSteinerTreeRZLoss.h:82
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:80
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:464
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:460
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:63
ogdf::MinSteinerTreeRZLoss::numberOfGeneratedComponents
long numberOfGeneratedComponents()
Returns the number of generated components.
Definition: MinSteinerTreeRZLoss.h:100
ogdf::steiner_tree::FullComponentWithLossStore
A data structure to store full components with additional "loss" functionality.
Definition: FullComponentStore.h:392
basic.h
Basic declarations, included by all source files.
ogdf::EdgeWeightedGraphCopy::edgeWeights
const EdgeArray< T > & edgeWeights() const
Definition: EdgeWeightedGraphCopy.h:65
ogdf::EdgeWeightedGraphCopy::weight
T weight(const edge e) const
Definition: EdgeWeightedGraphCopy.h:61
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:243
ogdf::NodeElement::succ
node succ() const
Returns the successor in the list of all nodes.
Definition: Graph_d.h:292
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:53
ogdf::EdgeWeightedGraphCopy
Definition: EdgeWeightedGraphCopy.h:44
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
ogdf::MinSteinerTreeRZLoss::numberOfComponentLookUps
long numberOfComponentLookUps()
Returns the number of components lookups during execution time.
Definition: MinSteinerTreeRZLoss.h:116
List.h
Declaration of doubly linked lists and iterators.
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:174
ogdf::MinSteinerTreeRZLoss::Main::multiPass
void multiPass(EdgeWeightedGraphCopy< T > &steinerTree)
Contraction phase of the algorithm.
Definition: MinSteinerTreeRZLoss.h:387
ogdf::steiner_tree::FullComponentGeneratorDreyfusWagnerWithoutMatrix::call
void call(int restricted)
Definition: FullComponentGeneratorDreyfusWagnerWithoutMatrix.h:501
ogdf::MinSteinerTreeRZLoss::Main::m_componentsGenerated
long m_componentsGenerated
Number of generated components.
Definition: MinSteinerTreeRZLoss.h:244
ogdf::MinSteinerTreeRZLoss::Main::m_fullCompStore
steiner_tree::FullComponentWithLossStore< T > m_fullCompStore
All generated full components.
Definition: MinSteinerTreeRZLoss.h:241
ogdf::MinSteinerTreeRZLoss::Main::m_restricted
int m_restricted
Parameter for the number of terminals in a full component.
Definition: MinSteinerTreeRZLoss.h:239
ogdf::MinSteinerTreeRZLoss::Main::m_terminals
List< node > m_terminals
List of terminal nodes (will be copied and sorted)
Definition: MinSteinerTreeRZLoss.h:238
ogdf::MinSteinerTreeRZLoss::Main::m_save
std::unique_ptr< steiner_tree::SaveStatic< T > > m_save
The save data structure.
Definition: MinSteinerTreeRZLoss.h:240
Full3ComponentGeneratorVoronoi.h
Definition of ogdf::steiner_tree::Full3ComponentGeneratorVoronoi class template.
ogdf::MinSteinerTreeRZLoss::MinSteinerTreeRZLoss
MinSteinerTreeRZLoss(int v)
Definition: MinSteinerTreeRZLoss.h:89
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::MinSteinerTreeRZLoss::Main
Definition: MinSteinerTreeRZLoss.h:140
simple_graph_alg.h
Declaration of simple graph algorithms.
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:922
ogdf::steiner_tree::SaveStatic
This class behaves basically the same as SaveDynamic except that the update of the weighted graph is ...
Definition: SaveStatic.h:57
ogdf::GraphCopyBase::original
const Graph & original() const
Returns a reference to the original graph.
Definition: GraphCopy.h:105
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:323
SubsetEnumerator.h
A class that allows to enumerate k-subsets.
ogdf::MinSteinerTreeRZLoss::Main::gain
T gain(const TERMINAL_CONTAINER &terminals, const EdgeWeightedGraphCopy< T > &steinerTree)
Definition: MinSteinerTreeRZLoss.h:438