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/graphalg/Voronoi.h>
36 
37 namespace ogdf {
38 namespace steiner_tree {
39 
41 template<typename T>
43 public:
44  void call(const EdgeWeightedGraph<T>& G, const List<node>& terminals,
45  const NodeArray<bool>& isTerminal, const NodeArray<NodeArray<T>>& distance,
46  const NodeArray<NodeArray<edge>>& pred,
47  std::function<void(node, node, node, node, T)> generateFunction) const {
48  Voronoi<T> voronoi(G, G.edgeWeights(), terminals);
49  this->forAllTerminalTriples(terminals, distance,
50  [&](node u, node v, node w, const NodeArray<T>& uDistance,
51  const NodeArray<T>& vDistance, const NodeArray<T>& wDistance) {
52  node center = nullptr;
53  T minCost = std::numeric_limits<T>::max();
54  // look in all Voronoi regions for the best center node
55  for (node x : voronoi.nodesInRegion(u)) {
56  this->updateBestCenter(x, center, minCost, uDistance, vDistance, wDistance);
57  }
58  for (node x : voronoi.nodesInRegion(v)) {
59  this->updateBestCenter(x, center, minCost, uDistance, vDistance, wDistance);
60  }
61  for (node x : voronoi.nodesInRegion(w)) {
62  this->updateBestCenter(x, center, minCost, uDistance, vDistance, wDistance);
63  }
64  this->checkAndGenerateFunction(u, v, w, center, minCost, pred, isTerminal,
65  generateFunction);
66  });
67  }
68 };
69 
70 }
71 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
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:84
ogdf::steiner_tree::Full3ComponentGeneratorModule
Interface for full 3-component generation including auxiliary functions.
Definition: Full3ComponentGeneratorModule.h:47
ogdf::Voronoi
Computes Voronoi regions in an edge-weighted graph.
Definition: Voronoi.h:46
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:90
ogdf::steiner_tree::Full3ComponentGeneratorVoronoi
Full 3-component generation using Voronoi regions.
Definition: Full3ComponentGeneratorVoronoi.h:42
ogdf::EdgeWeightedGraph
Definition: EdgeWeightedGraph.h:39
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:98
Voronoi.h
Definition of ogdf::Voronoi class template.
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::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:68
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::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233