Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

BertaultLayout.h
Go to the documentation of this file.
1 
36 #pragma once
37 
38 #include <ogdf/basic/Array.h>
39 #include <ogdf/basic/Array2D.h>
42 #include <ogdf/basic/List.h>
43 #include <ogdf/planarity/PlanRep.h>
44 
45 namespace ogdf {
46 
48 public:
51  ~BertaultLayout();
52 
54  BertaultLayout(double length,
55  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 
65  void setImpred(bool option) { impred = option; };
66 
68  void iterno(int no) { userIterNo = no; }
69 
71  int iterno() { return iter_no; }
72 
75  void reqlength(double length) { userReqLength = length; }
76 
78  double reqlength() { return req_length; }
79 
86  void initPositions(GraphAttributes& AG, char c);
87 
89  int edgeCrossings(GraphAttributes& AG);
90 
92  double edgelength(GraphAttributes& GA);
93 
98 
99 protected:
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  public:
127  bool root; // denotes if a element is root
128  int num; // The number of the connected component represented by the object
129  CCElement* parent; // refers to parent of this object in the heirarchy
130  int faceNum; // the index of the face of parent in which it is contained
131  List<CCElement*> child; //list of CCElements refering to the CCs which are contained inside this CC
132 
133  // Initialises the CCElement to the ith CC
134  void init(int i) {
135  root = false;
136  num = i;
137  child.clear();
138  parent = this;
139  }
140  };
141 
142 
143 private:
146  public:
147  double R[9];
148 
150  void initialize() {
151  int i;
152  for (i = 0; i < 9; i++) {
153  R[i] = std::numeric_limits<double>::max();
154  }
155  }
156  };
157 
159  void preprocess(GraphAttributes& AG);
160 
162  void labelling(GraphAttributes& AG);
163 
165  void crossingPlanarize(GraphAttributes& AG);
166 
168  int insert(CCElement* new1, CCElement* node, GraphAttributes& PAG, PlanRep& PG);
169 
173  int contained(CCElement* ele1, CCElement* ele2, GraphAttributes& PAG, PlanRep& PG);
174 
176  void compute(CCElement* element, PlanRep& PG, GraphAttributes& AG1, GraphCopy& G1);
177 
179  struct proj {
180  double x;
181  double y;
182  } proj;
183 
187  double userReqLength;
188  double userIterNo;
189  double req_length;
190  int iter_no;
191  bool impred;
193 
195 };
196 
197 }
ogdf::BertaultLayout::proj
a structure which stores the projection of a node on an edge
Definition: BertaultLayout.h:179
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::BertaultLayout::iter_no
int iter_no
req_length is the required edge length
Definition: BertaultLayout.h:190
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:66
ogdf::BertaultLayout::iterno
int iterno()
Returns the number of iterations.
Definition: BertaultLayout.h:71
ogdf::PlanRep
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:57
ogdf::BertaultLayout::F_y
NodeArray< double > F_y
Force in x direction.
Definition: BertaultLayout.h:186
ogdf::BertaultLayout::iterno
void iterno(int no)
Sets the number of iterations. If no <= 0, 10*n will be used.
Definition: BertaultLayout.h:68
ogdf::BertaultLayout::BertaultSections::initialize
void initialize()
Ri is radius of ith section.
Definition: BertaultLayout.h:150
ogdf::BertaultLayout::CCElement
Objects of this class are members of the containment heirarchy made in preprocessing stage of ImPrEd.
Definition: BertaultLayout.h:125
ogdf::GraphCopy
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:384
LayoutModule.h
Declaration of interface for layout algorithms (class LayoutModule)
ogdf::Array2D< bool >
OGDF_NEW_DELETE
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
Definition: memory.h:84
PlanRep.h
Declaration of a base class for planar representations of graphs and cluster graphs.
ogdf::BertaultLayout::userReqLength
double userReqLength
Force in y direction.
Definition: BertaultLayout.h:187
ogdf::BertaultLayout::CCElement::child
List< CCElement * > child
Definition: BertaultLayout.h:131
ogdf::BertaultLayout::F_x
NodeArray< double > F_x
Sections associated with all nodes.
Definition: BertaultLayout.h:185
ogdf::BertaultLayout::impred
bool impred
number of iterations to be performed
Definition: BertaultLayout.h:191
backward::details::move
const T & move(const T &v)
Definition: backward.hpp:243
ogdf::BertaultLayout::userIterNo
double userIterNo
required edge length set by the user
Definition: BertaultLayout.h:188
ogdf::BertaultLayout::CCElement::parent
CCElement * parent
Definition: BertaultLayout.h:129
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: List.h:42
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:651
ogdf::BertaultLayout::req_length
double req_length
number of iterations set by the user
Definition: BertaultLayout.h:189
ogdf::BertaultLayout::CCElement::root
bool root
Definition: BertaultLayout.h:127
ogdf::BertaultLayout::CCElement::faceNum
int faceNum
Definition: BertaultLayout.h:130
ogdf::BertaultLayout::proj::y
double y
Definition: BertaultLayout.h:181
ogdf::BertaultLayout::BertaultSections
The sections associated with each node.
Definition: BertaultLayout.h:145
CombinatorialEmbedding.h
Declaration of CombinatorialEmbedding and face.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::BertaultLayout::sect
NodeArray< BertaultSections > sect
Definition: BertaultLayout.h:184
Array.h
Declaration and implementation of Array class and Array algorithms.
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
List.h
Declaration of doubly linked lists and iterators.
ogdf::BertaultLayout
Definition: BertaultLayout.h:47
ogdf::BertaultLayout::proj::x
double x
Definition: BertaultLayout.h:180
ogdf::BertaultLayout::CCElement::init
void init(int i)
Definition: BertaultLayout.h:134
ogdf::BertaultLayout::reqlength
void reqlength(double length)
Sets the required length. If length <= 0, the average edge length will be used.
Definition: BertaultLayout.h:75
Array2D.h
Declaration and implementation of class Array2D which implements dynamic two dimensional arrays.
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::BertaultLayout::surr
Array2D< bool > surr
sets the algorithm to ImPrEd when true
Definition: BertaultLayout.h:192
ogdf::BertaultLayout::reqlength
double reqlength()
Returns the required length.
Definition: BertaultLayout.h:78
ogdf::LayoutModule
Interface of general layout algorithms.
Definition: LayoutModule.h:44
ogdf::List::clear
void clear()
Removes all elements from the list.
Definition: List.h:1616
ogdf::BertaultLayout::CCElement::num
int num
Definition: BertaultLayout.h:128
ogdf::nodeDistribution
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.
ogdf::BertaultLayout::setImpred
void setImpred(bool option)
Sets impred option true or false.
Definition: BertaultLayout.h:65