Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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 
49 namespace ogdf {
50 class ClusterGraphAttributes;
51 class GraphAttributes;
52 class Hierarchy;
53 class HierarchyLevelsBase;
54 
169 #if 0
170  class CrossMinMaster;
171  class CrossMinWorker;
172 #endif
173 
174 protected:
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 
192  int m_fails;
193  int m_runs;
194  bool m_transpose;
196  double m_minDistCC;
197  double m_pageRatio;
199  unsigned int m_maxThreads;
200 
204 
207 
209 
210 public:
212  SugiyamaLayout();
213 
214  // destructor
216 
227  virtual void call(GraphAttributes& GA) override;
228 
234  void call(ClusterGraphAttributes& CGA);
235 
244  void call(GraphAttributes& GA, NodeArray<int>& rank);
245 
246  // special call for UML graphs
247  void callUML(GraphAttributes& GA);
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 
425  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 
446 protected:
447 #if 0
448  void reduceCrossings(HierarchyLevels &levels);
449 #endif
450  void reduceCrossings(ExtendedNestingGraph& H);
451 
452  const HierarchyLevelsBase* reduceCrossings(Hierarchy& H);
453 
454 private:
455  int m_numCC;
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 
475  RCCrossings traverseTopDown(ExtendedNestingGraph& H);
476  RCCrossings traverseBottomUp(ExtendedNestingGraph& H);
477 };
478 
479 
480 }
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::SugiyamaLayout::numCC
int numCC() const
Definition: SugiyamaLayout.h:442
ogdf::SugiyamaLayout::m_transpose
bool m_transpose
Option for switching on transposal heuristic.
Definition: SugiyamaLayout.h:194
Graph.h
Includes declaration of graph class.
ogdf::SugiyamaLayout::m_packer
std::unique_ptr< CCLayoutPackModule > m_packer
The module for arranging connected components.
Definition: SugiyamaLayout.h:190
ogdf::SugiyamaLayout::subgraphs
const EdgeArray< uint32_t > * subgraphs() const
Definition: SugiyamaLayout.h:440
RankingModule.h
Declaration of interface for ranking algorithms.
ogdf::SugiyamaLayout::alignSiblings
void alignSiblings(bool b)
Sets the option alignSiblings to b.
Definition: SugiyamaLayout.h:345
ogdf::SugiyamaLayout::minDistCC
double minDistCC() const
Returns the current setting of option minDistCC (distance between components).
Definition: SugiyamaLayout.h:308
ogdf::SugiyamaLayout::numberOfLevels
int numberOfLevels()
Return the number of layers/levels}.
Definition: SugiyamaLayout.h:432
ogdf::SugiyamaLayout::m_minDistCC
double m_minDistCC
Option for distance between connected components.
Definition: SugiyamaLayout.h:196
ogdf::HierarchyLayoutModule
Interface of hierarchy layout algorithms.
Definition: HierarchyLayoutModule.h:52
ogdf::SugiyamaLayout::fails
void fails(int nFails)
Sets the option fails to nFails.
Definition: SugiyamaLayout.h:264
ogdf::SugiyamaLayout::m_runs
int m_runs
Option for number of runs.
Definition: SugiyamaLayout.h:193
ogdf::SugiyamaLayout::permuteFirst
bool permuteFirst() const
Definition: SugiyamaLayout.h:353
ogdf::SugiyamaLayout::alignBaseClasses
bool alignBaseClasses() const
Returns the current setting of option alignBaseClasses.
Definition: SugiyamaLayout.h:331
ogdf::SugiyamaLayout::~SugiyamaLayout
~SugiyamaLayout()
Definition: SugiyamaLayout.h:215
ogdf::HierarchyClusterLayoutModule
Interface of hierarchy layout algorithms for cluster graphs.
Definition: HierarchyClusterLayoutModule.h:48
ogdf::Hierarchy
Representation of proper hierarchies used by Sugiyama-layout.
Definition: Hierarchy.h:47
ogdf::SugiyamaLayout::m_fails
int m_fails
Option for maximal number of fails.
Definition: SugiyamaLayout.h:192
ogdf::SugiyamaLayout::m_crossMin
std::unique_ptr< LayeredCrossMinModule > m_crossMin
the module for two-layer crossing minimization
Definition: SugiyamaLayout.h:179
LayoutModule.h
Declaration of interface for layout algorithms (class LayoutModule)
ogdf::SugiyamaLayout::runs
void runs(int nRuns)
Sets the option runs to nRuns.
Definition: SugiyamaLayout.h:277
ogdf::SugiyamaLayout::runs
int runs() const
Returns the current setting of option runs.
Definition: SugiyamaLayout.h:274
ogdf::HierarchyLevelsBase
Definition: CrossingMinInterfaces.h:63
ogdf::RankingModule
Interface of algorithms for computing a node ranking.
Definition: RankingModule.h:46
ogdf::SugiyamaLayout::useSubgraphs
bool useSubgraphs() const
Returns true iff subgraphs for simultaneous drawing are set.
Definition: SugiyamaLayout.h:351
ogdf::CCLayoutPackModule
Base class of algorithms that arrange/pack layouts of connected components.
Definition: CCLayoutPackModule.h:49
ogdf::SugiyamaLayout::m_permuteFirst
bool m_permuteFirst
Definition: SugiyamaLayout.h:198
ogdf::SugiyamaLayout::fails
int fails() const
Returns the current setting of option fails.
Definition: SugiyamaLayout.h:261
ogdf::SugiyamaLayout::arrangeCCs
void arrangeCCs(bool bArrange)
Sets the options arrangeCCs to bArrange.
Definition: SugiyamaLayout.h:300
ogdf::SugiyamaLayout::alignBaseClasses
void alignBaseClasses(bool b)
Sets the option alignBaseClasses to b.
Definition: SugiyamaLayout.h:334
ogdf::SugiyamaLayout::m_pageRatio
double m_pageRatio
Option for desired page ratio.
Definition: SugiyamaLayout.h:197
ogdf::SugiyamaLayout::m_alignBaseClasses
bool m_alignBaseClasses
Option for aligning base classes.
Definition: SugiyamaLayout.h:205
ogdf::SugiyamaLayout::transpose
void transpose(bool bTranspose)
Sets the option transpose to bTranspose.
Definition: SugiyamaLayout.h:289
ogdf::SugiyamaLayout::setCrossMin
void setCrossMin(LayeredCrossMinModule *pCrossMin)
Sets the module option for the two-layer crossing minimization.
Definition: SugiyamaLayout.h:390
ogdf::ClusterGraphAttributes
Stores additional attributes of a clustered graph (like layout information).
Definition: ClusterGraphAttributes.h:52
ogdf::SugiyamaLayout::setPacker
void setPacker(CCLayoutPackModule *pPacker)
Sets the module option for the arrangement of connected components.
Definition: SugiyamaLayout.h:417
ogdf::SugiyamaLayout::m_layout
std::unique_ptr< HierarchyLayoutModule > m_layout
the hierarchy layout module (final coordinate assignment)
Definition: SugiyamaLayout.h:184
ogdf::SugiyamaLayout::timeReduceCrossings
double timeReduceCrossings()
Definition: SugiyamaLayout.h:437
LayeredCrossMinModule.h
Declaration of interface for two-layer crossing minimization algorithms.
ogdf::SugiyamaLayout::m_subgraphs
EdgeArray< uint32_t > * m_subgraphs
Defines the subgraphs for simultaneous drawing.
Definition: SugiyamaLayout.h:208
ogdf::SugiyamaLayout::m_crossMinSimDraw
std::unique_ptr< TwoLayerCrossMinSimDraw > m_crossMinSimDraw
Definition: SugiyamaLayout.h:181
ogdf::SugiyamaLayout::setLayout
void setLayout(HierarchyLayoutModule *pLayout)
Sets the module option for the computation of the final layout.
Definition: SugiyamaLayout.h:399
ogdf::Array< bool >
HierarchyClusterLayoutModule.h
Declaration of interface for hierarchy layout algorithms (3. phase of Sugiyama) for cluster graphs.
CCLayoutPackModule.h
Declaration of interface for algorithms that arrange/pack layouts of connected components.
ogdf::SugiyamaLayout::maxThreads
unsigned int maxThreads() const
Returns the maximal number of used threads.
Definition: SugiyamaLayout.h:358
TwoLayerCrossMinSimDraw.h
Declaration of interface for two-layer crossing minimization algorithms for Simultaneous Drawing.
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::SugiyamaLayout::m_clusterLayout
std::unique_ptr< HierarchyClusterLayoutModule > m_clusterLayout
the hierarchy cluster layout module (final coordinate assignment for clustered graphs)
Definition: SugiyamaLayout.h:187
ogdf::SugiyamaLayout::m_numLevels
int m_numLevels
Definition: SugiyamaLayout.h:471
ogdf::SugiyamaLayout::minDistCC
void minDistCC(double x)
Sets the option minDistCC to x.
Definition: SugiyamaLayout.h:311
ogdf::SugiyamaLayout::transpose
bool transpose() const
Returns the current setting of option transpose.
Definition: SugiyamaLayout.h:286
ogdf::SugiyamaLayout::arrangeCCs
bool arrangeCCs() const
Returns the current setting of option arrangeCCs.
Definition: SugiyamaLayout.h:297
ogdf::SugiyamaLayout::m_levelChanged
Array< bool > m_levelChanged
Definition: SugiyamaLayout.h:203
ogdf::SugiyamaLayout::setSubgraphs
void setSubgraphs(EdgeArray< uint32_t > *esg)
Sets the subgraphs for simultaneous drawing.
Definition: SugiyamaLayout.h:348
ogdf::SugiyamaLayout::maxLevelSize
int maxLevelSize()
Return the max. number of elements on a layer.
Definition: SugiyamaLayout.h:435
ogdf::SugiyamaLayout::m_maxThreads
unsigned int m_maxThreads
The maximal number of used threads.
Definition: SugiyamaLayout.h:199
ogdf::SugiyamaLayout::maxThreads
void maxThreads(unsigned int n)
Sets the maximal number of used threads to n.
Definition: SugiyamaLayout.h:361
ogdf::SugiyamaLayout::compGC
const NodeArray< int > & compGC() const
Definition: SugiyamaLayout.h:444
ogdf::SugiyamaLayout
Sugiyama's layout algorithm.
Definition: SugiyamaLayout.h:168
ogdf::SugiyamaLayout::m_alignSiblings
bool m_alignSiblings
Option for aligning siblings in inheritance trees.
Definition: SugiyamaLayout.h:206
ogdf::SugiyamaLayout::alignSiblings
bool alignSiblings() const
Returns the current setting of option alignSiblings.
Definition: SugiyamaLayout.h:342
ogdf::SugiyamaLayout::pageRatio
void pageRatio(double x)
Sets the option pageRatio to x.
Definition: SugiyamaLayout.h:323
ogdf::SugiyamaLayout::m_numCC
int m_numCC
Definition: SugiyamaLayout.h:455
basic.h
Basic declarations, included by all source files.
ogdf::SugiyamaLayout::setRanking
void setRanking(RankingModule *pRanking)
Sets the module option for the node ranking (layer assignment).
Definition: SugiyamaLayout.h:382
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::SugiyamaLayout::m_timeReduceCrossings
double m_timeReduceCrossings
Definition: SugiyamaLayout.h:473
HierarchyLayoutModule.h
Declaration of interface hierarchy layout algorithms (3. phase of Sugiyama).
ogdf::SugiyamaLayout::m_nCrossings
int m_nCrossings
Number of crossings in computed layout.
Definition: SugiyamaLayout.h:201
Array.h
Declaration and implementation of Array class and Array algorithms.
ogdf::RCCrossings
Definition: ExtendedNestingGraph.h:49
ogdf::SugiyamaLayout::numberOfCrossingsCluster
RCCrossings numberOfCrossingsCluster() const
Returns the number of crossings in the computed layout (cluster graph).
Definition: SugiyamaLayout.h:429
ogdf::ExtendedNestingGraph
Definition: ExtendedNestingGraph.h:302
ogdf::LayeredCrossMinModule
Interface of crossing minimization algorithms for layered graphs.
Definition: LayeredCrossMinModule.h:56
ogdf::SugiyamaLayout::permuteFirst
void permuteFirst(bool b)
Definition: SugiyamaLayout.h:355
ogdf::SugiyamaLayout::setClusterLayout
void setClusterLayout(HierarchyClusterLayoutModule *pLayout)
Sets the module option for the computation of the final layout for clustered graphs.
Definition: SugiyamaLayout.h:408
ogdf::SugiyamaLayout::m_nCrossingsCluster
RCCrossings m_nCrossingsCluster
Definition: SugiyamaLayout.h:202
ogdf::SugiyamaLayout::m_arrangeCCs
bool m_arrangeCCs
Option for laying out components separately.
Definition: SugiyamaLayout.h:195
ogdf::SugiyamaLayout::m_ranking
std::unique_ptr< RankingModule > m_ranking
the ranking module (level assignment)
Definition: SugiyamaLayout.h:176
ExtendedNestingGraph.h
Declaration of ExtendedNestingGraph.
ogdf::SugiyamaLayout::pageRatio
double pageRatio() const
Returns the current setting of option pageRation.
Definition: SugiyamaLayout.h:320
ogdf::SugiyamaLayout::m_compGC
NodeArray< int > m_compGC
Definition: SugiyamaLayout.h:456
ogdf::SugiyamaLayout::m_maxLevelSize
int m_maxLevelSize
Definition: SugiyamaLayout.h:472
ogdf::HierarchyLevels
Representation of proper hierarchies used by Sugiyama-layout.
Definition: HierarchyLevels.h:51
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