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>
36#include <ogdf/basic/basic.h>
42
43#include <cstdint>
44
45namespace ogdf {
46class GraphAttributes;
47
49
58
59public:
62
65
67 void call(const Graph& G, NodeArray<float>& nodeXPosition, NodeArray<float>& nodeYPosition,
68 const EdgeArray<float>& edgeLength, const NodeArray<float>& nodeSize);
69
71 void call(GraphAttributes& GA, const EdgeArray<float>& edgeLength,
72 const NodeArray<float>& nodeSize);
73
75 virtual void call(GraphAttributes& GA) override;
76
78 void setNumIterations(uint32_t numIterations) { m_numIterations = numIterations; }
79
81 void setMultipolePrec(uint32_t precision) { m_precisionParameter = precision; }
82
84 void setRandomize(bool b) { m_randomize = b; }
85
87 void setDefaultEdgeLength(float edgeLength) { m_defaultEdgeLength = edgeLength; }
88
90 void setDefaultNodeSize(float nodeSize) { m_defaultNodeSize = nodeSize; }
91
93 void setNumberOfThreads(uint32_t numThreads) {
94#ifndef OGDF_MEMORY_POOL_NTS
95 m_maxNumberOfThreads = numThreads;
96#endif
97 }
98
99#if 0
100 void setEnablePostProcessing(bool b) { m_doPostProcessing = b; }
101#endif
102
103private:
105
107
108 void runSingle();
109
111 void run(uint32_t numIterations);
112
114 void allocate(uint32_t numNodes, uint32_t numEdges);
115
118
120
122
124
126
128
130
132
134
136
138};
139
141
147
148public:
151 : m_iMaxNumThreads(1), m_iNumLevels(0), m_multiLevelNumNodesBound(10), m_iCurrentLevelNr(-1) { }
152
154 void call(GraphAttributes& GA) override;
155
157 void multilevelUntilNumNodesAreLess(int nodesBound) { m_multiLevelNumNodesBound = nodesBound; }
158
159 void maxNumThreads(int numThreads) { m_iMaxNumThreads = numThreads; }
160
161private:
164 float factor = 1.0f);
165
167 void run(GraphAttributes& GA, const EdgeArray<float>& edgeLength);
168
171 const EdgeArray<float>& edgeLength);
172
175
178
181
184
186 void nextLevel();
187
190
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}
Declaration of class ArrayGraph.
Definitions of various auxiliary classes for FME layout.
Declaration of FME kernel.
Declaration of class FMEThread.
Declaration of class GalaxyMultilevelBuilder.
Includes declaration of graph class.
Declaration of interface for layout algorithms (class LayoutModule)
Basic declarations, included by all source files.
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:866
Interface of general layout algorithms.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
#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.
the main global options for a run
Definition FMEFunc.h:73