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
34#include <ogdf/basic/Array.h>
36#include <ogdf/basic/Graph.h>
37#include <ogdf/basic/List.h>
38#include <ogdf/basic/basic.h>
44
45#include <memory>
46
47namespace ogdf {
48class GraphAttributes;
49class Hierarchy;
50class HierarchyLevels;
51class UpwardPlanRep;
52template<class E>
53class SListPure;
54
56public:
58
64 bool less(node vH1, node vH2) const;
65
66private:
70#if 0
71 EdgeArray<int> outEdgeOrder;
72#endif
74
76 void dfs_LR(edge e, NodeArray<bool>& visited, NodeArray<int>& dfsNum, int& num);
77
79 bool left(node vUPR1,
80 const List<edge>& chain1,
81 node vUPR2,
82 const List<edge>& chain2
83 ) const;
84
91 bool left(edge e1UPR, edge e2UPR) const;
92
100 bool left(List<edge>& chain1, List<edge>& chain2, int level) const;
101
103 bool checkUp(node vUPR, int level) const;
104};
105
110public:
111 // constructor: sets options to default values
113 // set default value
115 fhl->nodeDistance(40.0);
116 fhl->layerDistance(40.0);
117 fhl->fixedLayerDistance(true);
118 m_layout.reset(fhl);
119 OptimalRanking* opRank = new OptimalRanking();
120 opRank->separateMultiEdges(false);
121 m_ranking.reset(opRank);
122 m_numLevels = 0;
123 m_maxLevelSize = 0;
124 }
125
126 // destructor
128
129 // returns the number of crossings in the layout after the algorithm
130 // has been applied
131 int numberOfCrossings() const { return m_crossings; }
132
133 // module option for the computation of the final layout
134 void setLayout(HierarchyLayoutModule* pLayout) { m_layout.reset(pLayout); }
135
136 void setRanking(RankingModule* pRanking) { m_ranking.reset(pRanking); }
137
140
142 int numberOfLayers() { return m_numLevels; }
143
145 int maxLayerSize() { return m_maxLevelSize; }
146
147protected:
148 /*
149 * @param UPR is the upward planarized representation of the input graph.
150 * @param AG has to be assigned the hierarchy layout.
151 */
152 virtual void doCall(const UpwardPlanRep& UPR, GraphAttributes& AG) override;
153
155
156 std::unique_ptr<RankingModule> m_ranking;
157
158 std::unique_ptr<HierarchyLayoutModule> m_layout;
159
160private:
161 // compute a ranking of the nodes of UPR.
162 // Precond. a ranking module muss be set
164
165
168
171 for (node s : sources) {
172 postProcessing_reduceLED(H, levels, s);
173 }
174 }
175
177
178 void post_processing_reduce(Hierarchy& H, HierarchyLevels& levels, int& i, node s, int minIdx,
179 int maxIdx, NodeArray<bool>& markedNodes);
180
183
184
187
190 int endIdx, int& j);
191
193 void post_processing_CopyInterval(Hierarchy& H, HierarchyLevels& levels, int i, int beginIdx,
194 int endIdx, int pos);
195
199
200
203
204 void callSimple(GraphAttributes& AG, adjEntry adj //left most edge of the source
205 );
206
207 // needed for UPRLayoutSimple
209
210 // needed for UPRLayoutSimple
212
214};
215
216}
Declaration and implementation of Array class and Array algorithms.
Declaration and implementation of ArrayBuffer class.
declaration and implementation of the third phase of sugiyama
Includes declaration of graph class.
Declaration of interface hierarchy layout algorithms (3.
Declaration of doubly linked lists and iterators.
Declaration of optimal ranking algorithm for Sugiyama algorithm.
Declaration of interface for ranking algorithms.
Declaration of interface for layout algorithms for a UpwardPlanRep.
Basic declarations, included by all source files.
Class for adjacency list elements.
Definition Graph_d.h:143
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Definition ArrayBuffer.h:64
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:219
Class for the representation of edges.
Definition Graph_d.h:364
Coordinate assignment phase for the Sugiyama algorithm by Buchheim et al.
bool fixedLayerDistance() const
Returns the option fixed layer distance.
double nodeDistance() const
Returns the option node distance.
double layerDistance() const
Returns the option layer distance.
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
Representation of proper hierarchies used by Sugiyama-layout.
Definition Hierarchy.h:47
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:1451
Class for the representation of nodes.
Definition Graph_d.h:241
The optimal ranking algorithm.
bool separateMultiEdges() const
Returns the current setting of option separateMultiEdges.
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:191
Interface of hierarchy layout algorithms.
Upward planarized representations (of a connected component) of a graph.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
The namespace for all OGDF objects.