Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

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