Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

FastHierarchyLayout.h
Go to the documentation of this file.
1 
32 #pragma once
33 
35 #include <ogdf/basic/List.h>
36 
37 
38 namespace ogdf {
39 
40 
79 {
80 protected:
81  virtual void doCall(const HierarchyLevelsBase &levels, GraphCopyAttributes &AGC) override;
82 
83 public:
86 
89 
90  // destructor
91  virtual ~FastHierarchyLayout() { }
92 
93 
95  FastHierarchyLayout &operator=(const FastHierarchyLayout &);
96 
97 
99  double nodeDistance() const {
100  return m_minNodeDist;
101  }
102 
104  void nodeDistance(double dist) {
105  m_minNodeDist = dist;
106  }
107 
109  double layerDistance() const {
110  return m_minLayerDist;
111  }
112 
114  void layerDistance(double dist) {
115  m_minLayerDist = dist;
116  }
117 
119  bool fixedLayerDistance() const {
120  return m_fixedLayerDist;
121  }
122 
124  void fixedLayerDistance(bool b) {
125  m_fixedLayerDist = b;
126  }
127 
128 
129 private:
130 
131  int n;
132  int m;
133  int k;
134  int *layer;
135  int *first;
136 
137 
138  // nodes are numbered top down and from left to right.
139  // Is called "internal numbering".
140  // Nodes and Layeras are number 0 to n-1 and 0 to k-1, respectively.
141  // For thechnical reasons we set first[k] to n.
142 
149  List<int> *adj[2];
150 
158 
159  double m_minNodeDist;
161  double *breadth;
162  double *height;
163  double *y;
164  double *x;
165 
169  double *totalB;
170 
171  double *mDist;
172 
174  bool *virt;
175 
176  void incrTo(double& d, double t) {
177  if(d < t) d = t;
178  }
179 
180  void decrTo(double& d, double t) {
181  if(d > t) d = t;
182  }
183 
184  bool sameLayer(int n1, int n2) const {
185  return (n1 >= 0 &&
186  n1 < n &&
187  n2 >=0 &&
188  n2 < n &&
189  layer[n1] == layer[n2]);
190  }
191 
192  bool isFirst(int actNode) const {
193  return (actNode < 0 ||
194  actNode >= n ||
195  actNode == first[layer[actNode]]);
196  }
197 
198  bool isLast(int actNode) const {
199  return (actNode < 0 ||
200  actNode >= n ||
201  actNode == first[layer[actNode] + 1] -1);
202  }
203 
235  void sortLongEdges(int actNode, int dir, double *pos, bool &exD, double &dist, int *block, bool *marked);
236 
259  bool placeSingleNode(int leftBnd, int rightBnd, int actNode, double &best, int d);
260 
285  void placeNodes(int leftBnd, int rightBnd, int left, int right, int d);
286 
308  void moveLongEdge(int actNode, int dir, bool *marked);
309 
322  void straightenEdge(int actNode, bool *marked);
323 
325  void findPlacement();
326 };
327 
328 } // end namespace ogdf
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)
Helper class for accessing graph attributes from a copy of the graph.
Coordinate assignment phase for the Sugiyama algorithm by Buchheim et al.
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.