Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

UpwardPlanarizationLayout.h
Go to the documentation of this file.
1 
32 #pragma once
33 
38 
39 namespace ogdf {
40 
42 public:
43  // constructor: sets options to default values
45  m_cr_nr = 0;
46  // set default module
47  m_layout.reset(new LayerBasedUPRLayout());
49  }
50 
51  // calls the algorithm for attributed graph GA
52  // returns layout information in GA
53  virtual void call(GraphAttributes& GA) override {
54  if (GA.constGraph().numberOfNodes() > 2) {
55  UpwardPlanRep UPR;
56  UPR.setOriginalGraph(GA.constGraph());
57  m_UpwardPlanarizer->call(UPR);
58  m_layout->call(UPR, GA);
59  m_cr_nr = UPR.numberOfCrossings();
60  m_numLevels = m_layout->numberOfLevels;
61  }
62  }
63 
64  // module option for the computation of the final layout
65  void setUPRLayout(UPRLayoutModule* pLayout) { m_layout.reset(pLayout); }
66 
67  void setUpwardPlanarizer(UpwardPlanarizerModule* pUpwardPlanarizer) {
68  m_UpwardPlanarizer.reset(pUpwardPlanarizer);
69  }
70 
71  // returns the number of crossings in the layout after the algorithm
72  // has been applied
73  int numberOfCrossings() const { return m_cr_nr; }
74 
75  int numberOfLevels() const { return m_numLevels; }
76 
77 protected:
78  int m_cr_nr;
80  std::unique_ptr<UpwardPlanarizerModule> m_UpwardPlanarizer;
81  std::unique_ptr<UPRLayoutModule> m_layout;
82 };
83 
84 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:66
ogdf::UpwardPlanarizationLayout::setUpwardPlanarizer
void setUpwardPlanarizer(UpwardPlanarizerModule *pUpwardPlanarizer)
Definition: UpwardPlanarizationLayout.h:67
ogdf::SubgraphUpwardPlanarizer
Takes an acyclic connected non-upward-planar graph and planarizes it, i.e., we obtain an upward-plana...
Definition: SubgraphUpwardPlanarizer.h:67
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:81
ogdf::UpwardPlanarizationLayout
Definition: UpwardPlanarizationLayout.h:41
ogdf::UpwardPlanarizationLayout::numberOfCrossings
int numberOfCrossings() const
Definition: UpwardPlanarizationLayout.h:73
ogdf::UpwardPlanarizationLayout::m_numLevels
int m_numLevels
Definition: UpwardPlanarizationLayout.h:79
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:78
ogdf::UpwardPlanRep::numberOfCrossings
int numberOfCrossings() const
Definition: UpwardPlanRep.h:112
ogdf::UPRLayoutModule
Interface of hierarchy layout algorithms.
Definition: UPRLayoutModule.h:45
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:217
SubgraphUpwardPlanarizer.h
Declaration of class SubgraphUpwardPlanarizer.
ogdf::LayerBasedUPRLayout
Definition: LayerBasedUPRLayout.h:101
ogdf::UpwardPlanarizationLayout::call
virtual void call(GraphAttributes &GA) override
Computes a layout of graph GA.
Definition: UpwardPlanarizationLayout.h:53
ogdf::Graph::numberOfNodes
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition: Graph_d.h:974
ogdf::UpwardPlanarizationLayout::UpwardPlanarizationLayout
UpwardPlanarizationLayout()
Definition: UpwardPlanarizationLayout.h:44
LayerBasedUPRLayout.h
Declaration of upward planarization layout algorithm.
ogdf::UpwardPlanarizationLayout::setUPRLayout
void setUPRLayout(UPRLayoutModule *pLayout)
Definition: UpwardPlanarizationLayout.h:65
ogdf::UpwardPlanarizationLayout::m_UpwardPlanarizer
std::unique_ptr< UpwardPlanarizerModule > m_UpwardPlanarizer
Definition: UpwardPlanarizationLayout.h:80
ogdf::UpwardPlanarizerModule
Interface for upward planarization algorithms.
Definition: UpwardPlanarizerModule.h:43
ogdf::UpwardPlanarizationLayout::numberOfLevels
int numberOfLevels() const
Definition: UpwardPlanarizationLayout.h:75
ogdf::UpwardPlanRep
Upward planarized representations (of a connected component) of a graph.
Definition: UpwardPlanRep.h:50
ogdf::LayoutModule
Interface of general layout algorithms.
Definition: LayoutModule.h:44