Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

FastHierarchyLayout.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/List.h>
36 
37 namespace ogdf {
38 
77 protected:
78  virtual void doCall(const HierarchyLevelsBase& levels, GraphAttributes& AGC) override;
79 
80 public:
83 
86 
87  // destructor
88  virtual ~FastHierarchyLayout() { }
89 
91  FastHierarchyLayout& operator=(const FastHierarchyLayout&);
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 
112 private:
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 
141  double m_minNodeDist;
142  double m_minLayerDist;
143  double* breadth;
144  double* height;
145  double* y;
146  double* x;
147 
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 
304  void findPlacement();
305 };
306 
307 }
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::FastHierarchyLayout::sameLayer
bool sameLayer(int n1, int n2) const
Definition: FastHierarchyLayout.h:170
ogdf::FastHierarchyLayout::isFirst
bool isFirst(int actNode) const
Definition: FastHierarchyLayout.h:174
ogdf::FastHierarchyLayout::k
int k
The number of layers.
Definition: FastHierarchyLayout.h:115
ogdf::HierarchyLayoutModule
Interface of hierarchy layout algorithms.
Definition: HierarchyLayoutModule.h:47
ogdf::FastHierarchyLayout::y
double * y
for every layer : y coordinate of layer.
Definition: FastHierarchyLayout.h:145
ogdf::FastHierarchyLayout::layer
int * layer
Stores for every node its layer.
Definition: FastHierarchyLayout.h:116
ogdf::FastHierarchyLayout::m_fixedLayerDist
bool m_fixedLayerDist
0 if distance between layers should be variable, 1 otherwise.
Definition: FastHierarchyLayout.h:155
ogdf::FastHierarchyLayout::fixedLayerDistance
bool fixedLayerDistance() const
Returns the option fixed layer distance.
Definition: FastHierarchyLayout.h:106
ogdf::FastHierarchyLayout::mDist
double * mDist
Similar to totalB, used for temporary storage.
Definition: FastHierarchyLayout.h:153
ogdf::FastHierarchyLayout::x
double * x
for every node : x coordinate of node.
Definition: FastHierarchyLayout.h:146
ogdf::HierarchyLevelsBase
Definition: CrossingMinInterfaces.h:61
ogdf::FastHierarchyLayout::~FastHierarchyLayout
virtual ~FastHierarchyLayout()
Definition: FastHierarchyLayout.h:88
ogdf::FastHierarchyLayout::totalB
double * totalB
for every node : minimal possible distance between the center of a node and first[layer[node]].
Definition: FastHierarchyLayout.h:151
ogdf::FastHierarchyLayout::decrTo
void decrTo(double &d, double t)
Definition: FastHierarchyLayout.h:164
ogdf::FastHierarchyLayout::isLast
bool isLast(int actNode) const
Definition: FastHierarchyLayout.h:178
ogdf::FastHierarchyLayout::fixedLayerDistance
void fixedLayerDistance(bool b)
Sets the option fixed layer distance to b.
Definition: FastHierarchyLayout.h:109
ogdf::FastHierarchyLayout::first
int * first
Stores for every layer the index of the first node.
Definition: FastHierarchyLayout.h:117
ogdf::FastHierarchyLayout::layerDistance
double layerDistance() const
Returns the option layer distance.
Definition: FastHierarchyLayout.h:100
ogdf::FastHierarchyLayout::virt
bool * virt
for every node : virt[node] = 1 if node is virtual, 0 otherwise.
Definition: FastHierarchyLayout.h:156
ogdf::List< int >
ogdf::FastHierarchyLayout::longEdge
List< int > ** longEdge
The nodes belonging to a long edge.
Definition: FastHierarchyLayout.h:139
ogdf::FastHierarchyLayout::height
double * height
for every layer : height[layer] = height of max{height of node on layer}.
Definition: FastHierarchyLayout.h:144
ogdf::FastHierarchyLayout::m_minNodeDist
double m_minNodeDist
The minimal node distance on a layer.
Definition: FastHierarchyLayout.h:141
ogdf::FastHierarchyLayout::m_minLayerDist
double m_minLayerDist
The minimal distance between layers.
Definition: FastHierarchyLayout.h:142
ogdf::FastHierarchyLayout::incrTo
void incrTo(double &d, double t)
Definition: FastHierarchyLayout.h:158
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
HierarchyLayoutModule.h
Declaration of interface hierarchy layout algorithms (3. phase of Sugiyama).
ogdf::FastHierarchyLayout::m
int m
The number edge sections.
Definition: FastHierarchyLayout.h:114
ogdf::FastHierarchyLayout::n
int n
The number of nodes including virtual nodes.
Definition: FastHierarchyLayout.h:113
ogdf::FastHierarchyLayout
Coordinate assignment phase for the Sugiyama algorithm by Buchheim et al.
Definition: FastHierarchyLayout.h:76
List.h
Declaration of doubly linked lists and iterators.
ogdf::FastHierarchyLayout::nodeDistance
void nodeDistance(double dist)
Sets the option node distance to dist.
Definition: FastHierarchyLayout.h:97
ogdf::FastHierarchyLayout::layerDistance
void layerDistance(double dist)
Sets the option layer distance to dist.
Definition: FastHierarchyLayout.h:103
ogdf::FastHierarchyLayout::breadth
double * breadth
for every node : breadth[node] = width of the node.
Definition: FastHierarchyLayout.h:143