Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
SugiyamaLayout.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>
37#include <ogdf/basic/basic.h>
45
46#include <cstdint>
47#include <memory>
48
49namespace ogdf {
50class ClusterGraphAttributes;
51class GraphAttributes;
52class Hierarchy;
53class HierarchyLevelsBase;
54
169#if 0
170 class CrossMinMaster;
171 class CrossMinWorker;
172#endif
173
174protected:
176 std::unique_ptr<RankingModule> m_ranking;
177
179 std::unique_ptr<LayeredCrossMinModule> m_crossMin;
180
181 std::unique_ptr<TwoLayerCrossMinSimDraw> m_crossMinSimDraw;
182
184 std::unique_ptr<HierarchyLayoutModule> m_layout;
185
187 std::unique_ptr<HierarchyClusterLayoutModule> m_clusterLayout;
188
190 std::unique_ptr<CCLayoutPackModule> m_packer;
191
193 int m_runs;
196 double m_minDistCC;
197 double m_pageRatio;
199 unsigned int m_maxThreads;
200
204
207
209
210public:
213
214 // destructor
216
227 virtual void call(GraphAttributes& GA) override;
228
235
245
246 // special call for UML graphs
248
261 int fails() const { return m_fails; }
262
264 void fails(int nFails) { m_fails = nFails; }
265
274 int runs() const { return m_runs; }
275
277 void runs(int nRuns) { m_runs = nRuns; }
278
286 bool transpose() const { return m_transpose; }
287
289 void transpose(bool bTranspose) { m_transpose = bTranspose; }
290
297 bool arrangeCCs() const { return m_arrangeCCs; }
298
300 void arrangeCCs(bool bArrange) { m_arrangeCCs = bArrange; }
301
308 double minDistCC() const { return m_minDistCC; }
309
311 void minDistCC(double x) { m_minDistCC = x; }
312
320 double pageRatio() const { return m_pageRatio; }
321
323 void pageRatio(double x) { m_pageRatio = x; }
324
331 bool alignBaseClasses() const { return m_alignBaseClasses; }
332
334 void alignBaseClasses(bool b) { m_alignBaseClasses = b; }
335
342 bool alignSiblings() const { return m_alignSiblings; }
343
345 void alignSiblings(bool b) { m_alignSiblings = b; }
346
348 void setSubgraphs(EdgeArray<uint32_t>* esg) { m_subgraphs = esg; }
349
351 bool useSubgraphs() const { return m_subgraphs != nullptr; }
352
353 bool permuteFirst() const { return m_permuteFirst; }
354
355 void permuteFirst(bool b) { m_permuteFirst = b; }
356
358 unsigned int maxThreads() const { return m_maxThreads; }
359
361 void maxThreads(unsigned int n) {
362#ifndef OGDF_MEMORY_POOL_NTS
363 m_maxThreads = n;
364#endif
365 }
366
382 void setRanking(RankingModule* pRanking) { m_ranking.reset(pRanking); }
383
390 void setCrossMin(LayeredCrossMinModule* pCrossMin) { m_crossMin.reset(pCrossMin); }
391
399 void setLayout(HierarchyLayoutModule* pLayout) { m_layout.reset(pLayout); }
400
408 void setClusterLayout(HierarchyClusterLayoutModule* pLayout) { m_clusterLayout.reset(pLayout); }
409
417 void setPacker(CCLayoutPackModule* pPacker) { m_packer.reset(pPacker); }
418
426 int numberOfCrossings() const { return m_nCrossings; }
427
429 RCCrossings numberOfCrossingsCluster() const { return m_nCrossingsCluster; }
430
432 int numberOfLevels() { return m_numLevels; }
433
435 int maxLevelSize() { return m_maxLevelSize; }
436
437 double timeReduceCrossings() { return m_timeReduceCrossings; }
438
439 // needed by LayerByLayerSweep::
440 const EdgeArray<uint32_t>* subgraphs() const { return m_subgraphs; };
441
442 int numCC() const { return m_numCC; };
443
444 const NodeArray<int>& compGC() const { return m_compGC; };
445
446protected:
447#if 0
448 void reduceCrossings(HierarchyLevels &levels);
449#endif
451
453
454private:
457
458 void doCall(GraphAttributes& AG, bool umlCall);
459 void doCall(GraphAttributes& AG, bool umlCall, NodeArray<int>& rank);
460
461#if 0
462 int traverseTopDown(HierarchyLevels &levels);
463 int traverseBottomUp(HierarchyLevels &levels);
464
465 bool transposeLevel(int i, HierarchyLevels &levels);
466 void doTranspose(HierarchyLevels &levels);
467 void doTransposeRev(HierarchyLevels &levels);
468#endif
469
470
474
477};
478
479
480}
Declaration and implementation of Array class and Array algorithms.
Declaration of interface for algorithms that arrange/pack layouts of connected components.
Declaration of ExtendedNestingGraph.
Includes declaration of graph class.
Declaration of interface for hierarchy layout algorithms (3.
Declaration of interface hierarchy layout algorithms (3.
Declaration of interface for two-layer crossing minimization algorithms.
Declaration of interface for layout algorithms (class LayoutModule)
Declaration of interface for ranking algorithms.
Declaration of interface for two-layer crossing minimization algorithms for Simultaneous Drawing.
Basic declarations, included by all source files.
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:219
Base class of algorithms that arrange/pack layouts of connected components.
Stores additional attributes of a clustered graph (like layout information).
Stores additional attributes of a graph (like layout information).
Interface of hierarchy layout algorithms for cluster graphs.
Representation of proper hierarchies used by Sugiyama-layout.
Definition Hierarchy.h:47
Interface of hierarchy layout algorithms.
Representation of proper hierarchies used by Sugiyama-layout.
Interface of crossing minimization algorithms for layered graphs.
Interface of general layout algorithms.
Interface of algorithms for computing a node ranking.
Sugiyama's layout algorithm.
void setLayout(HierarchyLayoutModule *pLayout)
Sets the module option for the computation of the final layout.
const NodeArray< int > & compGC() const
double m_pageRatio
Option for desired page ratio.
int m_runs
Option for number of runs.
int maxLevelSize()
Return the max. number of elements on a layer.
int m_nCrossings
Number of crossings in computed layout.
void call(ClusterGraphAttributes &CGA)
Calls the layout algorithm for clustered graph CGA.
void arrangeCCs(bool bArrange)
Sets the options arrangeCCs to bArrange.
double minDistCC() const
Returns the current setting of option minDistCC (distance between components).
int fails() const
Returns the current setting of option fails.
std::unique_ptr< TwoLayerCrossMinSimDraw > m_crossMinSimDraw
void alignSiblings(bool b)
Sets the option alignSiblings to b.
void permuteFirst(bool b)
double pageRatio() const
Returns the current setting of option pageRation.
int numberOfCrossings() const
Returns the number of crossings in the computed layout (usual graph).
void maxThreads(unsigned int n)
Sets the maximal number of used threads to n.
RCCrossings traverseBottomUp(ExtendedNestingGraph &H)
void setPacker(CCLayoutPackModule *pPacker)
Sets the module option for the arrangement of connected components.
bool m_alignSiblings
Option for aligning siblings in inheritance trees.
bool arrangeCCs() const
Returns the current setting of option arrangeCCs.
unsigned int maxThreads() const
Returns the maximal number of used threads.
RCCrossings traverseTopDown(ExtendedNestingGraph &H)
std::unique_ptr< RankingModule > m_ranking
the ranking module (level assignment)
bool useSubgraphs() const
Returns true iff subgraphs for simultaneous drawing are set.
unsigned int m_maxThreads
The maximal number of used threads.
RCCrossings numberOfCrossingsCluster() const
Returns the number of crossings in the computed layout (cluster graph).
std::unique_ptr< LayeredCrossMinModule > m_crossMin
the module for two-layer crossing minimization
void doCall(GraphAttributes &AG, bool umlCall, NodeArray< int > &rank)
void runs(int nRuns)
Sets the option runs to nRuns.
bool m_arrangeCCs
Option for laying out components separately.
void minDistCC(double x)
Sets the option minDistCC to x.
bool m_alignBaseClasses
Option for aligning base classes.
const HierarchyLevelsBase * reduceCrossings(Hierarchy &H)
bool alignBaseClasses() const
Returns the current setting of option alignBaseClasses.
std::unique_ptr< CCLayoutPackModule > m_packer
The module for arranging connected components.
void setCrossMin(LayeredCrossMinModule *pCrossMin)
Sets the module option for the two-layer crossing minimization.
RCCrossings m_nCrossingsCluster
int runs() const
Returns the current setting of option runs.
bool m_transpose
Option for switching on transposal heuristic.
std::unique_ptr< HierarchyLayoutModule > m_layout
the hierarchy layout module (final coordinate assignment)
void reduceCrossings(ExtendedNestingGraph &H)
virtual void call(GraphAttributes &GA) override
Calls the layout algorithm for graph GA.
void alignBaseClasses(bool b)
Sets the option alignBaseClasses to b.
int numberOfLevels()
Return the number of layers/levels}.
void pageRatio(double x)
Sets the option pageRatio to x.
void callUML(GraphAttributes &GA)
std::unique_ptr< HierarchyClusterLayoutModule > m_clusterLayout
the hierarchy cluster layout module (final coordinate assignment for clustered graphs)
bool permuteFirst() const
void fails(int nFails)
Sets the option fails to nFails.
EdgeArray< uint32_t > * m_subgraphs
Defines the subgraphs for simultaneous drawing.
Array< bool > m_levelChanged
bool transpose() const
Returns the current setting of option transpose.
void setClusterLayout(HierarchyClusterLayoutModule *pLayout)
Sets the module option for the computation of the final layout for clustered graphs.
void setSubgraphs(EdgeArray< uint32_t > *esg)
Sets the subgraphs for simultaneous drawing.
void setRanking(RankingModule *pRanking)
Sets the module option for the node ranking (layer assignment).
const EdgeArray< uint32_t > * subgraphs() const
double m_minDistCC
Option for distance between connected components.
NodeArray< int > m_compGC
SugiyamaLayout()
Creates an instance of SugiyamaLayout and sets options to default values.
void call(GraphAttributes &GA, NodeArray< int > &rank)
Calls the layout algorithm for graph GA with a given level assignment.
bool alignSiblings() const
Returns the current setting of option alignSiblings.
void transpose(bool bTranspose)
Sets the option transpose to bTranspose.
int m_fails
Option for maximal number of fails.
void doCall(GraphAttributes &AG, bool umlCall)
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.