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/Array.h>
35 #include <ogdf/basic/Graph.h>
36 #include <ogdf/basic/Logger.h>
37 #include <ogdf/basic/basic.h>
41 
42 #include <cstdint>
43 #include <memory>
44 #include <random>
45 
46 namespace ogdf {
47 class PlanRep;
48 class PlanRepLight;
49 
51 
113  class ThreadMaster;
114  class Worker;
115 
116 protected:
118  virtual ReturnType doCall(PlanRep& pr, int cc, const EdgeArray<int>* pCostOrig,
119  const EdgeArray<bool>* pForbiddenOrig, const EdgeArray<uint32_t>* pEdgeSubGraphs,
120  int& crossingNumber) override;
121 
122 public:
125 
127  SubgraphPlanarizer(const SubgraphPlanarizer& planarizer);
128 
130  virtual CrossingMinimizationModule* clone() const override;
131 
133  SubgraphPlanarizer& operator=(const SubgraphPlanarizer& planarizer);
134 
136  void setSubgraph(PlanarSubgraphModule<int>* pSubgraph) { m_subgraph.reset(pSubgraph); }
137 
139  void setInserter(EdgeInsertionModule* pInserter) { m_inserter.reset(pInserter); }
140 
142  int permutations() { return m_permutations; }
143 
145  void permutations(int p) { m_permutations = p; }
146 
148  bool setTimeout() { return m_setTimeout; }
149 
151  void setTimeout(bool b) { m_setTimeout = b; }
152 
154  unsigned int maxThreads() const { return m_maxThreads; }
155 
157  void maxThreads(unsigned int n) {
158 #ifndef OGDF_MEMORY_POOL_NTS
159  m_maxThreads = n;
160 #endif
161  }
162 
163 private:
164  static void doWorkHelper(ThreadMaster& master, EdgeInsertionModule& inserter,
165  std::minstd_rand& rng);
166 
167  static bool doSinglePermutation(PlanRepLight& prl, int cc, const EdgeArray<int>* pCost,
168  const EdgeArray<bool>* pForbid, const EdgeArray<uint32_t>* pEdgeSubGraphs,
169  Array<edge>& deletedEdges, EdgeInsertionModule& inserter, std::minstd_rand& rng,
170  int& crossingNumber);
171 
172  std::unique_ptr<PlanarSubgraphModule<int>> m_subgraph;
173  std::unique_ptr<EdgeInsertionModule> m_inserter;
174 
177  unsigned int m_maxThreads;
178 };
179 
180 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::PlanarSubgraphModule< int >
Graph.h
Includes declaration of graph class.
ogdf::PlanRep
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:69
ogdf::CrossingMinimizationModule
Base class for crossing minimization algorithms.
Definition: CrossingMinimizationModule.h:48
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:154
ogdf::SubgraphPlanarizer::setTimeout
void setTimeout(bool b)
Sets the option setTimeout to b.
Definition: SubgraphPlanarizer.h:151
ogdf::SubgraphPlanarizer::maxThreads
void maxThreads(unsigned int n)
Sets the maximal number of used threads to n.
Definition: SubgraphPlanarizer.h:157
ogdf::PlanRepLight
Light-weight version of a planarized representation, associated with a PlanRep.
Definition: PlanRepLight.h:45
ogdf::SubgraphPlanarizer::setInserter
void setInserter(EdgeInsertionModule *pInserter)
Sets the module option for the edge insertion module.
Definition: SubgraphPlanarizer.h:139
ogdf::EdgeInsertionModule
Interface for edge insertion algorithms.
Definition: EdgeInsertionModule.h:50
ogdf::SubgraphPlanarizer::m_inserter
std::unique_ptr< EdgeInsertionModule > m_inserter
The edge insertion module.
Definition: SubgraphPlanarizer.h:173
ogdf::SubgraphPlanarizer::setTimeout
bool setTimeout()
Returns the current setting of options setTimeout.
Definition: SubgraphPlanarizer.h:148
Logger.h
Contains logging functionality.
ogdf::SubgraphPlanarizer::permutations
int permutations()
Returns the number of permutations.
Definition: SubgraphPlanarizer.h:142
PlanarSubgraphModule.h
Declaration of interface for planar subgraph algorithms.
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:219
ogdf::SubgraphPlanarizer::m_permutations
int m_permutations
The number of permutations.
Definition: SubgraphPlanarizer.h:175
ogdf::SubgraphPlanarizer::m_maxThreads
unsigned int m_maxThreads
The maximal number of used threads.
Definition: SubgraphPlanarizer.h:177
ogdf::SubgraphPlanarizer::m_setTimeout
bool m_setTimeout
The option for setting timeouts in submodules.
Definition: SubgraphPlanarizer.h:176
EdgeInsertionModule.h
Declaration of interface for edge insertion algorithms.
basic.h
Basic declarations, included by all source files.
ogdf::SubgraphPlanarizer::setSubgraph
void setSubgraph(PlanarSubgraphModule< int > *pSubgraph)
Sets the module option for the computation of the planar subgraph.
Definition: SubgraphPlanarizer.h:136
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
Array.h
Declaration and implementation of Array class and Array algorithms.
ogdf::SubgraphPlanarizer
The planarization approach for crossing minimization.
Definition: SubgraphPlanarizer.h:112
ogdf::SubgraphPlanarizer::m_subgraph
std::unique_ptr< PlanarSubgraphModule< int > > m_subgraph
The planar subgraph algorithm.
Definition: SubgraphPlanarizer.h:172
ogdf::Logger
Centralized global and local logging facility working on streams like std::cout.
Definition: Logger.h:102
ogdf::Module::ReturnType
ReturnType
The return type of a module.
Definition: Module.h:52
ogdf::SubgraphPlanarizer::permutations
void permutations(int p)
Sets the number of permutations to p.
Definition: SubgraphPlanarizer.h:145
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716