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/Array2D.h>
39 #include <ogdf/basic/Graph.h>
41 #include <ogdf/basic/List.h>
42 #include <ogdf/basic/basic.h>
43 #include <ogdf/basic/memory.h>
44 
45 #include <limits>
46 
47 namespace ogdf {
48 class GraphAttributes;
49 class GraphCopy;
50 class PlanRep;
51 
53 public:
56  ~BertaultLayout();
57 
59  BertaultLayout(double length,
60  int number); // length= desired edge length... number= number of iterations
61 
63  explicit BertaultLayout(int number); // number= number of iterations
64 
65 
67  virtual void call(GraphAttributes& AG) override;
68 
70  void setImpred(bool option) { impred = option; };
71 
73  void iterno(int no) { userIterNo = no; }
74 
76  int iterno() { return iter_no; }
77 
80  void reqlength(double length) { userReqLength = length; }
81 
83  double reqlength() { return req_length; }
84 
91  void initPositions(GraphAttributes& AG, char c);
92 
94  int edgeCrossings(GraphAttributes& AG);
95 
97  double edgelength(GraphAttributes& GA);
98 
102  double nodeDistribution(GraphAttributes& GA);
103 
104 protected:
106  void f_Node_Repulsive(node* v, node* j, GraphAttributes& AG);
107 
109  void f_Node_Attractive(node* v, node* j, GraphAttributes& AG);
110 
112  void compute_I(node* v, edge* e, GraphAttributes& AG);
113 
115  bool i_On_Edge(edge* e, GraphAttributes& AG);
116 
118  void f_Edge(node* v, edge* e, GraphAttributes& AG);
119 
121  void r_Calc_On_Edge(node* v, edge* e, GraphAttributes& AG);
122 
124  void r_Calc_Outside_Edge(node* v, edge* e, GraphAttributes& AG);
125 
127  void move(node* v, GraphAttributes& AG);
128 
130  class CCElement {
131  public:
132  bool root; // denotes if a element is root
133  int num; // The number of the connected component represented by the object
134  CCElement* parent; // refers to parent of this object in the heirarchy
135  int faceNum; // the index of the face of parent in which it is contained
136  List<CCElement*> child; //list of CCElements refering to the CCs which are contained inside this CC
137 
138  // Initialises the CCElement to the ith CC
139  void init(int i) {
140  root = false;
141  num = i;
142  child.clear();
143  parent = this;
144  }
145  };
146 
147 
148 private:
151  public:
152  double R[9];
153 
155  void initialize() {
156  int i;
157  for (i = 0; i < 9; i++) {
158  R[i] = std::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  double x;
186  double y;
187  } proj;
188 
192  double userReqLength;
193  double userIterNo;
194  double req_length;
195  int iter_no;
196  bool impred;
198 
200 };
201 
202 }
ogdf::BertaultLayout::proj
a structure which stores the projection of a node on an edge
Definition: BertaultLayout.h:184
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::BertaultLayout::iter_no
int iter_no
req_length is the required edge length
Definition: BertaultLayout.h:195
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
Graph.h
Includes declaration of graph class.
ogdf::BertaultLayout::iterno
int iterno()
Returns the number of iterations.
Definition: BertaultLayout.h:76
ogdf::PlanRep
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:69
ogdf::BertaultLayout::F_y
NodeArray< double > F_y
Force in x direction.
Definition: BertaultLayout.h:191
ogdf::BertaultLayout::iterno
void iterno(int no)
Sets the number of iterations. If no <= 0, 10*n will be used.
Definition: BertaultLayout.h:73
ogdf::BertaultLayout::BertaultSections::initialize
void initialize()
Ri is radius of ith section.
Definition: BertaultLayout.h:155
ogdf::BertaultLayout::CCElement
Objects of this class are members of the containment heirarchy made in preprocessing stage of ImPrEd.
Definition: BertaultLayout.h:130
ogdf::GraphCopy
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:391
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:85
ogdf::BertaultLayout::userReqLength
double userReqLength
Force in y direction.
Definition: BertaultLayout.h:192
ogdf::BertaultLayout::CCElement::child
List< CCElement * > child
Definition: BertaultLayout.h:136
ogdf::BertaultLayout::F_x
NodeArray< double > F_x
Sections associated with all nodes.
Definition: BertaultLayout.h:190
ogdf::BertaultLayout::impred
bool impred
number of iterations to be performed
Definition: BertaultLayout.h:196
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:193
ogdf::BertaultLayout::CCElement::parent
CCElement * parent
Definition: BertaultLayout.h:134
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: DfsMakeBiconnected.h:40
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::BertaultLayout::req_length
double req_length
number of iterations set by the user
Definition: BertaultLayout.h:194
ogdf::BertaultLayout::CCElement::root
bool root
Definition: BertaultLayout.h:132
ogdf::BertaultLayout::CCElement::faceNum
int faceNum
Definition: BertaultLayout.h:135
ogdf::BertaultLayout::proj::y
double y
Definition: BertaultLayout.h:186
basic.h
Basic declarations, included by all source files.
ogdf::BertaultLayout::BertaultSections
The sections associated with each node.
Definition: BertaultLayout.h:150
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:189
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
List.h
Declaration of doubly linked lists and iterators.
ogdf::BertaultLayout
Definition: BertaultLayout.h:52
ogdf::BertaultLayout::proj::x
double x
Definition: BertaultLayout.h:185
ogdf::BertaultLayout::CCElement::init
void init(int i)
Definition: BertaultLayout.h:139
ogdf::BertaultLayout::reqlength
void reqlength(double length)
Sets the required length. If length <= 0, the average edge length will be used.
Definition: BertaultLayout.h:80
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:240
memory.h
Declaration of memory manager for allocating small pieces of memory.
ogdf::BertaultLayout::surr
Array2D< bool > surr
sets the algorithm to ImPrEd when true
Definition: BertaultLayout.h:197
ogdf::BertaultLayout::reqlength
double reqlength()
Returns the required length.
Definition: BertaultLayout.h:83
ogdf::LayoutModule
Interface of general layout algorithms.
Definition: LayoutModule.h:45
ogdf::List::clear
void clear()
Removes all elements from the list.
Definition: List.h:1626
ogdf::BertaultLayout::CCElement::num
int num
Definition: BertaultLayout.h:133
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:70