Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

BertaultLayout.h
Go to the documentation of this file.
1 
36 #pragma once
37 
39 #include <ogdf/basic/List.h>
40 #include <ogdf/basic/Array.h>
41 #include <ogdf/basic/Array2D.h>
43 #include <ogdf/planarity/PlanRep.h>
44 
45 
46 
47 namespace ogdf {
48 
49 
51 {
52 public:
55  ~BertaultLayout();
56 
58  BertaultLayout(double length, int number); // length= desired edge length... number= number of iterations
59 
61  explicit BertaultLayout(int number); // number= number of iterations
62 
63 
65  virtual void call(GraphAttributes &AG) override;
66 
67 
69  void setImpred(bool option) { impred=option;};
70 
72  void iterno(int no) { iter_no=no; }
73 
75  int iterno() { return iter_no; }
76 
78  void reqlength(double length) { req_length=length; }
79 
81  double reqlength() { return req_length; }
82 
89  void initPositions(GraphAttributes &AG,char c);
90 
92  int edgeCrossings(GraphAttributes &AG);
93 
95  double edgelength(GraphAttributes &GA);
96 
99 
100 protected:
101 
103  void f_Node_Repulsive(node *v,node *j, GraphAttributes &AG);
104 
106  void f_Node_Attractive(node *v,node *j, GraphAttributes &AG);
107 
109  void compute_I(node *v, edge *e, GraphAttributes &AG);
110 
112  bool i_On_Edge(edge *e, GraphAttributes &AG);
113 
115  void f_Edge(node *v, edge *e, GraphAttributes &AG);
116 
118  void r_Calc_On_Edge(node *v, edge *e, GraphAttributes &AG);
119 
121  void r_Calc_Outside_Edge(node *v,edge *e, GraphAttributes &AG);
122 
124  void move(node *v, GraphAttributes &AG);
125 
127  class CCElement
128  {
129  public:
130  bool root; // denotes if a element is root
131  int num; // The number of the connected component represented by the object
132  CCElement* parent; // refers to parent of this object in the heirarchy
133  int faceNum; // the index of the face of parent in which it is contained
134  List <CCElement*> child; //list of CCElements refering to the CCs which are contained inside this CC
135 
136  // Initialises the CCElement to the ith CC
137  void init(int i) {
138  root = false;
139  num = i;
140  child.clear();
141  parent = this;
142  }
143  };
144 
145 
146 private:
149  {
150  public:
151  double R[9];
152 
154  void initialize()
155  {
156  int i;
157  for(i=0;i<9;i++)
158  R[i] = numeric_limits<double>::max();
159  }
160  };
161 
162 
164  void preprocess(GraphAttributes &AG);
165 
167  void labelling(GraphAttributes &AG);
168 
170  void crossingPlanarize(GraphAttributes &AG);
171 
173  int insert(CCElement *new1,CCElement *node,GraphAttributes &PAG,PlanRep &PG);
174 
178  int contained(CCElement *ele1,CCElement *ele2,GraphAttributes &PAG,PlanRep &PG);
179 
181  void compute(CCElement* element,PlanRep &PG,GraphAttributes &AG1,GraphCopy &G1);
182 
184  struct proj
185  {
186  double x;
187  double y;
188  } proj;
192  double req_length;
193  double limit;
194  int iter_no;
195  bool impred;
197 
199 }; //class BertaultLayout
200 
201 
202 }//end namespace ogdf
void clear()
Removes all elements from the list.
Definition: List.h:1394
a structure which stores the projection of a node on an edge
The sections associated with each node.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
void initialize()
Ri is radius of ith section.
double reqlength()
Returns the required length.
NodeArray< double > F_x
Sections associated with all nodes.
Declaration of a base class for planar representations of graphs and cluster graphs.
bool impred
number of iterations to be performed
Declaration of CombinatorialEmbedding and face.
NodeArray< double > F_y
Force in x direction.
Declaration and implementation of Array class and Array algorithms.
int iter_no
limit is the max distance (between node and its projection) at which the edge force on node is consid...
NodeArray< BertaultSections > sect
Dynamic arrays indexed with nodes.
Definition: Graph_d.h:423
void nodeDistribution(const Graph &G, Array< int > &degdist, std::function< int(node)> func)
Fills dist with the distribution given by a function func in graph G.
void iterno(int no)
Sets the number of iterations.
void setImpred(bool option)
Sets impred option true or false.
Objects of this class are members of the containment heirarchy made in preprocessing stage of ImPrEd...
Stores additional attributes of a graph (like layout information).
Doubly linked lists (maintaining the length of the list).
Definition: List.h:39
Class for the representation of edges.
Definition: Graph_d.h:291
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:250
Declaration of interface for layout algorithms (class LayoutModule)
Class for the representation of nodes.
Definition: Graph_d.h:167
#define OGDF_NEW_DELETE
Makes the class use OGDF&#39;s memory allocator.
Definition: memory.h:84
const T & move(const T &v)
Definition: backward.hpp:243
Interface of general layout algorithms.
Definition: LayoutModule.h:44
void reqlength(double length)
Sets the required length.
int iterno()
Returns the number of iterations.
The namespace for all OGDF objects.
double req_length
Force in y direction.
Array2D< bool > surr
sets the algorithm to ImPrEd when true
Declaration of doubly linked lists and iterators.
double limit
req_length is the required edge length
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:60
Declaration and implementation of class Array2D which implements dynamic two dimensional arrays...