Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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 
45 namespace ogdf {
46 class GraphAttributes;
47 
49 
58 
59 public:
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 
103 private:
104  void initOptions();
105 
106  void runMultipole();
107 
108  void runSingle();
109 
111  void run(uint32_t numIterations);
112 
114  void allocate(uint32_t numNodes, uint32_t numEdges);
115 
117  void deallocate();
118 
119  uint32_t m_numIterations;
120 
122 
124 
126 
128 
130 
132 
134 
136 
138 };
139 
141 
147 
148 public:
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 
161 private:
163  void computeAutoEdgeLength(const GraphAttributes& GA, EdgeArray<float>& edgeLength,
164  float factor = 1.0f);
165 
167  void run(GraphAttributes& GA, const EdgeArray<float>& edgeLength);
168 
170  void createMultiLevelGraphs(Graph* pGraph, GraphAttributes& GA,
171  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 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
ogdf::FastMultipoleMultilevelEmbedder::m_iCurrentLevelNr
int m_iCurrentLevelNr
Definition: FastMultipoleEmbedder.h:214
GalaxyMultilevel.h
Declaration of class GalaxyMultilevelBuilder.
Graph.h
Includes declaration of graph class.
ogdf::fast_multipole_embedder::ArrayGraph
Definition: ArrayGraph.h:46
ogdf::FastMultipoleMultilevelEmbedder::m_multiLevelNumNodesBound
int m_multiLevelNumNodesBound
Definition: FastMultipoleEmbedder.h:202
ogdf::FastMultipoleMultilevelEmbedder
The fast multipole multilevel embedder approach for force-directed multilevel layout.
Definition: FastMultipoleEmbedder.h:144
ogdf::FastMultipoleEmbedder::setRandomize
void setRandomize(bool b)
if true, layout algorithm will randomize the layout in the beginning
Definition: FastMultipoleEmbedder.h:84
ogdf::FastMultipoleEmbedder
The fast multipole embedder approach for force-directed layout.
Definition: FastMultipoleEmbedder.h:52
ogdf::FastMultipoleEmbedder::m_maxNumberOfThreads
uint32_t m_maxNumberOfThreads
Definition: FastMultipoleEmbedder.h:137
ogdf::FastMultipoleEmbedder::m_numberOfThreads
uint32_t m_numberOfThreads
Definition: FastMultipoleEmbedder.h:135
ogdf::FastMultipoleEmbedder::setDefaultEdgeLength
void setDefaultEdgeLength(float edgeLength)
Definition: FastMultipoleEmbedder.h:87
ogdf::FastMultipoleEmbedder::m_threadPool
FMEThreadPool * m_threadPool
Definition: FastMultipoleEmbedder.h:123
LayoutModule.h
Declaration of interface for layout algorithms (class LayoutModule)
ArrayGraph.h
Declaration of class ArrayGraph.
ogdf::fast_multipole_embedder::FMESingleKernel
Definition: FMEKernel.h:246
ogdf::fast_multipole_embedder::FMEThreadPool
Definition: FMEThread.h:127
ogdf::FastMultipoleEmbedder::m_pGraph
ArrayGraph * m_pGraph
Definition: FastMultipoleEmbedder.h:121
ogdf::FastMultipoleMultilevelEmbedder::multilevelUntilNumNodesAreLess
void multilevelUntilNumNodesAreLess(int nodesBound)
sets the bound for the number of nodes for multilevel step
Definition: FastMultipoleEmbedder.h:157
FMEFunc.h
Definitions of various auxiliary classes for FME layout.
ogdf::fast_multipole_embedder::GalaxyMultilevel
Definition: GalaxyMultilevel.h:46
ogdf::fast_multipole_embedder::FMEGlobalOptions
the main global options for a run
Definition: FMEFunc.h:73
ogdf::fast_multipole_embedder::FMEGlobalContext
Global Context.
Definition: FMEFunc.h:101
ogdf::FastMultipoleMultilevelEmbedder::m_iNumLevels
int m_iNumLevels
Definition: FastMultipoleEmbedder.h:201
ogdf::FastMultipoleEmbedder::setNumberOfThreads
void setNumberOfThreads(uint32_t numThreads)
Definition: FastMultipoleEmbedder.h:93
ogdf::FastMultipoleMultilevelEmbedder::maxNumThreads
void maxNumThreads(int numThreads)
Definition: FastMultipoleEmbedder.h:159
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::FastMultipoleEmbedder::setMultipolePrec
void setMultipolePrec(uint32_t precision)
sets the number of coefficients for the expansions. default = 4
Definition: FastMultipoleEmbedder.h:81
ogdf::FastMultipoleEmbedder::m_precisionParameter
uint32_t m_precisionParameter
Definition: FastMultipoleEmbedder.h:127
ogdf::FastMultipoleEmbedder::m_numIterations
uint32_t m_numIterations
Definition: FastMultipoleEmbedder.h:119
ogdf::FastMultipoleEmbedder::m_pOptions
FMEGlobalOptions * m_pOptions
Definition: FastMultipoleEmbedder.h:125
ogdf::FastMultipoleMultilevelEmbedder::m_adjustedNodeSize
NodeArray< float > m_adjustedNodeSize
Definition: FastMultipoleEmbedder.h:213
basic.h
Basic declarations, included by all source files.
ogdf::FastMultipoleMultilevelEmbedder::FastMultipoleMultilevelEmbedder
FastMultipoleMultilevelEmbedder()
Constructor, just sets number of maximum threads.
Definition: FastMultipoleEmbedder.h:150
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::FastMultipoleEmbedder::m_randomize
bool m_randomize
Definition: FastMultipoleEmbedder.h:129
ogdf::FastMultipoleEmbedder::setNumIterations
void setNumIterations(uint32_t numIterations)
sets the maximum number of iterations
Definition: FastMultipoleEmbedder.h:78
ogdf::FastMultipoleEmbedder::m_defaultEdgeLength
float m_defaultEdgeLength
Definition: FastMultipoleEmbedder.h:131
FMEKernel.h
Declaration of FME kernel.
ogdf::FastMultipoleEmbedder::m_defaultNodeSize
float m_defaultNodeSize
Definition: FastMultipoleEmbedder.h:133
ogdf::fast_multipole_embedder::GalaxyMultilevelBuilder
Definition: GalaxyMultilevel.h:92
ogdf::FastMultipoleMultilevelEmbedder::m_iMaxNumThreads
int m_iMaxNumThreads
Definition: FastMultipoleEmbedder.h:200
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716
ogdf::LayoutModule
Interface of general layout algorithms.
Definition: LayoutModule.h:45
FMEThread.h
Declaration of class FMEThread.
ogdf::FastMultipoleEmbedder::setDefaultNodeSize
void setDefaultNodeSize(float nodeSize)
Definition: FastMultipoleEmbedder.h:90