Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

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