Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

MinSteinerTreeGoemans139.h
Go to the documentation of this file.
1 
33 #pragma once
34 
35 #include <ogdf/basic/ArrayBuffer.h>
36 #include <ogdf/basic/Graph.h>
37 #include <ogdf/basic/GraphList.h>
38 #include <ogdf/basic/List.h>
40 #include <ogdf/basic/basic.h>
54 
55 #include <random>
56 
57 namespace ogdf {
58 template<typename T>
59 class EdgeWeightedGraph;
60 
78 template<typename T>
80 private:
81  class Main;
82 
83 protected:
84  int m_restricted;
88  int m_seed;
89 
90 public:
92  : m_restricted(3)
93  , m_preprocess(true)
94  , m_use2approx(false)
95  , m_separateCycles(false)
96  , m_seed(1337) { }
97 
99 
104  void setMaxComponentSize(int k) { m_restricted = k; }
105 
110  void setSeed(int seed) { m_seed = seed; }
111 
117  void use2Approximation(bool use2approx = true) { m_use2approx = use2approx; }
118 
124  void disablePreprocessing(bool preprocess = true) { m_preprocess = !preprocess; }
125 
131 
132 protected:
141  virtual T computeSteinerTree(const EdgeWeightedGraph<T>& G, const List<node>& terminals,
142  const NodeArray<bool>& isTerminal, EdgeWeightedGraphCopy<T>*& finalSteinerTree) override;
143 };
144 
145 template<typename T>
147  const List<node>& terminals, const NodeArray<bool>& isTerminal,
148  EdgeWeightedGraphCopy<T>*& finalSteinerTree) {
149  std::minstd_rand rng(m_seed);
150  List<node> sortedTerminals(terminals);
152  Main main(G, sortedTerminals, isTerminal, m_restricted, m_use2approx, m_separateCycles);
153  return main.getApproximation(finalSteinerTree, rng, m_preprocess);
154 }
155 
158 template<typename T>
165 
167  enum class Approx2State {
168  Off,
169  On,
170  JustUseIt,
171  };
173 
174  const double m_eps;
175 
178 
181 
183  void findFull2Components(const NodeArray<NodeArray<T>>& distance,
184  const NodeArray<NodeArray<edge>>& pred);
186  void findFull3Components(const NodeArray<NodeArray<T>>& distance,
187  const NodeArray<NodeArray<edge>>& pred);
189  void find3RestrictedComponents();
191  void findFullComponentsDW();
193  void findFullComponentsEMV();
195  template<typename FCG>
196  void retrieveComponents(const FCG& fcg);
198  void findFullComponents();
199 
203 
206  for (int k = m_fullCompStore.size() - 1; k >= 0; --k) {
207  OGDF_ASSERT(k < m_fullCompStore.size());
208  if (m_fullCompStore.extra(k) <= m_eps) {
209  m_fullCompStore.remove(k);
210  }
211  }
212  }
213 
216  ids.quicksort();
217  for (int i = ids.size() - 1; i >= 0; --i) {
218  m_fullCompStore.remove(ids[i]);
219  }
220  }
221 
223  void addComponent(NodeArray<bool>& isNewTerminal, int id) {
224  m_fullCompStore.foreachNode(id, [&](node v) { isNewTerminal[v] = true; });
225  }
226 
229  void preprocess(NodeArray<bool>& isNewTerminal) {
230  Graph H; // a graph where each component is a star
231  NodeArray<int> id(H); // ids each center of the star to the component id
232  NodeArray<node> copy(m_G, nullptr); // ids orig in m_G -> copy in H
233 
234  List<node> centers; // all centers
235  for (int i = 0; i < m_fullCompStore.size(); ++i) {
236  const node center = H.newNode();
237  centers.pushBack(center);
238  id[center] = i;
239 
240  for (node vG : m_fullCompStore.terminals(i)) {
241  node vH = copy[vG];
242  if (!vH) {
243  vH = H.newNode();
244  copy[vG] = vH;
245  }
246  H.newEdge(vH, center); // target is always center
247  }
248  }
249 
250  // find components to be inserted into the steinerTree and insert them
251  ArrayBuffer<int> inactive; // ids of components we insert; we have to remove them from the set of active components afterwards
252  bool changed;
253  do {
254  changed = false;
255  ListIterator<node> it2;
256  for (ListIterator<node> it = centers.begin(); it.valid(); it = it2) {
257  it2 = it.succ();
258  node c = *it;
259  int innerNodes = 0; // count inner nodes
260  for (adjEntry adj : c->adjEntries) {
261  innerNodes += (adj->twinNode()->degree() != 1);
262  }
263  if (innerNodes <= 1) { // this center represents a component to add to steinerTree
264  // insert component into steinerTree
265  addComponent(isNewTerminal, id[c]);
266 
267  // remove center from H (adjacent leaves can remain being isolated nodes)
268  inactive.push(id[c]);
269  H.delNode(c);
270  centers.del(it);
271 
272  changed = true;
273  }
274  }
275  } while (changed);
276 
277  removeComponents(inactive);
278  }
279 
281 
282 public:
284  Main(const EdgeWeightedGraph<T>& G, const List<node>& terminals,
285  const NodeArray<bool>& isTerminal, int restricted, bool use2approx, bool separateCycles,
286  double eps = 1e-8)
287  : m_G(G)
288  , m_isTerminal(isTerminal)
289  , m_terminals(terminals)
290  , m_fullCompStore(G, m_terminals, isTerminal)
291  , m_restricted(restricted)
292  , m_use2approx(use2approx ? Approx2State::On : Approx2State::Off)
293  , m_eps(eps)
294  , m_approx2SteinerTree(nullptr)
295  , m_approx2Weight(0) {
296  if (m_use2approx == Approx2State::On) { // add upper bound by 2-approximation
298  m_approx2Weight = mstT.call(m_G, m_terminals, m_isTerminal, m_approx2SteinerTree);
299  }
300 
301  if (m_restricted > m_terminals.size()) {
302  m_restricted = m_terminals.size();
303  }
304 
305  findFullComponents();
306 
307  steiner_tree::LPRelaxationSER<T> lp(m_G, m_terminals, m_isTerminal, m_fullCompStore,
308  m_approx2Weight, separateCycles ? m_restricted + 1 : 0, m_eps);
309  if (!lp.solve()) {
310  OGDF_ASSERT(m_use2approx == Approx2State::On);
311  m_use2approx = Approx2State::JustUseIt;
312  }
313  }
314 
315  ~Main() { }
316 
318  T getApproximation(EdgeWeightedGraphCopy<T>*& finalSteinerTree, const std::minstd_rand& rng,
319  const bool doPreprocessing = true);
320 };
321 
322 template<typename T>
324  const NodeArray<NodeArray<edge>>& pred) {
326  fcg.call(m_G, m_terminals, distance, pred, [&](node s, node t, T cost) {
327  EdgeWeightedGraphCopy<T> minComp;
328  minComp.setOriginalGraph(m_G);
329  minComp.newEdge(minComp.newNode(s), minComp.newNode(t), distance[s][t]);
330  m_fullCompStore.insert(minComp);
331  });
332 }
333 
334 template<typename T>
336  const NodeArray<NodeArray<edge>>& pred) {
338  fcg.call(m_G, m_terminals, m_isTerminal, distance, pred,
339  [&](node t0, node t1, node t2, node minCenter, T minCost) {
340  // create a full 3-component
341  EdgeWeightedGraphCopy<T> minComp;
342  minComp.setOriginalGraph(m_G);
343  node minCenterC = minComp.newNode(minCenter);
344  minComp.newEdge(minComp.newNode(t0), minCenterC, distance[t0][minCenter]);
345  minComp.newEdge(minComp.newNode(t1), minCenterC, distance[t1][minCenter]);
346  minComp.newEdge(minComp.newNode(t2), minCenterC, distance[t2][minCenter]);
347  m_fullCompStore.insert(minComp);
348  });
349 }
350 
351 template<typename T>
353  NodeArray<NodeArray<T>> distance;
355 
357  m_terminals, m_isTerminal, m_restricted);
358 
359  findFull2Components(distance, pred);
360  if (m_restricted == 3) {
361  findFull3Components(distance, pred);
362  }
363 }
364 
365 template<typename T>
366 template<typename FCG>
368  SubsetEnumerator<node> terminalSubset(m_terminals);
369  for (terminalSubset.begin(2, m_restricted); terminalSubset.valid(); terminalSubset.next()) {
370  EdgeWeightedGraphCopy<T> component;
371  List<node> terminals;
372  terminalSubset.list(terminals);
373  fcg.getSteinerTreeFor(terminals, component);
374  if (fcg.isValidComponent(component)) {
375  m_fullCompStore.insert(component);
376  }
377  }
378 }
379 
380 template<typename T>
382  NodeArray<NodeArray<T>> distance;
385  m_terminals, m_isTerminal, m_restricted);
386 
387  steiner_tree::FullComponentGeneratorDreyfusWagner<T> fcg(m_G, m_terminals, m_isTerminal,
388  distance, pred);
389  fcg.call(m_restricted);
390  retrieveComponents(fcg);
391 }
392 
393 template<typename T>
396  m_isTerminal);
397  fcg.call(m_restricted);
398  retrieveComponents(fcg);
399 }
400 
401 template<typename T>
403  if (m_restricted >= 4) { // use Dreyfus-Wagner based full component generation
405  m_G.numberOfEdges())) {
406  findFullComponentsEMV();
407  } else {
408  findFullComponentsDW();
409  }
410  } else {
411  find3RestrictedComponents();
412  }
413 }
414 
415 template<typename T>
417  const std::minstd_rand& rng, const bool doPreprocessing) {
418  if (m_use2approx == Approx2State::JustUseIt) {
419  // no remaining components
420  finalSteinerTree = m_approx2SteinerTree;
421  return m_approx2Weight;
422  }
423 
424  removeInactiveComponents();
425 
426  NodeArray<bool> isNewTerminal(m_G, false);
427  for (node v : m_terminals) {
428  isNewTerminal[v] = true;
429  }
430 
431  if (doPreprocessing) {
432  preprocess(isNewTerminal);
433  }
434 
435  if (!m_fullCompStore.isEmpty()) {
436  steiner_tree::goemans::Approximation<T> approx(m_G, m_terminals, m_isTerminal,
437  m_fullCompStore, rng, m_eps);
438  approx.solve(isNewTerminal);
439  }
440 
441  T cost = steiner_tree::obtainFinalSteinerTree(m_G, isNewTerminal, m_isTerminal, finalSteinerTree);
442 
443  if (m_use2approx != Approx2State::Off) {
444  if (m_approx2Weight < cost) {
445  delete finalSteinerTree;
446  finalSteinerTree = m_approx2SteinerTree;
447  cost = m_approx2Weight;
448  } else {
449  delete m_approx2SteinerTree;
450  }
451  }
452 
453  return cost;
454 }
455 
456 }
ogdf::ArrayBuffer< int >
ogdf::MinSteinerTreeGoemans139::Main::m_use2approx
Approx2State m_use2approx
Definition: MinSteinerTreeGoemans139.h:172
ogdf::steiner_tree::FullComponentGeneratorDreyfusWagner::call
void call(int restricted)
Definition: FullComponentGeneratorDreyfusWagner.h:377
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ArrayBuffer.h
Declaration and implementation of ArrayBuffer class.
ogdf::steiner_tree::goemans::Approximation::solve
void solve(NodeArray< bool > &isNewTerminal)
Perform the actual approximation algorithm on the LP solution.
Definition: Approximation.h:353
Graph.h
Includes declaration of graph class.
MinSteinerTreeTakahashi.h
Implementation of the 2(1-1/l)-approximation algorithm for the minimum Steiner tree problem by Matsuy...
ogdf::SubsetEnumerator
Enumerator for k-subsets of a given type.
Definition: SubsetEnumerator.h:97
ogdf::MinSteinerTreeGoemans139::Main::m_eps
const double m_eps
epsilon for double operations
Definition: MinSteinerTreeGoemans139.h:174
FullComponentStore.h
Definition of the FullComponentStore class template.
ogdf::MinSteinerTreeGoemans139::Main::m_approx2SteinerTree
EdgeWeightedGraphCopy< T > * m_approx2SteinerTree
Definition: MinSteinerTreeGoemans139.h:176
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:66
ogdf::MinSteinerTreeTakahashi::call
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.
Definition: MinSteinerTreeTakahashi.h:79
ogdf::MinSteinerTreeGoemans139::m_restricted
int m_restricted
Definition: MinSteinerTreeGoemans139.h:81
ogdf::MinSteinerTreeGoemans139::Main::removeComponents
void removeComponents(ArrayBuffer< int > &ids)
Remove the full components with the given ids.
Definition: MinSteinerTreeGoemans139.h:215
ogdf::MinSteinerTreeGoemans139::separateCycles
void separateCycles(bool separateCycles=true)
Use stronger LP relaxation (not recommended in general)
Definition: MinSteinerTreeGoemans139.h:130
Full2ComponentGenerator.h
Definition of ogdf::steiner_tree::Full2ComponentGenerator class template.
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
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::MinSteinerTreeGoemans139::Main::m_restricted
int m_restricted
Definition: MinSteinerTreeGoemans139.h:166
ogdf::steiner_tree::FullComponentStore::insert
void insert(const EdgeWeightedGraphCopy< T > &comp)
Inserts a component. Note that comp is copied and degree-2 nodes are removed.
Definition: FullComponentStore.h:162
ogdf::MinSteinerTreeGoemans139::Main::preprocess
void preprocess(NodeArray< bool > &isNewTerminal)
Preprocess LP solution.
Definition: MinSteinerTreeGoemans139.h:229
ogdf::steiner_tree::Full2ComponentGenerator::call
void call(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< NodeArray< T >> &distance, const NodeArray< NodeArray< edge >> &pred, std::function< void(node, node, T)> generateFunction) const
Generate full 2-components and call generateFunction for each full 2-component.
Definition: Full2ComponentGenerator.h:55
ogdf::MinSteinerTreeGoemans139::Main::find3RestrictedComponents
void find3RestrictedComponents()
Find 3-restricted components.
Definition: MinSteinerTreeGoemans139.h:352
ogdf::EdgeWeightedGraphCopy::newEdge
edge newEdge(node u, node v, T weight)
Definition: EdgeWeightedGraphCopy.h:169
ogdf::MinSteinerTreeGoemans139::m_seed
int m_seed
Definition: MinSteinerTreeGoemans139.h:88
ogdf::steiner_tree::FullComponentGeneratorDreyfusWagner
A generator for restricted full components (for Steiner tree approximations) based on the Dreyfus-Wag...
Definition: FullComponentGeneratorDreyfusWagner.h:61
ogdf::MinSteinerTreeGoemans139::Main::findFullComponents
void findFullComponents()
Find full components.
Definition: MinSteinerTreeGoemans139.h:402
Approximation.h
Definition of ogdf::steiner_tree::goemans::Approximation class template.
ogdf::MinSteinerTreeGoemans139
This class implements the (1.39+epsilon)-approximation algorithm for the Steiner tree problem by Goem...
Definition: MinSteinerTreeGoemans139.h:79
ogdf::MinSteinerTreeGoemans139::Main::removeInactiveComponents
void removeInactiveComponents()
Remove inactive components from m_fullCompStore (since we do not need them any longer)
Definition: MinSteinerTreeGoemans139.h:205
ogdf::MinSteinerTreeGoemans139::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 for a given weighted graph with terminals.
Definition: MinSteinerTreeGoemans139.h:146
FullComponentDecisions.h
Definition of the FullComponentDecisions class.
ogdf::MinSteinerTreeGoemans139::Main::findFullComponentsDW
void findFullComponentsDW()
Find full components using algorithm by Dreyfus-Wagner.
Definition: MinSteinerTreeGoemans139.h:381
ogdf::MinSteinerTreeGoemans139::Main::m_terminals
const List< node > & m_terminals
List of terminals.
Definition: MinSteinerTreeGoemans139.h:162
ogdf::MinSteinerTreeGoemans139::Main::findFull2Components
void findFull2Components(const NodeArray< NodeArray< T >> &distance, const NodeArray< NodeArray< edge >> &pred)
Find full components of size 2.
Definition: MinSteinerTreeGoemans139.h:323
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
EdgeWeightedGraphCopy.h
Extends the GraphCopy concept to weighted graphs.
ogdf::MinSteinerTreeModule
Serves as an interface for various methods to compute or approximate minimum Steiner trees on undirec...
Definition: MinSteinerTreeModule.h:72
MinSteinerTreeModule.h
Declaration of ogdf::MinSteinerTreeModule.
ogdf::ListIteratorBase::succ
ListIteratorBase< E, isConst, isReverse > succ() const
Returns successor iterator.
Definition: List.h:174
ogdf::MinSteinerTreeGoemans139::Main::m_isTerminal
const NodeArray< bool > & m_isTerminal
Definition: MinSteinerTreeGoemans139.h:161
ogdf::steiner_tree::LPRelaxationSER
Class managing the component-based subtour elimination LP relaxation for the Steiner tree problem and...
Definition: LPRelaxationSER.h:73
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.
Minisat::Internal::copy
static void copy(const T &from, T &to)
Definition: Alg.h:61
ogdf::ArrayBuffer::quicksort
void quicksort()
Sorts buffer using Quicksort.
Definition: ArrayBuffer.h:428
ogdf::steiner_tree::LPRelaxationSER::solve
bool solve()
Solve the LP. The solution will be written to the extra data of the full component store.
Definition: LPRelaxationSER.h:332
common_algorithms.h
Algorithms used by at least two functions of Steiner tree code or its internal helpers.
ogdf::NodeElement::degree
int degree() const
Returns the degree of the node (indegree + outdegree).
Definition: Graph_d.h:283
ogdf::MinSteinerTreeGoemans139::Main
Class managing LP-based approximation.
Definition: MinSteinerTreeGoemans139.h:159
ogdf::MinSteinerTreeGoemans139::m_preprocess
bool m_preprocess
Definition: MinSteinerTreeGoemans139.h:85
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
GraphList.h
Decralation of GraphElement and GraphList classes.
ogdf::NodeElement::adjEntries
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
Definition: Graph_d.h:271
FullComponentGeneratorCaller.h
Definition of the FullComponentGeneratorCaller class template.
ogdf::MinSteinerTreeGoemans139::Main::~Main
~Main()
Definition: MinSteinerTreeGoemans139.h:315
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::MinSteinerTreeGoemans139::setSeed
void setSeed(int seed)
Set seed for the random number generation.
Definition: MinSteinerTreeGoemans139.h:110
ogdf::ArrayBuffer::size
INDEX size() const
Returns number of elements in the buffer.
Definition: ArrayBuffer.h:244
ogdf::ArrayBuffer::push
void push(E e)
Puts a new element in the buffer.
Definition: ArrayBuffer.h:217
main
int main()
Definition: gen-acyclic-graph.cpp:9
ogdf::MinSteinerTreeGoemans139::~MinSteinerTreeGoemans139
virtual ~MinSteinerTreeGoemans139()
Definition: MinSteinerTreeGoemans139.h:98
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
Approx2State
Approx2State
Definition: MinSteinerTreeGoemans139.h:167
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::MinSteinerTreeGoemans139::Main::getApproximation
T getApproximation(EdgeWeightedGraphCopy< T > *&finalSteinerTree, const std::minstd_rand &rng, const bool doPreprocessing=true)
Obtain an (1.39+epsilon)-approximation based on the LP solution.
Definition: MinSteinerTreeGoemans139.h:416
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::MinSteinerTreeGoemans139::Main::m_approx2Weight
T m_approx2Weight
Definition: MinSteinerTreeGoemans139.h:177
ogdf::MinSteinerTreeGoemans139::Main::findFull3Components
void findFull3Components(const NodeArray< NodeArray< T >> &distance, const NodeArray< NodeArray< edge >> &pred)
Find full components of size 3.
Definition: MinSteinerTreeGoemans139.h:335
ogdf::MinSteinerTreeGoemans139::Main::m_G
const EdgeWeightedGraph< T > & m_G
Definition: MinSteinerTreeGoemans139.h:160
ogdf::AdjElement::twinNode
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Definition: Graph_d.h:175
ogdf::MinSteinerTreeGoemans139::Main::addComponent
void addComponent(NodeArray< bool > &isNewTerminal, int id)
Add a full component to the final solution (by changing nonterminals to terminals)
Definition: MinSteinerTreeGoemans139.h:223
ogdf::MinSteinerTreeGoemans139::Main::findFullComponentsEMV
void findFullComponentsEMV()
Find full components using algorithm by Erickson et al.
Definition: MinSteinerTreeGoemans139.h:394
ogdf::MinSteinerTreeGoemans139::disablePreprocessing
void disablePreprocessing(bool preprocess=true)
Disable preprocessing of LP solutions.
Definition: MinSteinerTreeGoemans139.h:124
ogdf::MinSteinerTreeTakahashi
This class implements the minimum Steiner tree 2-approximation algorithm by Takahashi and Matsuyama w...
Definition: MinSteinerTreeTakahashi.h:66
ogdf::List::del
void del(iterator it)
Removes it from the list.
Definition: List.h:1611
basic.h
Basic declarations, included by all source files.
ogdf::MinSteinerTreeGoemans139::MinSteinerTreeGoemans139
MinSteinerTreeGoemans139()
Definition: MinSteinerTreeGoemans139.h:91
ogdf::steiner_tree::Full2ComponentGenerator
Trivial full 2-component generation by lookups of shortest paths between terminal pairs.
Definition: Full2ComponentGenerator.h:52
ogdf::MinSteinerTreeGoemans139::m_separateCycles
bool m_separateCycles
Definition: MinSteinerTreeGoemans139.h:87
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
List.h
Declaration of doubly linked lists and iterators.
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::steiner_tree::FullComponentGeneratorDreyfusWagnerWithoutMatrix::call
void call(int restricted)
Definition: FullComponentGeneratorDreyfusWagnerWithoutMatrix.h:501
ogdf::MinSteinerTreeGoemans139::Main::m_fullCompStore
steiner_tree::FullComponentWithExtraStore< T, double > m_fullCompStore
all enumerated full components, with solution
Definition: MinSteinerTreeGoemans139.h:164
ogdf::List::size
int size() const
Returns the number of elements in the list.
Definition: List.h:1488
ogdf::ListIteratorBase
Encapsulates a pointer to a list element.
Definition: List.h:51
Full3ComponentGeneratorVoronoi.h
Definition of ogdf::steiner_tree::Full3ComponentGeneratorVoronoi class template.
ogdf::MinSteinerTreeGoemans139::Main::Main
Main(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, int restricted, bool use2approx, bool separateCycles, double eps=1e-8)
Initialize all attributes, sort the terminal list.
Definition: MinSteinerTreeGoemans139.h:284
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::MinSteinerTreeGoemans139::Main::retrieveComponents
void retrieveComponents(const FCG &fcg)
Auxiliary function to retrieve components by Dreyfus-Wagner/Erickson et al implementation.
Definition: MinSteinerTreeGoemans139.h:367
ogdf::steiner_tree::FullComponentWithExtraStore< T, double >
ogdf::MinSteinerTreeGoemans139::use2Approximation
void use2Approximation(bool use2approx=true)
Use Takahashi-Matsuyama 2-approximation as upper bounds.
Definition: MinSteinerTreeGoemans139.h:117
ogdf::List::pushBack
iterator pushBack(const E &x)
Adds element x at the end of the list.
Definition: List.h:1547
LPRelaxationSER.h
Definition of ogdf::steiner_tree::LPRelaxationSER class template.
ogdf::MinSteinerTreeGoemans139::setMaxComponentSize
void setMaxComponentSize(int k)
Sets the maximal number of terminals in a full component.
Definition: MinSteinerTreeGoemans139.h:104
ogdf::steiner_tree::goemans::Approximation
The actual 1.39-approximation algorithm by Goemans et al. with a set of terminalized nodes as result.
Definition: Approximation.h:69
ogdf::MinSteinerTreeGoemans139::m_use2approx
bool m_use2approx
Definition: MinSteinerTreeGoemans139.h:86
SubsetEnumerator.h
A class that allows to enumerate k-subsets.