Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Full3ComponentGeneratorVoronoi.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
35 #include <ogdf/graphalg/Voronoi.h>
37 
38 #include <functional>
39 #include <limits>
40 
41 namespace ogdf {
42 template<class E>
43 class List;
44 template<typename T>
45 class EdgeWeightedGraph;
46 
47 namespace steiner_tree {
48 
50 template<typename T>
52 public:
53  void call(const EdgeWeightedGraph<T>& G, const List<node>& terminals,
54  const NodeArray<bool>& isTerminal, const NodeArray<NodeArray<T>>& distance,
55  const NodeArray<NodeArray<edge>>& pred,
56  std::function<void(node, node, node, node, T)> generateFunction) const {
57  Voronoi<T> voronoi(G, G.edgeWeights(), terminals);
58  this->forAllTerminalTriples(terminals, distance,
59  [&](node u, node v, node w, const NodeArray<T>& uDistance,
60  const NodeArray<T>& vDistance, const NodeArray<T>& wDistance) {
61  node center = nullptr;
62  T minCost = std::numeric_limits<T>::max();
63  // look in all Voronoi regions for the best center node
64  for (node x : voronoi.nodesInRegion(u)) {
65  this->updateBestCenter(x, center, minCost, uDistance, vDistance, wDistance);
66  }
67  for (node x : voronoi.nodesInRegion(v)) {
68  this->updateBestCenter(x, center, minCost, uDistance, vDistance, wDistance);
69  }
70  for (node x : voronoi.nodesInRegion(w)) {
71  this->updateBestCenter(x, center, minCost, uDistance, vDistance, wDistance);
72  }
73  this->checkAndGenerateFunction(u, v, w, center, minCost, pred, isTerminal,
74  generateFunction);
75  });
76  }
77 };
78 
79 }
80 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::steiner_tree::Full3ComponentGeneratorModule::forAllTerminalTriples
void forAllTerminalTriples(const List< node > &terminals, const NodeArray< NodeArray< T >> &distance, std::function< void(node, node, node, const NodeArray< T > &, const NodeArray< T > &, const NodeArray< T > &)> func) const
Definition: Full3ComponentGeneratorModule.h:90
Graph.h
Includes declaration of graph class.
ogdf::steiner_tree::Full3ComponentGeneratorModule
Interface for full 3-component generation including auxiliary functions.
Definition: MinSteinerTreeZelikovsky.h:56
ogdf::Voronoi
Computes Voronoi regions in an edge-weighted graph.
Definition: Voronoi.h:49
Full3ComponentGeneratorModule.h
Definition of ogdf::steiner_tree::Full3ComponentGeneratorModule class template.
ogdf::Voronoi::nodesInRegion
const ArrayBuffer< node > & nodesInRegion(node v) const
Returns the list of nodes in the Voronoi region of node v.
Definition: Voronoi.h:93
ogdf::steiner_tree::Full3ComponentGeneratorVoronoi
Full 3-component generation using Voronoi regions.
Definition: Full3ComponentGeneratorVoronoi.h:51
ogdf::EdgeWeightedGraph
Definition: GraphIO.h:56
ogdf::steiner_tree::Full3ComponentGeneratorModule::checkAndGenerateFunction
void checkAndGenerateFunction(node u, node v, node w, node center, T minCost, const NodeArray< NodeArray< edge >> &pred, const NodeArray< bool > &isTerminal, std::function< void(node, node, node, node, T)> generateFunction) const
Definition: Full3ComponentGeneratorModule.h:104
Voronoi.h
Definition of ogdf::Voronoi class template.
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::steiner_tree::Full3ComponentGeneratorModule::updateBestCenter
void updateBestCenter(node x, node &center, T &minCost, const NodeArray< T > &dist1, const NodeArray< T > &dist2, const NodeArray< T > &dist3) const
Update center node if it is the best so far.
Definition: Full3ComponentGeneratorModule.h:74
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::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240