Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

SubgraphPlanarizer.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Logger.h>
38 
39 #include <memory>
40 #include <random>
41 
42 namespace ogdf {
43 
45 
107  class ThreadMaster;
108  class Worker;
109 
110 protected:
112  virtual ReturnType doCall(PlanRep& pr, int cc, const EdgeArray<int>* pCostOrig,
113  const EdgeArray<bool>* pForbiddenOrig, const EdgeArray<uint32_t>* pEdgeSubGraphs,
114  int& crossingNumber) override;
115 
116 public:
119 
121  SubgraphPlanarizer(const SubgraphPlanarizer& planarizer);
122 
124  virtual CrossingMinimizationModule* clone() const override;
125 
127  SubgraphPlanarizer& operator=(const SubgraphPlanarizer& planarizer);
128 
130  void setSubgraph(PlanarSubgraphModule<int>* pSubgraph) { m_subgraph.reset(pSubgraph); }
131 
133  void setInserter(EdgeInsertionModule* pInserter) { m_inserter.reset(pInserter); }
134 
136  int permutations() { return m_permutations; }
137 
139  void permutations(int p) { m_permutations = p; }
140 
142  bool setTimeout() { return m_setTimeout; }
143 
145  void setTimeout(bool b) { m_setTimeout = b; }
146 
148  unsigned int maxThreads() const { return m_maxThreads; }
149 
151  void maxThreads(unsigned int n) {
152 #ifndef OGDF_MEMORY_POOL_NTS
153  m_maxThreads = n;
154 #endif
155  }
156 
157 private:
158  static void doWorkHelper(ThreadMaster& master, EdgeInsertionModule& inserter,
159  std::minstd_rand& rng);
160 
161  static bool doSinglePermutation(PlanRepLight& prl, int cc, const EdgeArray<int>* pCost,
162  const EdgeArray<bool>* pForbid, const EdgeArray<uint32_t>* pEdgeSubGraphs,
163  Array<edge>& deletedEdges, EdgeInsertionModule& inserter, std::minstd_rand& rng,
164  int& crossingNumber);
165 
166  std::unique_ptr<PlanarSubgraphModule<int>> m_subgraph;
167  std::unique_ptr<EdgeInsertionModule> m_inserter;
168 
171  unsigned int m_maxThreads;
172 };
173 
174 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::PlanarSubgraphModule< int >
ogdf::PlanRep
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:57
ogdf::CrossingMinimizationModule
Base class for crossing minimization algorithms.
Definition: CrossingMinimizationModule.h:41
CrossingMinimizationModule.h
Declaration of CrossingMinimization Module, an interface for crossing minimization algorithms.
ogdf::SubgraphPlanarizer::maxThreads
unsigned int maxThreads() const
Returns the maximal number of used threads.
Definition: SubgraphPlanarizer.h:148
ogdf::SubgraphPlanarizer::setTimeout
void setTimeout(bool b)
Sets the option setTimeout to b.
Definition: SubgraphPlanarizer.h:145
ogdf::SubgraphPlanarizer::maxThreads
void maxThreads(unsigned int n)
Sets the maximal number of used threads to n.
Definition: SubgraphPlanarizer.h:151
ogdf::PlanRepLight
Light-weight version of a planarized representation, associated with a PlanRep.
Definition: PlanRepLight.h:43
ogdf::SubgraphPlanarizer::setInserter
void setInserter(EdgeInsertionModule *pInserter)
Sets the module option for the edge insertion module.
Definition: SubgraphPlanarizer.h:133
ogdf::EdgeInsertionModule
Interface for edge insertion algorithms.
Definition: EdgeInsertionModule.h:45
ogdf::SubgraphPlanarizer::m_inserter
std::unique_ptr< EdgeInsertionModule > m_inserter
The edge insertion module.
Definition: SubgraphPlanarizer.h:167
ogdf::SubgraphPlanarizer::setTimeout
bool setTimeout()
Returns the current setting of options setTimeout.
Definition: SubgraphPlanarizer.h:142
Logger.h
Contains logging functionality.
ogdf::SubgraphPlanarizer::permutations
int permutations()
Returns the number of permutations.
Definition: SubgraphPlanarizer.h:136
PlanarSubgraphModule.h
Declaration of interface for planar subgraph algorithms.
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:214
ogdf::SubgraphPlanarizer::m_permutations
int m_permutations
The number of permutations.
Definition: SubgraphPlanarizer.h:169
ogdf::SubgraphPlanarizer::m_maxThreads
unsigned int m_maxThreads
The maximal number of used threads.
Definition: SubgraphPlanarizer.h:171
ogdf::SubgraphPlanarizer::m_setTimeout
bool m_setTimeout
The option for setting timeouts in submodules.
Definition: SubgraphPlanarizer.h:170
EdgeInsertionModule.h
Declaration of interface for edge insertion algorithms.
ogdf::SubgraphPlanarizer::setSubgraph
void setSubgraph(PlanarSubgraphModule< int > *pSubgraph)
Sets the module option for the computation of the planar subgraph.
Definition: SubgraphPlanarizer.h:130
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::SubgraphPlanarizer
The planarization approach for crossing minimization.
Definition: SubgraphPlanarizer.h:106
ogdf::SubgraphPlanarizer::m_subgraph
std::unique_ptr< PlanarSubgraphModule< int > > m_subgraph
The planar subgraph algorithm.
Definition: SubgraphPlanarizer.h:166
ogdf::Logger
Centralized global and local logging facility working on streams like std::cout.
Definition: Logger.h:100
ogdf::Module::ReturnType
ReturnType
The return type of a module.
Definition: Module.h:50
ogdf::SubgraphPlanarizer::permutations
void permutations(int p)
Sets the number of permutations to p.
Definition: SubgraphPlanarizer.h:139
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:709