Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

SugiyamaLayout.h
Go to the documentation of this file.
1 
32 #pragma once
33 
40 #include <memory>
43 
44 namespace ogdf {
45 
160 
161 #if 0
162  class CrossMinMaster;
163  class CrossMinWorker;
164 #endif
165 
166 protected:
167 
169  std::unique_ptr<RankingModule> m_ranking;
170 
172  std::unique_ptr<LayeredCrossMinModule> m_crossMin;
173 
174  std::unique_ptr<TwoLayerCrossMinSimDraw> m_crossMinSimDraw;
175 
177  std::unique_ptr<HierarchyLayoutModule> m_layout;
178 
180  std::unique_ptr<HierarchyClusterLayoutModule> m_clusterLayout;
181 
183  std::unique_ptr<CCLayoutPackModule> m_packer;
184 
185  int m_fails;
186  int m_runs;
187  bool m_transpose;
189  double m_minDistCC;
190  double m_pageRatio;
192  unsigned int m_maxThreads;
193 
197 
200 
202 
203 public:
204 
206  SugiyamaLayout();
207 
208  // destructor
210 
211 
222  virtual void call(GraphAttributes &GA) override;
223 
229  void call(ClusterGraphAttributes &CGA);
230 
239  void call(GraphAttributes &GA, NodeArray<int> &rank);
240 
241  // special call for UML graphs
242  void callUML(GraphAttributes &GA);
243 
244 
257  int fails() const { return m_fails; }
258 
260  void fails(int nFails) { m_fails = nFails; }
261 
270  int runs() const { return m_runs; }
271 
273  void runs(int nRuns) { m_runs = nRuns; }
274 
282  bool transpose() const { return m_transpose; }
283 
285  void transpose(bool bTranspose) { m_transpose = bTranspose; }
286 
293  bool arrangeCCs() const { return m_arrangeCCs; }
294 
296  void arrangeCCs(bool bArrange) { m_arrangeCCs = bArrange; }
297 
304  double minDistCC() const { return m_minDistCC; }
305 
307  void minDistCC(double x) { m_minDistCC = x; }
308 
316  double pageRatio() const { return m_pageRatio; }
317 
319  void pageRatio(double x) { m_pageRatio = x; }
320 
327  bool alignBaseClasses() const { return m_alignBaseClasses; }
328 
330  void alignBaseClasses(bool b) { m_alignBaseClasses = b; }
331 
338  bool alignSiblings() const { return m_alignSiblings; }
339 
341  void alignSiblings(bool b) { m_alignSiblings = b; }
342 
344  void setSubgraphs(EdgeArray<uint32_t> *esg) { m_subgraphs = esg; }
345 
347  bool useSubgraphs() const { return m_subgraphs != nullptr; }
348 
349  bool permuteFirst() const { return m_permuteFirst; }
350  void permuteFirst(bool b) { m_permuteFirst = b; }
351 
353  unsigned int maxThreads() const { return m_maxThreads; }
354 
356  void maxThreads(unsigned int n) {
357 #ifndef OGDF_MEMORY_POOL_NTS
358  m_maxThreads = n;
359 #endif
360  }
361 
362 
378  void setRanking(RankingModule *pRanking) {
379  m_ranking.reset(pRanking);
380  }
381 
389  m_crossMin.reset(pCrossMin);
390  }
391 
400  m_layout.reset(pLayout);
401  }
402 
411  m_clusterLayout.reset(pLayout);
412  }
413 
421  void setPacker(CCLayoutPackModule *pPacker) {
422  m_packer.reset(pPacker);
423  }
424 
431  int numberOfCrossings() const { return m_nCrossings; }
433 
435  RCCrossings numberOfCrossingsCluster() const { return m_nCrossingsCluster; }
436 
438  int numberOfLevels() { return m_numLevels; }
439 
441  int maxLevelSize() { return m_maxLevelSize; }
442 
443  double timeReduceCrossings() { return m_timeReduceCrossings; }
444 
445  // needed by LayerByLayerSweep::
446  const EdgeArray<uint32_t> *subgraphs() const { return m_subgraphs; };
447  int numCC() const { return m_numCC; };
448  const NodeArray<int>& compGC() const { return m_compGC; };
449 
450 protected:
451 
452 #if 0
453  void reduceCrossings(HierarchyLevels &levels);
454 #endif
455  void reduceCrossings(ExtendedNestingGraph &H);
456 
457  const HierarchyLevelsBase *reduceCrossings(Hierarchy &H);
458 
459 private:
460  int m_numCC;
462 
463  void doCall(GraphAttributes &AG, bool umlCall);
464  void doCall(GraphAttributes &AG, bool umlCall, NodeArray<int> &rank);
465 
466 #if 0
467  int traverseTopDown(HierarchyLevels &levels);
468  int traverseBottomUp(HierarchyLevels &levels);
469 
470  bool transposeLevel(int i, HierarchyLevels &levels);
471  void doTranspose(HierarchyLevels &levels);
472  void doTransposeRev(HierarchyLevels &levels);
473 #endif
474 
475 
479 
480  RCCrossings traverseTopDown (ExtendedNestingGraph &H);
481  RCCrossings traverseBottomUp(ExtendedNestingGraph &H);
482 };
483 
484 
485 }
int maxLevelSize()
Return the max. number of elements on a layer.
double pageRatio() const
Returns the current setting of option pageRation.
unsigned int m_maxThreads
The maximal number of used threads.
RCCrossings m_nCrossingsCluster
double m_pageRatio
Option for desired page ratio.
const NodeArray< int > & compGC() const
void setRanking(RankingModule *pRanking)
Sets the module option for the node ranking (layer assignment).
int runs() const
Returns the current setting of option runs.
Representation of proper hierarchies used by Sugiyama-layout.
void pageRatio(double x)
Sets the option pageRatio to x.
void alignBaseClasses(bool b)
Sets the option alignBaseClasses to b.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
bool m_arrangeCCs
Option for laying out components separately.
bool arrangeCCs() const
Returns the current setting of option arrangeCCs.
EdgeArray< uint32_t > * m_subgraphs
Defines the subgraphs for simultaneous drawing.
bool m_alignSiblings
Option for aligning siblings in inheritance trees.
Declaration of interface hierarchy layout algorithms (3.
void setCrossMin(LayeredCrossMinModule *pCrossMin)
Sets the module option for the two-layer crossing minimization.
void minDistCC(double x)
Sets the option minDistCC to x.
bool transpose() const
Returns the current setting of option transpose.
void setPacker(CCLayoutPackModule *pPacker)
Sets the module option for the arrangement of connected components.
std::unique_ptr< HierarchyLayoutModule > m_layout
the hierarchy layout module (final coordinate assignment)
std::unique_ptr< TwoLayerCrossMinSimDraw > m_crossMinSimDraw
Interface of crossing minimization algorithms for layered graphs.
int numberOfLevels()
Return the number of layers/levels}.
int m_runs
Option for number of runs.
int fails() const
Returns the current setting of option fails.
Sugiyama&#39;s layout algorithm.
int m_fails
Option for maximal number of fails.
Interface of hierarchy layout algorithms for cluster graphs.
bool useSubgraphs() const
Returns true iff subgraphs for simultaneous drawing are set.
RCCrossings numberOfCrossingsCluster() const
Returns the number of crossings in the computed layout (cluster graph).
unsigned int maxThreads() const
Returns the maximal number of used threads.
std::unique_ptr< CCLayoutPackModule > m_packer
The module for arranging connected components.
double minDistCC() const
Returns the current setting of option minDistCC (distance between components).
Stores additional attributes of a graph (like layout information).
Interface of hierarchy layout algorithms.
std::unique_ptr< LayeredCrossMinModule > m_crossMin
the module for two-layer crossing minimization
void setSubgraphs(EdgeArray< uint32_t > *esg)
Sets the subgraphs for simultaneous drawing.
Base class of algorithms that arrange/pack layouts of connected components.
void setClusterLayout(HierarchyClusterLayoutModule *pLayout)
Sets the module option for the computation of the final layout for clustered graphs.
Stores additional attributes of a clustered graph (like layout information).
bool m_alignBaseClasses
Option for aligning base classes.
std::unique_ptr< RankingModule > m_ranking
the ranking module (level assignment)
int m_nCrossings
Number of crossings in computed layout.
Declaration of interface for layout algorithms (class LayoutModule)
Declaration of interface for ranking algorithms.
bool permuteFirst() const
Declaration of interface for hierarchy layout algorithms (3.
NodeArray< int > m_compGC
Interface of general layout algorithms.
Definition: LayoutModule.h:44
void transpose(bool bTranspose)
Sets the option transpose to bTranspose.
Declares ClusterGraphAttributes, an extension of class GraphAttributes, to store clustergraph layout ...
void permuteFirst(bool b)
void arrangeCCs(bool bArrange)
Sets the options arrangeCCs to bArrange.
void setLayout(HierarchyLayoutModule *pLayout)
Sets the module option for the computation of the final layout.
bool m_transpose
Option for switching on transposal heuristic.
void alignSiblings(bool b)
Sets the option alignSiblings to b.
void maxThreads(unsigned int n)
Sets the maximal number of used threads to n.
Array< bool > m_levelChanged
Declaration of interface for two-layer crossing minimization algorithms for Simultaneous Drawing...
double m_minDistCC
Option for distance between connected components.
The namespace for all OGDF objects.
std::unique_ptr< HierarchyClusterLayoutModule > m_clusterLayout
the hierarchy cluster layout module (final coordinate assignment for clustered graphs) ...
bool alignSiblings() const
Returns the current setting of option alignSiblings.
void fails(int nFails)
Sets the option fails to nFails.
bool alignBaseClasses() const
Returns the current setting of option alignBaseClasses.
const EdgeArray< uint32_t > * subgraphs() const
Interface of algorithms for computing a node ranking.
Definition: RankingModule.h:45
void runs(int nRuns)
Sets the option runs to nRuns.
Representation of proper hierarchies used by Sugiyama-layout.
Definition: Hierarchy.h:44
Declaration of ExtendedNestingGraph.
Declaration of interface for algorithms that arrange/pack layouts of connected components.