Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

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 namespace ogdf {
46 
48 {
49 public:
52  ~BertaultLayout();
53 
55  BertaultLayout(double length, int number); // length= desired edge length... number= number of iterations
56 
58  explicit BertaultLayout(int number); // number= number of iterations
59 
60 
62  virtual void call(GraphAttributes &AG) override;
63 
64 
66  void setImpred(bool option) { impred=option;};
67 
69  void iterno(int no) { userIterNo=no; }
70 
72  int iterno() { return iter_no; }
73 
76  void reqlength(double length) { userReqLength=length; }
77 
79  double reqlength() { return req_length; }
80 
87  void initPositions(GraphAttributes &AG,char c);
88 
90  int edgeCrossings(GraphAttributes &AG);
91 
93  double edgelength(GraphAttributes &GA);
94 
97 
98 protected:
99 
101  void f_Node_Repulsive(node *v,node *j, GraphAttributes &AG);
102 
104  void f_Node_Attractive(node *v,node *j, GraphAttributes &AG);
105 
107  void compute_I(node *v, edge *e, GraphAttributes &AG);
108 
110  bool i_On_Edge(edge *e, GraphAttributes &AG);
111 
113  void f_Edge(node *v, edge *e, GraphAttributes &AG);
114 
116  void r_Calc_On_Edge(node *v, edge *e, GraphAttributes &AG);
117 
119  void r_Calc_Outside_Edge(node *v,edge *e, GraphAttributes &AG);
120 
122  void move(node *v, GraphAttributes &AG);
123 
125  class CCElement
126  {
127  public:
128  bool root; // denotes if a element is root
129  int num; // The number of the connected component represented by the object
130  CCElement* parent; // refers to parent of this object in the heirarchy
131  int faceNum; // the index of the face of parent in which it is contained
132  List <CCElement*> child; //list of CCElements refering to the CCs which are contained inside this CC
133 
134  // Initialises the CCElement to the ith CC
135  void init(int i) {
136  root = false;
137  num = i;
138  child.clear();
139  parent = this;
140  }
141  };
142 
143 
144 private:
147  {
148  public:
149  double R[9];
150 
152  void initialize()
153  {
154  int i;
155  for(i=0;i<9;i++)
156  R[i] = std::numeric_limits<double>::max();
157  }
158  };
159 
160 
162  void preprocess(GraphAttributes &AG);
163 
165  void labelling(GraphAttributes &AG);
166 
168  void crossingPlanarize(GraphAttributes &AG);
169 
171  int insert(CCElement *new1,CCElement *node,GraphAttributes &PAG,PlanRep &PG);
172 
176  int contained(CCElement *ele1,CCElement *ele2,GraphAttributes &PAG,PlanRep &PG);
177 
179  void compute(CCElement* element,PlanRep &PG,GraphAttributes &AG1,GraphCopy &G1);
180 
182  struct proj
183  {
184  double x;
185  double y;
186  } proj;
190  double userReqLength;
191  double userIterNo;
192  double req_length;
193  int iter_no;
194  bool impred;
196 
198 };
199 
200 }
void clear()
Removes all elements from the list.
Definition: List.h:1451
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
req_length is the required edge length
NodeArray< BertaultSections > sect
Dynamic arrays indexed with nodes.
Definition: Graph_d.h:438
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. If no <= 0, 10*n will be used.
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:40
double userReqLength
Force in y direction.
Class for the representation of edges.
Definition: Graph_d.h:292
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:249
Declaration of interface for layout algorithms (class LayoutModule)
Class for the representation of nodes.
Definition: Graph_d.h:169
#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. If length <= 0, the average edge length will be used.
double userIterNo
required edge length set by the user
int iterno()
Returns the number of iterations.
The namespace for all OGDF objects.
double req_length
number of iterations set by the user
Array2D< bool > surr
sets the algorithm to ImPrEd when true
Declaration of doubly linked lists and iterators.
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:59
Declaration and implementation of class Array2D which implements dynamic two dimensional arrays...