Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

UpwardPlanarizationLayout.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
42 
43 #include <memory>
44 
45 namespace ogdf {
46 
48 public:
49  // constructor: sets options to default values
51  m_cr_nr = 0;
52  // set default module
53  m_layout.reset(new LayerBasedUPRLayout());
55  }
56 
57  // calls the algorithm for attributed graph GA
58  // returns layout information in GA
59  virtual void call(GraphAttributes& GA) override {
60  if (GA.constGraph().numberOfNodes() > 2) {
61  UpwardPlanRep UPR;
62  UPR.setOriginalGraph(GA.constGraph());
63  m_UpwardPlanarizer->call(UPR);
64  m_layout->call(UPR, GA);
65  m_cr_nr = UPR.numberOfCrossings();
66  m_numLevels = m_layout->numberOfLevels;
67  }
68  }
69 
70  // module option for the computation of the final layout
71  void setUPRLayout(UPRLayoutModule* pLayout) { m_layout.reset(pLayout); }
72 
73  void setUpwardPlanarizer(UpwardPlanarizerModule* pUpwardPlanarizer) {
74  m_UpwardPlanarizer.reset(pUpwardPlanarizer);
75  }
76 
77  // returns the number of crossings in the layout after the algorithm
78  // has been applied
79  int numberOfCrossings() const { return m_cr_nr; }
80 
81  int numberOfLevels() const { return m_numLevels; }
82 
83 protected:
84  int m_cr_nr;
86  std::unique_ptr<UpwardPlanarizerModule> m_UpwardPlanarizer;
87  std::unique_ptr<UPRLayoutModule> m_layout;
88 };
89 
90 }
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
GraphAttributes.h
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Graph.h
Includes declaration of graph class.
ogdf::UpwardPlanarizationLayout::setUpwardPlanarizer
void setUpwardPlanarizer(UpwardPlanarizerModule *pUpwardPlanarizer)
Definition: UpwardPlanarizationLayout.h:73
ogdf::SubgraphUpwardPlanarizer
Takes an acyclic connected non-upward-planar graph and planarizes it, i.e., we obtain an upward-plana...
Definition: SubgraphUpwardPlanarizer.h:70
ogdf::GraphCopy::setOriginalGraph
void setOriginalGraph(const Graph *G) override
Associates the graph copy with G, but does not create any nodes or edges.
ogdf::UpwardPlanarizationLayout::m_layout
std::unique_ptr< UPRLayoutModule > m_layout
Definition: UpwardPlanarizationLayout.h:87
ogdf::UpwardPlanarizationLayout
Definition: UpwardPlanarizationLayout.h:47
ogdf::UpwardPlanarizationLayout::numberOfCrossings
int numberOfCrossings() const
Definition: UpwardPlanarizationLayout.h:79
ogdf::UpwardPlanarizationLayout::m_numLevels
int m_numLevels
Definition: UpwardPlanarizationLayout.h:85
UpwardPlanRep.h
Declaration of a base class for planar representations of graphs and cluster graphs.
ogdf::UpwardPlanarizationLayout::m_cr_nr
int m_cr_nr
Definition: UpwardPlanarizationLayout.h:84
ogdf::UpwardPlanRep::numberOfCrossings
int numberOfCrossings() const
Definition: UpwardPlanRep.h:119
ogdf::UPRLayoutModule
Interface of hierarchy layout algorithms.
Definition: UPRLayoutModule.h:46
LayoutModule.h
Declaration of interface for layout algorithms (class LayoutModule)
ogdf::GraphAttributes::constGraph
const Graph & constGraph() const
Returns a reference to the associated graph.
Definition: GraphAttributes.h:223
SubgraphUpwardPlanarizer.h
Declaration of class SubgraphUpwardPlanarizer.
ogdf::LayerBasedUPRLayout
Definition: LayerBasedUPRLayout.h:109
ogdf::UpwardPlanarizationLayout::call
virtual void call(GraphAttributes &GA) override
Computes a layout of graph GA.
Definition: UpwardPlanarizationLayout.h:59
ogdf::Graph::numberOfNodes
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition: Graph_d.h:982
UPRLayoutModule.h
Declaration of interface for layout algorithms for a UpwardPlanRep.
ogdf::UpwardPlanarizationLayout::UpwardPlanarizationLayout
UpwardPlanarizationLayout()
Definition: UpwardPlanarizationLayout.h:50
LayerBasedUPRLayout.h
Declaration of upward planarization layout algorithm.
ogdf::UpwardPlanarizationLayout::setUPRLayout
void setUPRLayout(UPRLayoutModule *pLayout)
Definition: UpwardPlanarizationLayout.h:71
UpwardPlanarizerModule.h
Declaration of UpwardPlanarizer Module, an interface for upward planarization algorithms.
ogdf::UpwardPlanarizationLayout::m_UpwardPlanarizer
std::unique_ptr< UpwardPlanarizerModule > m_UpwardPlanarizer
Definition: UpwardPlanarizationLayout.h:86
ogdf::UpwardPlanarizerModule
Interface for upward planarization algorithms.
Definition: UpwardPlanarizerModule.h:46
ogdf::UpwardPlanarizationLayout::numberOfLevels
int numberOfLevels() const
Definition: UpwardPlanarizationLayout.h:81
ogdf::UpwardPlanRep
Upward planarized representations (of a connected component) of a graph.
Definition: UpwardPlanRep.h:57
ogdf::LayoutModule
Interface of general layout algorithms.
Definition: LayoutModule.h:45