Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

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 
43 namespace ogdf
44 {
45 
47 
109 {
110  class ThreadMaster;
111  class Worker;
112 
113 protected:
115  virtual ReturnType doCall(PlanRep &pr,
116  int cc,
117  const EdgeArray<int> *pCostOrig,
118  const EdgeArray<bool> *pForbiddenOrig,
119  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 
135 
138  m_subgraph.reset(pSubgraph);
139  }
140 
142  void setInserter(EdgeInsertionModule *pInserter) {
143  m_inserter.reset(pInserter);
144  }
145 
147  int permutations() { return m_permutations; }
148 
150  void permutations(int p) { m_permutations = p; }
151 
153  bool setTimeout() { return m_setTimeout; }
154 
156  void setTimeout(bool b) { m_setTimeout = b; }
157 
159  unsigned int maxThreads() const { return m_maxThreads; }
160 
162  void maxThreads(unsigned int n) {
163 #ifndef OGDF_MEMORY_POOL_NTS
164  m_maxThreads = n;
165 #endif
166  }
167 
168 private:
169  static void doWorkHelper(ThreadMaster &master, EdgeInsertionModule &inserter, std::minstd_rand &rng);
170 
171  static bool doSinglePermutation(
172  PlanRepLight &prl,
173  int cc,
174  const EdgeArray<int> *pCost,
175  const EdgeArray<bool> *pForbid,
176  const EdgeArray<uint32_t> *pEdgeSubGraphs,
177  Array<edge> &deletedEdges,
178  EdgeInsertionModule &inserter,
179  std::minstd_rand &rng,
180  int &crossingNumber);
181 
182  std::unique_ptr<PlanarSubgraphModule<int>> m_subgraph;
183  std::unique_ptr<EdgeInsertionModule> m_inserter;
184 
187  unsigned int m_maxThreads;
188 };
189 
190 }
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:56
#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 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:60