Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
FastHierarchyLayout.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/List.h>
36
37namespace ogdf {
38
77protected:
78 virtual void doCall(const HierarchyLevelsBase& levels, GraphAttributes& AGC) override;
79
80public:
83
86
87 // destructor
89
92
94 double nodeDistance() const { return m_minNodeDist; }
95
97 void nodeDistance(double dist) { m_minNodeDist = dist; }
98
100 double layerDistance() const { return m_minLayerDist; }
101
103 void layerDistance(double dist) { m_minLayerDist = dist; }
104
106 bool fixedLayerDistance() const { return m_fixedLayerDist; }
107
109 void fixedLayerDistance(bool b) { m_fixedLayerDist = b; }
110
111
112private:
113 int n;
114 int m;
115 int k;
116 int* layer;
117 int* first;
118
119
120 // nodes are numbered top down and from left to right.
121 // Is called "internal numbering".
122 // Nodes and Layeras are number 0 to n-1 and 0 to k-1, respectively.
123 // For thechnical reasons we set first[k] to n.
124
131 List<int>* adj[2];
132
140
143 double* breadth;
144 double* height;
145 double* y;
146 double* x;
151 double* totalB;
152
153 double* mDist;
154
156 bool* virt;
157
158 void incrTo(double& d, double t) {
159 if (d < t) {
160 d = t;
161 }
162 }
163
164 void decrTo(double& d, double t) {
165 if (d > t) {
166 d = t;
167 }
168 }
169
170 bool sameLayer(int n1, int n2) const {
171 return n1 >= 0 && n1 < n && n2 >= 0 && n2 < n && layer[n1] == layer[n2];
172 }
173
174 bool isFirst(int actNode) const {
175 return actNode < 0 || actNode >= n || actNode == first[layer[actNode]];
176 }
177
178 bool isLast(int actNode) const {
179 return actNode < 0 || actNode >= n || actNode == first[layer[actNode] + 1] - 1;
180 }
181
213 void sortLongEdges(int actNode, int dir, double* pos, bool& exD, double& dist, int* block,
214 bool* marked);
215
238 bool placeSingleNode(int leftBnd, int rightBnd, int actNode, double& best, int d);
239
264 void placeNodes(int leftBnd, int rightBnd, int left, int right, int d);
265
287 void moveLongEdge(int actNode, int dir, bool* marked);
288
301 void straightenEdge(int actNode, bool* marked);
302
305};
306
307}
Declaration of interface hierarchy layout algorithms (3.
Declaration of doubly linked lists and iterators.
Coordinate assignment phase for the Sugiyama algorithm by Buchheim et al.
void nodeDistance(double dist)
Sets the option node distance to dist.
bool * virt
for every node : virt[node] = 1 if node is virtual, 0 otherwise.
void fixedLayerDistance(bool b)
Sets the option fixed layer distance to b.
double m_minNodeDist
The minimal node distance on a layer.
void findPlacement()
Computes the layout of an embedded layered graph.
void decrTo(double &d, double t)
double * breadth
for every node : breadth[node] = width of the node.
bool fixedLayerDistance() const
Returns the option fixed layer distance.
bool sameLayer(int n1, int n2) const
int * first
Stores for every layer the index of the first node.
bool m_fixedLayerDist
0 if distance between layers should be variable, 1 otherwise.
int * layer
Stores for every node its layer.
void incrTo(double &d, double t)
double nodeDistance() const
Returns the option node distance.
double layerDistance() const
Returns the option layer distance.
int n
The number of nodes including virtual nodes.
FastHierarchyLayout(const FastHierarchyLayout &)
Copy constructor.
FastHierarchyLayout & operator=(const FastHierarchyLayout &)
Assignment operator.
int m
The number edge sections.
double * x
for every node : x coordinate of node.
double * mDist
Similar to totalB, used for temporary storage.
virtual void doCall(const HierarchyLevelsBase &levels, GraphAttributes &AGC) override
Implements the actual algorithm call.
List< int > ** longEdge
The nodes belonging to a long edge.
FastHierarchyLayout()
Creates an instance of fast hierarchy layout.
double * y
for every layer : y coordinate of layer.
bool placeSingleNode(int leftBnd, int rightBnd, int actNode, double &best, int d)
Places a sequence of nonvirtual nodes containing exactly one node.
bool isLast(int actNode) const
bool isFirst(int actNode) const
void moveLongEdge(int actNode, int dir, bool *marked)
Used for postprocessing the layout.
void layerDistance(double dist)
Sets the option layer distance to dist.
int k
The number of layers.
void straightenEdge(int actNode, bool *marked)
Tries to remove a bend at the position of the virtual node by straightening the edge.
void placeNodes(int leftBnd, int rightBnd, int left, int right, int d)
Places a sequence of nonvirtual nodes.
double * totalB
for every node : minimal possible distance between the center of a node and first[layer[node]].
double m_minLayerDist
The minimal distance between layers.
void sortLongEdges(int actNode, int dir, double *pos, bool &exD, double &dist, int *block, bool *marked)
Places the node actNode as far as possible to the left (if dir = 1) or to the right (if dir = -1) wit...
double * height
for every layer : height[layer] = height of max{height of node on layer}.
Stores additional attributes of a graph (like layout information).
Interface of hierarchy layout algorithms.
Doubly linked lists (maintaining the length of the list).
Definition List.h:1435
#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.