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/basic.h>
36
37namespace ogdf {
38class GraphAttributes;
39class HierarchyLevelsBase;
40template<class E>
41class List;
42
81protected:
82 virtual void doCall(const HierarchyLevelsBase& levels, GraphAttributes& AGC) override;
83
84public:
87
90
91 // destructor
93
96
98 double nodeDistance() const { return m_minNodeDist; }
99
101 void nodeDistance(double dist) { m_minNodeDist = dist; }
102
104 double layerDistance() const { return m_minLayerDist; }
105
107 void layerDistance(double dist) { m_minLayerDist = dist; }
108
110 bool fixedLayerDistance() const { return m_fixedLayerDist; }
111
113 void fixedLayerDistance(bool b) { m_fixedLayerDist = b; }
114
115
116private:
117 int n;
118 int m;
119 int k;
120 int* layer;
121 int* first;
122
123
124 // nodes are numbered top down and from left to right.
125 // Is called "internal numbering".
126 // Nodes and Layeras are number 0 to n-1 and 0 to k-1, respectively.
127 // For thechnical reasons we set first[k] to n.
128
135 List<int>* adj[2];
136
144
147 double* breadth;
148 double* height;
149 double* y;
150 double* x;
155 double* totalB;
156
157 double* mDist;
158
160 bool* virt;
161
162 void incrTo(double& d, double t) {
163 if (d < t) {
164 d = t;
165 }
166 }
167
168 void decrTo(double& d, double t) {
169 if (d > t) {
170 d = t;
171 }
172 }
173
174 bool sameLayer(int n1, int n2) const {
175 return n1 >= 0 && n1 < n && n2 >= 0 && n2 < n && layer[n1] == layer[n2];
176 }
177
178 bool isFirst(int actNode) const {
179 return actNode < 0 || actNode >= n || actNode == first[layer[actNode]];
180 }
181
182 bool isLast(int actNode) const {
183 return actNode < 0 || actNode >= n || actNode == first[layer[actNode] + 1] - 1;
184 }
185
217 void sortLongEdges(int actNode, int dir, double* pos, bool& exD, double& dist, int* block,
218 bool* marked);
219
242 bool placeSingleNode(int leftBnd, int rightBnd, int actNode, double& best, int d);
243
268 void placeNodes(int leftBnd, int rightBnd, int left, int right, int d);
269
291 void moveLongEdge(int actNode, int dir, bool* marked);
292
305 void straightenEdge(int actNode, bool* marked);
306
309};
310
311}
Declaration of interface hierarchy layout algorithms (3.
Basic declarations, included by all source files.
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:1451
#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.