Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
LayerBasedUPRLayout.h
Go to the documentation of this file.
1
32#pragma once
33
42
43#include <memory>
44
45namespace ogdf {
46
48public:
50
56 bool less(node vH1, node vH2) const;
57
58private:
62#if 0
64#endif
66
68 void dfs_LR(edge e, NodeArray<bool>& visited, NodeArray<int>& dfsNum, int& num);
69
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
102public:
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);
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
132
134 int numberOfLayers() { return m_numLevels; }
135
137 int maxLayerSize() { return m_maxLevelSize; }
138
139protected:
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
152private:
153 // compute a ranking of the nodes of UPR.
154 // Precond. a ranking module muss be set
156
157
160
163 for (node s : sources) {
164 postProcessing_reduceLED(H, levels, s);
165 }
166 }
167
169
172
175
176
179
182 int endIdx, int& j);
183
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
201
202 // needed for UPRLayoutSimple
204
206};
207
208}
declaration and implementation of the third phase of sugiyama
Declaration of interface hierarchy layout algorithms (3.
Declaration of HierarchyLevels class.
Declaration and implementation of the optimal third phase of the Sugiyama algorithm.
Declaration of optimal ranking algorithm for Sugiyama algorithm.
Declaration of interface for ranking algorithms.
Declaration of interface for layout algorithms for a UpwardPlanRep.
Declaration of a base class for planar representations of graphs and cluster graphs.
Class for adjacency list elements.
Definition Graph_d.h:79
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Definition ArrayBuffer.h:56
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:214
Dynamic arrays indexed with edges.
Definition EdgeArray.h:125
Class for the representation of edges.
Definition Graph_d.h:300
Coordinate assignment phase for the Sugiyama algorithm by Buchheim et al.
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Representation of proper hierarchies used by Sugiyama-layout.
Definition Hierarchy.h:43
Interface of hierarchy layout algorithms.
Representation of proper hierarchies used by Sugiyama-layout.
std::unique_ptr< RankingModule > m_ranking
void post_processing_reduce(Hierarchy &H, HierarchyLevels &levels, int &i, node s, int minIdx, int maxIdx, NodeArray< bool > &markedNodes)
void postProcessing_reduceLED(Hierarchy &H, HierarchyLevels &levels, const List< node > &sources)
reduce the long edge dummies (LED)
virtual void doCall(const UpwardPlanRep &UPR, GraphAttributes &AG) override
Implements the actual algorithm call.
void post_processing_CopyInterval(Hierarchy &H, HierarchyLevels &levels, int i, int beginIdx, int endIdx, int pos)
insert the interval [beginIdx,endIdx] of level i-1 to level i at position pos.
void UPRLayoutSimple(const UpwardPlanRep &UPR, GraphAttributes &AG)
Use only the 3. phase of Sugiyama' framework for layout.
int numberOfLayers()
Return the number of layers/levels. Not implemented if use methode callSimple(..).
void setRanking(RankingModule *pRanking)
void postProcessing_markUp(HierarchyLevels &levels, node sH, NodeArray< bool > &markedNodes)
mark all the nodes dominated by sH. (Help method for postProcessing_reduceLED() )
void setLayout(HierarchyLayoutModule *pLayout)
int maxLayerSize()
Return the max. number of elements on a layer. Not implemented if use methode callSimple(....
void computeRanking(const UpwardPlanRep &UPR, NodeArray< int > &rank)
std::unique_ptr< HierarchyLayoutModule > m_layout
void callSimple(GraphAttributes &AG, adjEntry adj)
void postProcessing_reduceLED(Hierarchy &H, HierarchyLevels &levels, node vH)
void longestPathRanking(const Graph &G, NodeArray< int > &rank)
void post_processing_deleteInterval(Hierarchy &H, HierarchyLevels &levels, int beginIdx, int endIdx, int &j)
delete the interval [beginIdx,endIdx] on the level j.
void postProcessing_sourceReorder(HierarchyLevels &levels, List< node > &sources)
rearanging the position of the sources in order to reduce some crossings.
void dfsSortLevels(adjEntry adj1, const NodeArray< int > &rank, Array< SListPure< node > > &nodes)
void post_processing_deleteLvl(Hierarchy &H, HierarchyLevels &levels, int i)
delete level i of H.
Doubly linked lists (maintaining the length of the list).
Definition List.h:1435
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Class for the representation of nodes.
Definition Graph_d.h:177
The optimal ranking algorithm.
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.
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.
bool left(edge e1UPR, edge e2UPR) const
Returns true iff vUPR1 is on the left-hand side of vUPR2 according to m_UPR.
NodeArray< bool > crossed
bool checkUp(node vUPR, int level) const
Returns true iff there is a node above vUPR with rank level or lower.
const UpwardPlanRep & m_UPR
bool left(List< edge > &chain1, List< edge > &chain2, int level) const
Returns true iff vUPR1 is on the left-hand side of vUPR2 according to m_UPR.
NodeArray< int > m_dfsNum
OrderComparer(const UpwardPlanRep &_UPR, Hierarchy &_H)
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 ...
Interface of algorithms for computing a node ranking.
Singly linked lists.
Definition SList.h:179
Interface of hierarchy layout algorithms.
Upward planarized representations (of a connected component) of a graph.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.