Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
FastMultipoleEmbedder.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Graph.h>
39
40namespace ogdf {
41
43
52
53public:
56
59
62 const EdgeArray<float>& edgeLength, const NodeArray<float>& nodeSize);
63
65 void call(GraphAttributes& GA, const EdgeArray<float>& edgeLength,
66 const NodeArray<float>& nodeSize);
67
69 virtual void call(GraphAttributes& GA) override;
70
73
75 void setMultipolePrec(uint32_t precision) { m_precisionParameter = precision; }
76
78 void setRandomize(bool b) { m_randomize = b; }
79
81 void setDefaultEdgeLength(float edgeLength) { m_defaultEdgeLength = edgeLength; }
82
84 void setDefaultNodeSize(float nodeSize) { m_defaultNodeSize = nodeSize; }
85
87 void setNumberOfThreads(uint32_t numThreads) {
88#ifndef OGDF_MEMORY_POOL_NTS
89 m_maxNumberOfThreads = numThreads;
90#endif
91 }
92
93#if 0
95#endif
96
97private:
99
101
102 void runSingle();
103
106
108 void allocate(uint32_t numNodes, uint32_t numEdges);
109
112
114
116
118
120
122
124
126
128
130
132};
133
135
141
142public:
145 : m_iMaxNumThreads(1), m_iNumLevels(0), m_multiLevelNumNodesBound(10), m_iCurrentLevelNr(-1) { }
146
148 void call(GraphAttributes& GA) override;
149
151 void multilevelUntilNumNodesAreLess(int nodesBound) { m_multiLevelNumNodesBound = nodesBound; }
152
153 void maxNumThreads(int numThreads) { m_iMaxNumThreads = numThreads; }
154
155private:
158 float factor = 1.0f);
159
161 void run(GraphAttributes& GA, const EdgeArray<float>& edgeLength);
162
165 const EdgeArray<float>& edgeLength);
166
169
172
175
178
180 void nextLevel();
181
184
187
189 void dumpCurrentLevel(const char* filename);
190
193
197
198 GalaxyMultilevel* m_pCurrentLevel = nullptr;
199 GalaxyMultilevel* m_pFinestLevel = nullptr;
200 GalaxyMultilevel* m_pCoarsestLevel = nullptr;
201
202 Graph* m_pCurrentGraph = nullptr;
203 NodeArray<float>* m_pCurrentNodeXPos = nullptr;
204 NodeArray<float>* m_pCurrentNodeYPos = nullptr;
205 EdgeArray<float>* m_pCurrentEdgeLength = nullptr;
206 NodeArray<float>* m_pCurrentNodeSize = nullptr;
209
210 NodeArray<float>* m_pLastNodeXPos = nullptr;
211 NodeArray<float>* m_pLastNodeYPos = nullptr;
212};
213
214}
Definitions of various auxiliary classes for FME layout.
Declaration of class FMEThread.
Declaration of class GalaxyMultilevelBuilder.
Includes declaration of graph class.
Declaration of interface for layout algorithms (class LayoutModule)
Dynamic arrays indexed with edges.
Definition EdgeArray.h:125
The fast multipole embedder approach for force-directed layout.
~FastMultipoleEmbedder()
destructor
void setNumberOfThreads(uint32_t numThreads)
void deallocate()
frees the memory
void call(GraphAttributes &GA, const EdgeArray< float > &edgeLength, const NodeArray< float > &nodeSize)
Calls the algorithm for graph GA with the given edgeLength and returns the layout information in GA.
virtual void call(GraphAttributes &GA) override
Calls the algorithm for graph GA and returns the layout information in GA.
void setDefaultNodeSize(float nodeSize)
void run(uint32_t numIterations)
runs the simulation with the given number of iterations
void allocate(uint32_t numNodes, uint32_t numEdges)
allocates the memory
void setMultipolePrec(uint32_t precision)
sets the number of coefficients for the expansions. default = 4
void setDefaultEdgeLength(float edgeLength)
void setNumIterations(uint32_t numIterations)
sets the maximum number of iterations
void call(const Graph &G, NodeArray< float > &nodeXPosition, NodeArray< float > &nodeYPosition, const EdgeArray< float > &edgeLength, const NodeArray< float > &nodeSize)
Calls the algorithm for graph G with the given edgelength and returns the layout information in nodeX...
void setRandomize(bool b)
if true, layout algorithm will randomize the layout in the beginning
FastMultipoleEmbedder()
constructor
The fast multipole multilevel embedder approach for force-directed multilevel layout.
void deleteMultiLevelGraphs()
clean up the multilevel graphs
void assignPositionsFromPrevLevel()
assigns the nodes in the current level coords by coarser level
FastMultipoleMultilevelEmbedder()
Constructor, just sets number of maximum threads.
void dumpCurrentLevel(const char *filename)
for debugging only
void initCurrentLevel()
initialize datastructure by current level
void run(GraphAttributes &GA, const EdgeArray< float > &edgeLength)
internal main function for the multilevel layout
void computeAutoEdgeLength(const GraphAttributes &GA, EdgeArray< float > &edgeLength, float factor=1.0f)
internal function to compute a good edgelength
void multilevelUntilNumNodesAreLess(int nodesBound)
sets the bound for the number of nodes for multilevel step
uint32_t numberOfIterationsByLevelNr(uint32_t levelNr)
computes the maximum number of iterations by level nr
void layoutCurrentLevel()
calls the fast multipole embedder on current level
void writeCurrentToGraphAttributes(GraphAttributes &GA)
writes the current level to graph attributes. used for output
void createMultiLevelGraphs(Graph *pGraph, GraphAttributes &GA, const EdgeArray< float > &edgeLength)
creates all multilevels
void initFinestLevel(GraphAttributes &GA, const EdgeArray< float > &edgeLength)
init the original graphs multilevel
void call(GraphAttributes &GA) override
Calls the algorithm for graph GA and returns the layout information in GA.
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Interface of general layout algorithms.
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
the main global options for a run
Definition FMEFunc.h:66