Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
SubgraphPlanarizerUML.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 <memory>
43#include <random>
44
45namespace ogdf {
46class PlanRepLight;
47class PlanRepUML;
48
50
110 class ThreadMaster;
111 class Worker;
112
113protected:
115 virtual ReturnType doCall(PlanRepUML& pr, int cc, const EdgeArray<int>* pCostOrig,
116 int& crossingNumber) override;
117
118public:
121
124
126 virtual UMLCrossingMinimizationModule* clone() const override;
127
130
132 void setSubgraph(PlanarSubgraphModule<int>* pSubgraph) { m_subgraph.reset(pSubgraph); }
133
135 void setInserter(UMLEdgeInsertionModule* pInserter) { m_inserter.reset(pInserter); }
136
138 int permutations() { return m_permutations; }
139
141 void permutations(int p) { m_permutations = p; }
142
144 bool setTimeout() { return m_setTimeout; }
145
147 void setTimeout(bool b) { m_setTimeout = b; }
148
150 unsigned int maxThreads() const { return m_maxThreads; }
151
153 void maxThreads(unsigned int n) {
154#ifndef OGDF_MEMORY_POOL_NTS
155 m_maxThreads = n;
156#endif
157 }
158
159private:
160 static void doWorkHelper(ThreadMaster& master, UMLEdgeInsertionModule& inserter,
161 std::minstd_rand& rng);
162
163 static bool doSinglePermutation(PlanRepLight& prl, int cc, const EdgeArray<int>* pCost,
164 Array<edge>& deletedEdges, UMLEdgeInsertionModule& inserter, std::minstd_rand& rng,
165 int& crossingNumber);
166
167 std::unique_ptr<PlanarSubgraphModule<int>> m_subgraph;
168 std::unique_ptr<UMLEdgeInsertionModule> m_inserter;
169
172 unsigned int m_maxThreads;
173};
174
175}
Declaration and implementation of Array class and Array algorithms.
Includes declaration of graph class.
Contains logging functionality.
Declaration of interface for planar subgraph algorithms.
Declaration of CrossingMinimization Module, an interface for crossing minimization algorithms.
Declaration of interface for edge insertion algorithms.
Basic declarations, included by all source files.
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:219
Centralized global and local logging facility working on streams like std::cout.
Definition Logger.h:102
ReturnType
The return type of a module.
Definition Module.h:52
Light-weight version of a planarized representation, associated with a PlanRep.
Planarized representation (of a connected component) of a UMLGraph; allows special handling of hierar...
Definition PlanRepUML.h:55
Interface for planar subgraph algorithms.
The planarization approach for UML crossing minimization.
void setSubgraph(PlanarSubgraphModule< int > *pSubgraph)
Sets the module option for the computation of the planar subgraph.
SubgraphPlanarizerUML(const SubgraphPlanarizerUML &planarizer)
Creates an instance of subgraph planarizer with the same settings as planarizer.
unsigned int maxThreads() const
Returns the maximal number of used threads.
int m_permutations
The number of permutations.
std::unique_ptr< PlanarSubgraphModule< int > > m_subgraph
The planar subgraph algorithm.
static void doWorkHelper(ThreadMaster &master, UMLEdgeInsertionModule &inserter, std::minstd_rand &rng)
unsigned int m_maxThreads
The maximal number of used threads.
virtual UMLCrossingMinimizationModule * clone() const override
Returns a new instance of subgraph planarizer with the same option settings.
static bool doSinglePermutation(PlanRepLight &prl, int cc, const EdgeArray< int > *pCost, Array< edge > &deletedEdges, UMLEdgeInsertionModule &inserter, std::minstd_rand &rng, int &crossingNumber)
std::unique_ptr< UMLEdgeInsertionModule > m_inserter
The edge insertion module.
bool setTimeout()
Returns the current setting of options setTimeout.
void setInserter(UMLEdgeInsertionModule *pInserter)
Sets the module option for the edge insertion module.
SubgraphPlanarizerUML()
Creates an instance of subgraph planarizer with default settings.
void maxThreads(unsigned int n)
Sets the maximal number of used threads to n.
bool m_setTimeout
The option for setting timeouts in submodules.
void permutations(int p)
Sets the number of permutations to p.
virtual ReturnType doCall(PlanRepUML &pr, int cc, const EdgeArray< int > *pCostOrig, int &crossingNumber) override
Implements the algorithm call.
void setTimeout(bool b)
Sets the option setTimeout to b.
int permutations()
Returns the number of permutations.
SubgraphPlanarizerUML & operator=(const SubgraphPlanarizerUML &planarizer)
Assignment operator. Copies option settings only.
Base class for UML crossing minimization algorithms.
Interface for UML edge insertion algorithms.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
The namespace for all OGDF objects.