Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

LayerBasedUPRLayout.h
Go to the documentation of this file.
1 
32 #pragma once
33 
42 
43 #include <memory>
44 
45 namespace ogdf {
46 
48 public:
49  OrderComparer(const UpwardPlanRep& _UPR, Hierarchy& _H);
50 
56  bool less(node vH1, node vH2) const;
57 
58 private:
62 #if 0
63  EdgeArray<int> outEdgeOrder;
64 #endif
66 
68  void dfs_LR(edge e, NodeArray<bool>& visited, NodeArray<int>& dfsNum, int& num);
69 
71  bool left(node vUPR1,
72  const List<edge>& chain1,
73  node vUPR2,
74  const List<edge>& chain2
75  ) const;
76 
83  bool left(edge e1UPR, edge e2UPR) const;
84 
92  bool left(List<edge>& chain1, List<edge>& chain2, int level) const;
93 
95  bool checkUp(node vUPR, int level) const;
96 };
97 
102 public:
103  // constructor: sets options to default values
105  // set default value
107  fhl->nodeDistance(40.0);
108  fhl->layerDistance(40.0);
109  fhl->fixedLayerDistance(true);
110  m_layout.reset(fhl);
111  OptimalRanking* opRank = new OptimalRanking();
112  opRank->separateMultiEdges(false);
113  m_ranking.reset(opRank);
114  m_numLevels = 0;
115  m_maxLevelSize = 0;
116  }
117 
118  // destructor
120 
121  // returns the number of crossings in the layout after the algorithm
122  // has been applied
123  int numberOfCrossings() const { return m_crossings; }
124 
125  // module option for the computation of the final layout
126  void setLayout(HierarchyLayoutModule* pLayout) { m_layout.reset(pLayout); }
127 
128  void setRanking(RankingModule* pRanking) { m_ranking.reset(pRanking); }
129 
131  void UPRLayoutSimple(const UpwardPlanRep& UPR, GraphAttributes& AG);
132 
134  int numberOfLayers() { return m_numLevels; }
135 
137  int maxLayerSize() { return m_maxLevelSize; }
138 
139 protected:
140  /*
141  * @param UPR is the upward planarized representation of the input graph.
142  * @param AG has to be assigned the hierarchy layout.
143  */
144  virtual void doCall(const UpwardPlanRep& UPR, GraphAttributes& AG) override;
145 
147 
148  std::unique_ptr<RankingModule> m_ranking;
149 
150  std::unique_ptr<HierarchyLayoutModule> m_layout;
151 
152 private:
153  // compute a ranking of the nodes of UPR.
154  // Precond. a ranking module muss be set
155  void computeRanking(const UpwardPlanRep& UPR, NodeArray<int>& rank);
156 
157 
159  void postProcessing_sourceReorder(HierarchyLevels& levels, List<node>& sources);
160 
162  void postProcessing_reduceLED(Hierarchy& H, HierarchyLevels& levels, const List<node>& sources) {
163  for (node s : sources) {
164  postProcessing_reduceLED(H, levels, s);
165  }
166  }
167 
168  void postProcessing_reduceLED(Hierarchy& H, HierarchyLevels& levels, node vH);
169 
170  void post_processing_reduce(Hierarchy& H, HierarchyLevels& levels, int& i, node s, int minIdx,
171  int maxIdx, NodeArray<bool>& markedNodes);
172 
174  void postProcessing_markUp(HierarchyLevels& levels, node sH, NodeArray<bool>& markedNodes);
175 
176 
178  void post_processing_deleteLvl(Hierarchy& H, HierarchyLevels& levels, int i);
179 
181  void post_processing_deleteInterval(Hierarchy& H, HierarchyLevels& levels, int beginIdx,
182  int endIdx, int& j);
183 
185  void post_processing_CopyInterval(Hierarchy& H, HierarchyLevels& levels, int i, int beginIdx,
186  int endIdx, int pos);
187 
191 
192 
195 
196  void callSimple(GraphAttributes& AG, adjEntry adj //left most edge of the source
197  );
198 
199  // needed for UPRLayoutSimple
200  void dfsSortLevels(adjEntry adj1, const NodeArray<int>& rank, Array<SListPure<node>>& nodes);
201 
202  // needed for UPRLayoutSimple
203  void longestPathRanking(const Graph& G, NodeArray<int>& rank);
204 
206 };
207 
208 }
ogdf::ArrayBuffer
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Definition: Array.h:46
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::FastHierarchyLayout::nodeDistance
double nodeDistance() const
Returns the option node distance.
Definition: FastHierarchyLayout.h:94
ogdf::OptimalRanking::separateMultiEdges
bool separateMultiEdges() const
Returns the current setting of option separateMultiEdges.
Definition: OptimalRanking.h:121
RankingModule.h
Declaration of interface for ranking algorithms.
ogdf::OptimalRanking
The optimal ranking algorithm.
Definition: OptimalRanking.h:75
ogdf::LayerBasedUPRLayout::setRanking
void setRanking(RankingModule *pRanking)
Definition: LayerBasedUPRLayout.h:128
ogdf::OrderComparer
Definition: LayerBasedUPRLayout.h:47
ogdf::OrderComparer::left
bool left(node vUPR1, const List< edge > &chain1, node vUPR2, const List< edge > &chain2) const
Returns true if vUPR1 is on the left-hand side of vUPR2 according to m_UPR.
ogdf::HierarchyLayoutModule
Interface of hierarchy layout algorithms.
Definition: HierarchyLayoutModule.h:47
ogdf::LayerBasedUPRLayout::m_ranking
std::unique_ptr< RankingModule > m_ranking
Definition: LayerBasedUPRLayout.h:148
ogdf::LayerBasedUPRLayout::m_crossings
int m_crossings
Definition: LayerBasedUPRLayout.h:146
ogdf::FastHierarchyLayout::fixedLayerDistance
bool fixedLayerDistance() const
Returns the option fixed layer distance.
Definition: FastHierarchyLayout.h:106
UpwardPlanRep.h
Declaration of a base class for planar representations of graphs and cluster graphs.
HierarchyLevels.h
Declaration of HierarchyLevels class.
ogdf::Hierarchy
Representation of proper hierarchies used by Sugiyama-layout.
Definition: Hierarchy.h:43
ogdf::UPRLayoutModule
Interface of hierarchy layout algorithms.
Definition: UPRLayoutModule.h:45
ogdf::RankingModule
Interface of algorithms for computing a node ranking.
Definition: RankingModule.h:44
ogdf::LayerBasedUPRLayout::m_layout
std::unique_ptr< HierarchyLayoutModule > m_layout
Definition: LayerBasedUPRLayout.h:150
ogdf::OrderComparer::less
bool less(node vH1, node vH2) const
Returns true iff vH1 and vH2 are placed on the same layer and node vH1 has to drawn on the left-hand ...
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:135
ogdf::OrderComparer::m_UPR
const UpwardPlanRep & m_UPR
Definition: LayerBasedUPRLayout.h:59
ogdf::LayerBasedUPRLayout::m_numLevels
int m_numLevels
Definition: LayerBasedUPRLayout.h:188
ogdf::LayerBasedUPRLayout::setLayout
void setLayout(HierarchyLayoutModule *pLayout)
Definition: LayerBasedUPRLayout.h:126
OptimalRanking.h
Declaration of optimal ranking algorithm for Sugiyama algorithm.
FastHierarchyLayout.h
declaration and implementation of the third phase of sugiyama
ogdf::OrderComparer::H
Hierarchy & H
Definition: LayerBasedUPRLayout.h:60
ogdf::LayerBasedUPRLayout
Definition: LayerBasedUPRLayout.h:101
ogdf::OrderComparer::checkUp
bool checkUp(node vUPR, int level) const
Returns true iff there is a node above vUPR with rank level or lower.
ogdf::LayerBasedUPRLayout::m_maxLevelSize
int m_maxLevelSize
Definition: LayerBasedUPRLayout.h:189
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:214
ogdf::FastHierarchyLayout::layerDistance
double layerDistance() const
Returns the option layer distance.
Definition: FastHierarchyLayout.h:100
ogdf::SListPure
Singly linked lists.
Definition: SList.h:39
ogdf::OrderComparer::crossed
NodeArray< bool > crossed
Definition: LayerBasedUPRLayout.h:65
ogdf::List< edge >
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:651
ogdf::OrderComparer::OrderComparer
OrderComparer(const UpwardPlanRep &_UPR, Hierarchy &_H)
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:862
ogdf::OrderComparer::m_dfsNum
NodeArray< int > m_dfsNum
Definition: LayerBasedUPRLayout.h:61
ogdf::LayerBasedUPRLayout::numberOfLayers
int numberOfLayers()
Return the number of layers/levels. Not implemented if use methode callSimple(..).
Definition: LayerBasedUPRLayout.h:134
ogdf::OrderComparer::dfs_LR
void dfs_LR(edge e, NodeArray< bool > &visited, NodeArray< int > &dfsNum, int &num)
Traverses with dfs using edge order from left to right and compute the dfs number.
ogdf::LayerBasedUPRLayout::~LayerBasedUPRLayout
~LayerBasedUPRLayout()
Definition: LayerBasedUPRLayout.h:119
ogdf::LayerBasedUPRLayout::m_dummies
ArrayBuffer< node > m_dummies
Definition: LayerBasedUPRLayout.h:190
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
UPRLayoutModule.h
Declaration of interface for layout algorithms for a UpwardPlanRep.
HierarchyLayoutModule.h
Declaration of interface hierarchy layout algorithms (3. phase of Sugiyama).
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
OptimalHierarchyLayout.h
Declaration and implementation of the optimal third phase of the Sugiyama algorithm.
ogdf::FastHierarchyLayout
Coordinate assignment phase for the Sugiyama algorithm by Buchheim et al.
Definition: FastHierarchyLayout.h:76
ogdf::UpwardPlanRep
Upward planarized representations (of a connected component) of a graph.
Definition: UpwardPlanRep.h:50
ogdf::LayerBasedUPRLayout::numberOfCrossings
int numberOfCrossings() const
Definition: LayerBasedUPRLayout.h:123
ogdf::LayerBasedUPRLayout::LayerBasedUPRLayout
LayerBasedUPRLayout()
Definition: LayerBasedUPRLayout.h:104
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::LayerBasedUPRLayout::postProcessing_reduceLED
void postProcessing_reduceLED(Hierarchy &H, HierarchyLevels &levels, const List< node > &sources)
reduce the long edge dummies (LED)
Definition: LayerBasedUPRLayout.h:162
ogdf::HierarchyLevels
Representation of proper hierarchies used by Sugiyama-layout.
Definition: HierarchyLevels.h:46
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:709
ogdf::LayerBasedUPRLayout::maxLayerSize
int maxLayerSize()
Return the max. number of elements on a layer. Not implemented if use methode callSimple(....
Definition: LayerBasedUPRLayout.h:137