Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

FastMultipoleEmbedder.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
39 
40 namespace ogdf {
41 
43 
47 {
53 
54 public:
57 
60 
62  void call(
63  const Graph& G,
64  NodeArray<float>& nodeXPosition,
65  NodeArray<float>& nodeYPosition,
66  const EdgeArray<float>& edgeLength,
67  const NodeArray<float>& nodeSize);
68 
70  void call(GraphAttributes &GA, const EdgeArray<float>& edgeLength, const NodeArray<float>& nodeSize);
71 
73  virtual void call(GraphAttributes &GA) override;
74 
76  void setNumIterations(uint32_t numIterations) { m_numIterations = numIterations; }
77 
79  void setMultipolePrec(uint32_t precision) { m_precisionParameter = precision; }
80 
82  void setRandomize(bool b) { m_randomize = b; }
83 
85  void setDefaultEdgeLength(float edgeLength) { m_defaultEdgeLength = edgeLength; }
86 
88  void setDefaultNodeSize(float nodeSize) { m_defaultNodeSize = nodeSize; }
89 
91  void setNumberOfThreads(uint32_t numThreads) {
92 #ifndef OGDF_MEMORY_POOL_NTS
93  m_maxNumberOfThreads = numThreads;
94 #endif
95  }
96 
97 #if 0
98  void setEnablePostProcessing(bool b) { m_doPostProcessing = b; }
99 #endif
100 
101 private:
102  void initOptions();
103 
104  void runMultipole();
105 
106  void runSingle();
107 
109  void run(uint32_t numIterations);
110 
112  void allocate(uint32_t numNodes, uint32_t numEdges);
113 
115  void deallocate();
116 
117  uint32_t m_numIterations;
118 
120 
122 
124 
126 
128 
130 
132 
134 
136 };
137 
138 
140 
144 {
147 
148 public:
151  : m_iMaxNumThreads(1)
152  , m_iNumLevels(0)
153  , m_multiLevelNumNodesBound(10)
154  , m_iCurrentLevelNr(-1)
155  { }
157  void call(GraphAttributes &GA) override;
158 
160  void multilevelUntilNumNodesAreLess(int nodesBound) { m_multiLevelNumNodesBound = nodesBound; }
161 
162  void maxNumThreads(int numThreads) { m_iMaxNumThreads = numThreads; }
163 private:
165  void computeAutoEdgeLength(const GraphAttributes& GA, EdgeArray<float>& edgeLength, float factor = 1.0f);
166 
168  void run(GraphAttributes& GA, const EdgeArray<float>& edgeLength);
169 
171  void createMultiLevelGraphs(Graph* pGraph, GraphAttributes& GA, const EdgeArray<float>& edgeLength);
172 
174  void initFinestLevel(GraphAttributes &GA, const EdgeArray<float>& edgeLength);
175 
177  void layoutCurrentLevel();
178 
180  void assignPositionsFromPrevLevel();
181 
183  void writeCurrentToGraphAttributes(GraphAttributes& GA);
184 
186  void nextLevel();
187 
189  void initCurrentLevel();
190 
192  void deleteMultiLevelGraphs();
193 
195  void dumpCurrentLevel(const char *filename);
196 
198  uint32_t numberOfIterationsByLevelNr(uint32_t levelNr);
199 
203 
204  GalaxyMultilevel* m_pCurrentLevel = nullptr;
205  GalaxyMultilevel* m_pFinestLevel = nullptr;
206  GalaxyMultilevel* m_pCoarsestLevel = nullptr;
207 
208  Graph* m_pCurrentGraph = nullptr;
209  NodeArray<float>* m_pCurrentNodeXPos = nullptr;
210  NodeArray<float>* m_pCurrentNodeYPos = nullptr;
211  EdgeArray<float>* m_pCurrentEdgeLength = nullptr;
212  NodeArray<float>* m_pCurrentNodeSize = nullptr;
215 
216  NodeArray<float>* m_pLastNodeXPos = nullptr;
217  NodeArray<float>* m_pLastNodeYPos = nullptr;
218 };
219 
220 }
FastMultipoleMultilevelEmbedder()
Constructor, just sets number of maximum threads.
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:492
the main global options for a run
Definition: FMEFunc.h:68
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
void setDefaultEdgeLength(float edgeLength)
Definitions of various auxiliary classes for FME layout.
Declaration of class GalaxyMultilevelBuilder.
void multilevelUntilNumNodesAreLess(int nodesBound)
sets the bound for the number of nodes for multilevel step
void setDefaultNodeSize(float nodeSize)
Declaration of class FMEThread.
Stores additional attributes of a graph (like layout information).
void setMultipolePrec(uint32_t precision)
sets the number of coefficients for the expansions. default = 4
void setNumIterations(uint32_t numIterations)
sets the maximum number of iterations
The fast multipole multilevel embedder approach for force-directed multilevel layout.
Declaration of interface for layout algorithms (class LayoutModule)
Interface of general layout algorithms.
Definition: LayoutModule.h:44
void setNumberOfThreads(uint32_t numThreads)
Includes declaration of graph class.
The fast multipole embedder approach for force-directed layout.
The namespace for all OGDF objects.
void setRandomize(bool b)
if true, layout algorithm will randomize the layout in the beginning