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/basic.h>
36 
37 namespace ogdf {
38 class GraphAttributes;
39 class HierarchyLevelsBase;
40 template<class E>
41 class List;
42 
81 protected:
82  virtual void doCall(const HierarchyLevelsBase& levels, GraphAttributes& AGC) override;
83 
84 public:
87 
90 
91  // destructor
92  virtual ~FastHierarchyLayout() { }
93 
95  FastHierarchyLayout& operator=(const FastHierarchyLayout&);
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 
116 private:
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 
145  double m_minNodeDist;
146  double m_minLayerDist;
147  double* breadth;
148  double* height;
149  double* y;
150  double* x;
151 
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 
308  void findPlacement();
309 };
310 
311 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
ogdf::FastHierarchyLayout::nodeDistance
double nodeDistance() const
Returns the option node distance.
Definition: FastHierarchyLayout.h:98
ogdf::FastHierarchyLayout::sameLayer
bool sameLayer(int n1, int n2) const
Definition: FastHierarchyLayout.h:174
ogdf::FastHierarchyLayout::isFirst
bool isFirst(int actNode) const
Definition: FastHierarchyLayout.h:178
ogdf::FastHierarchyLayout::k
int k
The number of layers.
Definition: FastHierarchyLayout.h:119
ogdf::HierarchyLayoutModule
Interface of hierarchy layout algorithms.
Definition: HierarchyLayoutModule.h:52
ogdf::FastHierarchyLayout::y
double * y
for every layer : y coordinate of layer.
Definition: FastHierarchyLayout.h:149
ogdf::FastHierarchyLayout::layer
int * layer
Stores for every node its layer.
Definition: FastHierarchyLayout.h:120
ogdf::FastHierarchyLayout::m_fixedLayerDist
bool m_fixedLayerDist
0 if distance between layers should be variable, 1 otherwise.
Definition: FastHierarchyLayout.h:159
ogdf::FastHierarchyLayout::fixedLayerDistance
bool fixedLayerDistance() const
Returns the option fixed layer distance.
Definition: FastHierarchyLayout.h:110
ogdf::FastHierarchyLayout::mDist
double * mDist
Similar to totalB, used for temporary storage.
Definition: FastHierarchyLayout.h:157
ogdf::FastHierarchyLayout::x
double * x
for every node : x coordinate of node.
Definition: FastHierarchyLayout.h:150
ogdf::HierarchyLevelsBase
Definition: CrossingMinInterfaces.h:63
ogdf::FastHierarchyLayout::~FastHierarchyLayout
virtual ~FastHierarchyLayout()
Definition: FastHierarchyLayout.h:92
ogdf::FastHierarchyLayout::totalB
double * totalB
for every node : minimal possible distance between the center of a node and first[layer[node]].
Definition: FastHierarchyLayout.h:155
ogdf::FastHierarchyLayout::decrTo
void decrTo(double &d, double t)
Definition: FastHierarchyLayout.h:168
ogdf::FastHierarchyLayout::isLast
bool isLast(int actNode) const
Definition: FastHierarchyLayout.h:182
ogdf::FastHierarchyLayout::fixedLayerDistance
void fixedLayerDistance(bool b)
Sets the option fixed layer distance to b.
Definition: FastHierarchyLayout.h:113
ogdf::FastHierarchyLayout::first
int * first
Stores for every layer the index of the first node.
Definition: FastHierarchyLayout.h:121
ogdf::FastHierarchyLayout::layerDistance
double layerDistance() const
Returns the option layer distance.
Definition: FastHierarchyLayout.h:104
ogdf::FastHierarchyLayout::virt
bool * virt
for every node : virt[node] = 1 if node is virtual, 0 otherwise.
Definition: FastHierarchyLayout.h:160
ogdf::List< int >
ogdf::FastHierarchyLayout::longEdge
List< int > ** longEdge
The nodes belonging to a long edge.
Definition: FastHierarchyLayout.h:143
ogdf::FastHierarchyLayout::height
double * height
for every layer : height[layer] = height of max{height of node on layer}.
Definition: FastHierarchyLayout.h:148
ogdf::FastHierarchyLayout::m_minNodeDist
double m_minNodeDist
The minimal node distance on a layer.
Definition: FastHierarchyLayout.h:145
ogdf::FastHierarchyLayout::m_minLayerDist
double m_minLayerDist
The minimal distance between layers.
Definition: FastHierarchyLayout.h:146
ogdf::FastHierarchyLayout::incrTo
void incrTo(double &d, double t)
Definition: FastHierarchyLayout.h:162
basic.h
Basic declarations, included by all source files.
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:118
ogdf::FastHierarchyLayout::n
int n
The number of nodes including virtual nodes.
Definition: FastHierarchyLayout.h:117
ogdf::FastHierarchyLayout
Coordinate assignment phase for the Sugiyama algorithm by Buchheim et al.
Definition: FastHierarchyLayout.h:80
ogdf::FastHierarchyLayout::nodeDistance
void nodeDistance(double dist)
Sets the option node distance to dist.
Definition: FastHierarchyLayout.h:101
ogdf::FastHierarchyLayout::layerDistance
void layerDistance(double dist)
Sets the option layer distance to dist.
Definition: FastHierarchyLayout.h:107
ogdf::FastHierarchyLayout::breadth
double * breadth
for every node : breadth[node] = width of the node.
Definition: FastHierarchyLayout.h:147