Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

FastHierarchyLayout.h
Go to the documentation of this file.
1 
32 #pragma once
33 
35 #include <ogdf/basic/List.h>
36 
37 namespace ogdf {
38 
77 {
78 protected:
79  virtual void doCall(const HierarchyLevelsBase &levels, GraphAttributes &AGC) override;
80 
81 public:
84 
87 
88  // destructor
89  virtual ~FastHierarchyLayout() { }
90 
91 
93  FastHierarchyLayout &operator=(const FastHierarchyLayout &);
94 
95 
97  double nodeDistance() const {
98  return m_minNodeDist;
99  }
100 
102  void nodeDistance(double dist) {
103  m_minNodeDist = dist;
104  }
105 
107  double layerDistance() const {
108  return m_minLayerDist;
109  }
110 
112  void layerDistance(double dist) {
113  m_minLayerDist = dist;
114  }
115 
117  bool fixedLayerDistance() const {
118  return m_fixedLayerDist;
119  }
120 
122  void fixedLayerDistance(bool b) {
123  m_fixedLayerDist = b;
124  }
125 
126 
127 private:
128 
129  int n;
130  int m;
131  int k;
132  int *layer;
133  int *first;
134 
135 
136  // nodes are numbered top down and from left to right.
137  // Is called "internal numbering".
138  // Nodes and Layeras are number 0 to n-1 and 0 to k-1, respectively.
139  // For thechnical reasons we set first[k] to n.
140 
147  List<int> *adj[2];
148 
156 
157  double m_minNodeDist;
159  double *breadth;
160  double *height;
161  double *y;
162  double *x;
163 
167  double *totalB;
168 
169  double *mDist;
170 
172  bool *virt;
173 
174  void incrTo(double& d, double t) {
175  if(d < t) d = t;
176  }
177 
178  void decrTo(double& d, double t) {
179  if(d > t) d = t;
180  }
181 
182  bool sameLayer(int n1, int n2) const {
183  return n1 >= 0 && n1 < n
184  && n2 >= 0 && n2 < n
185  && layer[n1] == layer[n2];
186  }
187 
188  bool isFirst(int actNode) const {
189  return actNode < 0
190  || actNode >= n
191  || actNode == first[layer[actNode]];
192  }
193 
194  bool isLast(int actNode) const {
195  return actNode < 0
196  || actNode >= n
197  || actNode == first[layer[actNode] + 1] - 1;
198  }
199 
231  void sortLongEdges(int actNode, int dir, double *pos, bool &exD, double &dist, int *block, bool *marked);
232 
255  bool placeSingleNode(int leftBnd, int rightBnd, int actNode, double &best, int d);
256 
281  void placeNodes(int leftBnd, int rightBnd, int left, int right, int d);
282 
304  void moveLongEdge(int actNode, int dir, bool *marked);
305 
318  void straightenEdge(int actNode, bool *marked);
319 
321  void findPlacement();
322 };
323 
324 }
double * mDist
Similar to totalB, used for temporary storage.
int k
The number of layers.
int n
The number of nodes including virtual nodes.
double layerDistance() const
Returns the option layer distance.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
double nodeDistance() const
Returns the option node distance.
Declaration of interface hierarchy layout algorithms (3.
bool isFirst(int actNode) const
int * first
Stores for every layer the index of the first node.
List< int > ** longEdge
The nodes belonging to a long edge.
double m_minNodeDist
The minimal node distance on a layer.
void decrTo(double &d, double t)
Coordinate assignment phase for the Sugiyama algorithm by Buchheim et al.
Stores additional attributes of a graph (like layout information).
Interface of hierarchy layout algorithms.
bool sameLayer(int n1, int n2) const
int * layer
Stores for every node its layer.
int m
The number edge sections.
double * x
for every node : x coordinate of node.
void nodeDistance(double dist)
Sets the option node distance to dist.
void fixedLayerDistance(bool b)
Sets the option fixed layer distance to b.
bool * virt
for every node : virt[node] = 1 if node is virtual, 0 otherwise.
bool fixedLayerDistance() const
Returns the option fixed layer distance.
double * totalB
for every node : minimal possible distance between the center of a node and first[layer[node]].
bool m_fixedLayerDist
0 if distance between layers should be variable, 1 otherwise.
bool isLast(int actNode) const
void incrTo(double &d, double t)
double * height
for every layer : height[layer] = height of max{height of node on layer}.
The namespace for all OGDF objects.
double * breadth
for every node : breadth[node] = width of the node.
double * y
for every layer : y coordinate of layer.
Declaration of doubly linked lists and iterators.
double m_minLayerDist
The minimal distance between layers.
void layerDistance(double dist)
Sets the option layer distance to dist.