Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
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
45namespace ogdf {
46
48public:
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;
63 m_UpwardPlanarizer->call(UPR);
64 m_layout->call(UPR, GA);
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
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
83protected:
86 std::unique_ptr<UpwardPlanarizerModule> m_UpwardPlanarizer;
87 std::unique_ptr<UPRLayoutModule> m_layout;
88};
89
90}
Includes declaration of graph class.
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Declaration of upward planarization layout algorithm.
Declaration of interface for layout algorithms (class LayoutModule)
Declaration of class SubgraphUpwardPlanarizer.
Declaration of interface for layout algorithms for a UpwardPlanRep.
Declaration of a base class for planar representations of graphs and cluster graphs.
Declaration of UpwardPlanarizer Module, an interface for upward planarization algorithms.
Stores additional attributes of a graph (like layout information).
const Graph & constGraph() const
Returns a reference to the associated graph.
void setOriginalGraph(const Graph *G) override
Associates the graph copy with G, but does not create any nodes or edges.
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition Graph_d.h:979
Interface of general layout algorithms.
Takes an acyclic connected non-upward-planar graph and planarizes it, i.e., we obtain an upward-plana...
Interface of hierarchy layout algorithms.
Upward planarized representations (of a connected component) of a graph.
int numberOfCrossings() const
std::unique_ptr< UPRLayoutModule > m_layout
void setUpwardPlanarizer(UpwardPlanarizerModule *pUpwardPlanarizer)
virtual void call(GraphAttributes &GA) override
Computes a layout of graph GA.
void setUPRLayout(UPRLayoutModule *pLayout)
std::unique_ptr< UpwardPlanarizerModule > m_UpwardPlanarizer
Interface for upward planarization algorithms.
The namespace for all OGDF objects.