Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

EdgeRouter.h
Go to the documentation of this file.
1 
35 #pragma once
36 
37 #include <ogdf/basic/Graph.h>
38 #include <ogdf/basic/List.h>
39 #include <ogdf/basic/basic.h>
43 #include <ogdf/planarity/PlanRep.h>
44 
45 namespace ogdf {
46 class CombinatorialEmbedding;
47 class GridLayoutMapped;
48 template<class ATYPE>
50 
57 
58 public:
59  //constructor
60  EdgeRouter() { }
61 
64  NodeArray<int>& nodeheight);
65 
66  virtual ~EdgeRouter() { }
67 
68  void init(PlanRep& pru, RoutingChannel<int>& rou, bool align = false);
69 
71  void setDistances();
72 
74  void call();
75 
77  void call(PlanRep& pru, OrthoRep& H, GridLayoutMapped& L, CombinatorialEmbedding& E,
79  NodeArray<int>& nodeheight, bool align = false);
80 
82  void place(node v /*, int l_sep, int l_overh*/);
83 
85  void compute_place(node v, NodeInfo& inf /*, int sep = 10.0, int overh = 2*/);
86 
88  void compute_routing(node v);
89 
91  void compute_glue_points_y(node v);
92 
94  void compute_gen_glue_points_y(node v);
95 
97  void compute_glue_points_x(node& v);
98 
100  void compute_gen_glue_points_x(node v);
101 
103  void initialize_node_info(node v, int sep);
104 
106  int cp_x(adjEntry ae) { return m_acp_x[ae]; }
107 
109  int cp_y(adjEntry ae) { return m_acp_y[ae]; }
110 
112  int gp_x(adjEntry ae) { return m_agp_x[ae]; }
113 
115  int gp_y(adjEntry ae) { return m_agp_y[ae]; }
116 
117  void addbends(BendString& bs, const char* s2);
118 
119  edge addRightBend(edge e);
120 
121  edge addLeftBend(edge e);
122 
124  adjEntry outEntry(NodeInfo& inf, OrthoDir d, int pos) {
125  if (inf.is_in_edge(d, pos)) {
126  return (*inf.inList(d).get(pos))->adjTarget();
127  } else {
128  return (*inf.inList(d).get(pos))->adjSource(); //we only bend on outentries
129  }
130  }
131 
133  adjEntry inEntry(NodeInfo& inf, OrthoDir d, int pos) {
134  if (inf.is_in_edge(d, pos)) {
135  return (*inf.inList(d).get(pos))->adjSource();
136  } else {
137  return (*inf.inList(d).get(pos))->adjTarget();
138  }
139  }
140 
142  void set_position(node v, int x = 0, int y = 0);
143 
145  void fix_position(node v, int x = 0, int y = 0);
146 
148 
151  void multiDelta();
152 
154 
157  void align(bool b) { m_align = b; }
158 
159 #if 0
160  void setOrSep(int sep) {m_hasOrSep = true; m_orSep = sep;}
162 #endif
163 
164 private:
166  enum class BendType {
168  BendFree,
170  Bend1Left,
172  Bend1Right,
174  Bend2Left,
176  Bend2Right,
178  ProbBf,
180  ProbB1L,
182  ProbB1R,
184  ProbB2L,
186  ProbB2R
187  };
188 
190  enum class ProcessType {
192  unprocessed,
194  processed,
196  used
197  };
198 
207 
209 
210  int m_sep;
211  int m_overh;
212  double Cconst;
213 
214  BendType abendType(adjEntry ae) { return m_abends[ae]; }
215 
216  void unsplit(edge e1, edge e2);
217 
219  void set_corners(node v);
220 
222  int alpha_move(OrthoDir s_to, OrthoDir s_from, node v);
223 
226 
228  node oppositeNode(adjEntry ae) { return ae->twinNode(); }
229 
232  Graph::NodeType nt;
233  nt = m_prup->typeOf(oppositeNode(ae));
235  }
236 
237  //if yes, set its m_oppositeBendType value according to the newly introduced bend
238 
240 
244  int beta_move(OrthoDir s_from, OrthoDir s_to, int move_num, node v);
245 
247 
250  int compute_move(OrthoDir s_from, OrthoDir s_to, int& kflip, node v);
251 
252  int updateBends(const node v, ListIterator<edge>& it, const bool updateX, const OrthoDir dir,
253  const bool bendLeft, const bool bendUp, int pos = 0);
254 
255  void updateBends(const node v, ListIterator<edge>& it, int& pos, int& lastunbend,
256  const bool updateX, const OrthoDir dir, const bool bendLeft, const bool bendUp,
257  const bool subtract);
258 
259  void updateLowerEdgesBends(const node v, ListIterator<edge>& it, int& pos, int& base,
260  const bool updateX, const OrthoDir dir, const bool bendLeft);
261 
262  void updateOneBend(const bool isDoubleBend, const adjEntry adj, const node v, const OrthoDir dir,
263  const bool bendLeft, const BendType btSingle, const BendType btDouble) {
264  const OrthoDir dirB = bendLeft ? OrthoRep::nextDir(dir) : OrthoRep::prevDir(dir);
265  auto& inf = infos[v];
266 
267  if (isDoubleBend) { // paper E^
268  // must be double-bend
269  m_abends[adj] = btDouble;
270  inf.inc_E(dirB, dir);
271  } else {
272  // may be single-bend
273  m_abends[adj] = btSingle;
274  inf.inc_E_hook(dirB, dir);
275  }
276  }
277 
280  EdgeArray<int> lowe, uppe, lefte, righte;
281  AdjEntryArray<int> alowe, auppe, alefte, arighte;
285 
287 
293 
296 
299 
300  //alignment test
303  bool m_align;
304 };
305 
306 }
ogdf::EdgeRouter::m_mergeDir
NodeArray< OrthoDir > m_mergeDir
direction of adjacent (to) merger edges
Definition: EdgeRouter.h:302
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::EdgeRouter::m_layoutp
GridLayoutMapped * m_layoutp
Definition: EdgeRouter.h:200
Graph.h
Includes declaration of graph class.
ogdf::EdgeRouter::m_nodewidth
NodeArray< int > * m_nodewidth
Definition: EdgeRouter.h:205
ogdf::EdgeRouter::m_prup
PlanRep * m_prup
Definition: EdgeRouter.h:199
ogdf::PlanRep
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:69
ogdf::edge_router::NodeInfo
Definition: NodeInfo.h:55
ogdf::EdgeRouter::m_mergerSon
NodeArray< bool > m_mergerSon
is part of merger son cage
Definition: EdgeRouter.h:301
ogdf::OrthoDir
OrthoDir
Definition: OrthoRep.h:56
ogdf::BendString
Represents the bends on an edge e consisting of vertical and horizontal segments.
Definition: OrthoRep.h:73
ogdf::EdgeRouter::m_agp_y
AdjEntryArray< int > m_agp_y
because edges can connect two replacement cages
Definition: EdgeRouter.h:282
ogdf::EdgeRouter
Places node boxes in replacement areas of orthogonal drawing step and route edges to minimize bends.
Definition: EdgeRouter.h:55
ogdf::EdgeRouter::m_align
bool m_align
Definition: EdgeRouter.h:303
ogdf::EdgeRouter::m_acp_y
AdjEntryArray< int > m_acp_y
edge connection point coordinates before treatment
Definition: EdgeRouter.h:284
NodeInfo.h
Declaration of class NodeInfo.
ogdf::EdgeRouter::m_comb
CombinatorialEmbedding * m_comb
Definition: EdgeRouter.h:202
ogdf::EdgeRouter::updateOneBend
void updateOneBend(const bool isDoubleBend, const adjEntry adj, const node v, const OrthoDir dir, const bool bendLeft, const BendType btSingle, const BendType btDouble)
Definition: EdgeRouter.h:262
ogdf::EdgeRouter::gp_x
int gp_x(adjEntry ae)
Returns assigned glue point (node border) x-coordinate.
Definition: EdgeRouter.h:112
ogdf::EdgeRouter::abendType
BendType abendType(adjEntry ae)
Definition: EdgeRouter.h:214
PlanRep.h
Declaration of a base class for planar representations of graphs and cluster graphs.
ogdf::EdgeRouter::m_processStatus
NodeArray< ProcessType > m_processStatus
keep information about already processed Nodes
Definition: EdgeRouter.h:298
ogdf::edge_router::NodeInfo::is_in_edge
bool is_in_edge(OrthoDir od, int pos)
Definition: NodeInfo.h:191
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::EdgeRouter::oppositeExpander
bool oppositeExpander(adjEntry ae)
check if the target node of the outgoing adjEntry still is a expander
Definition: EdgeRouter.h:231
OrthoRep.h
Declaration of orthogonal representation of planar graphs.
ogdf::OrthoRep
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:225
ogdf::EdgeRouter::gp_y
int gp_y(adjEntry ae)
Returns assigned glue point (node border) y-coordinate.
Definition: EdgeRouter.h:115
ogdf::EdgeRouter::align
void align(bool b)
set alignment option: place nodes in cage at outgoing generalization
Definition: EdgeRouter.h:157
ogdf::EdgeRouter::m_overh
int m_overh
minimum overhang
Definition: EdgeRouter.h:211
ogdf::PlanRep::typeOf
Graph::NodeType typeOf(node v) const
Returns the type of node v.
Definition: PlanRep.h:200
ogdf::EdgeRouter::~EdgeRouter
virtual ~EdgeRouter()
Definition: EdgeRouter.h:66
ogdf::EdgeRouter::m_cage_point
AdjEntryArray< node > m_cage_point
newly introduced bends destroy edge to point connection
Definition: EdgeRouter.h:283
ogdf::OrthoRep::nextDir
static OrthoDir nextDir(OrthoDir d)
Returns the next OrthoDir (in a clockwise manner)
Definition: OrthoRep.h:395
ogdf::EdgeRouter::auppe
AdjEntryArray< int > auppe
Definition: EdgeRouter.h:281
ogdf::EdgeRouter::m_fixed
NodeArray< bool > m_fixed
saves info about changed position, no further change is allowed
Definition: EdgeRouter.h:279
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::EdgeRouter::m_newy
NodeArray< int > m_newy
new placement position for original node
Definition: EdgeRouter.h:278
ogdf::Graph::NodeType
NodeType
The type of nodes.
Definition: Graph_d.h:912
ogdf::EdgeRouter::m_rc
RoutingChannel< int > * m_rc
Definition: EdgeRouter.h:203
ogdf::AdjElement::twinNode
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Definition: Graph_d.h:175
ogdf::EdgeRouter::oppositeNode
node oppositeNode(adjEntry ae)
helper for oppositeExpander
Definition: EdgeRouter.h:228
ogdf::EdgeRouter::cp_y
int cp_y(adjEntry ae)
Returns assigned connection point (cage border) y-coordinate of ae 's source.
Definition: EdgeRouter.h:109
ogdf::EdgeRouter::m_oppositeBendType
NodeArray< BendType > m_oppositeBendType
keep the information about the type of bend inserted at one end of an (originally unbend) edge,...
Definition: EdgeRouter.h:295
ogdf::EdgeRouter::cp_x
int cp_x(adjEntry ae)
Returns assigned connection point (cage border) x-coordinate of ae 's source.
Definition: EdgeRouter.h:106
ogdf::graphics::init
void init()
Definition: graphics.h:450
ogdf::edge_router::NodeInfo::inList
List< edge > & inList(OrthoDir bs)
Definition: NodeInfo.h:133
basic.h
Basic declarations, included by all source files.
ogdf::EdgeRouter::inEntry
adjEntry inEntry(NodeInfo &inf, OrthoDir d, int pos)
adjEntries for edges in inLists
Definition: EdgeRouter.h:133
ogdf::EdgeRouter::Cconst
double Cconst
relative sep to overhang / delta to eps
Definition: EdgeRouter.h:212
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::CombinatorialEmbedding
Combinatorial embeddings of planar graphs with modification functionality.
Definition: CombinatorialEmbedding.h:406
ogdf::Graph::NodeType::lowDegreeExpander
@ lowDegreeExpander
ogdf::EdgeRouter::EdgeRouter
EdgeRouter()
Definition: EdgeRouter.h:60
ogdf::EdgeRouter::ProcessType
ProcessType
Process status of nodes.
Definition: EdgeRouter.h:190
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
ogdf::EdgeRouter::m_med
MinimumEdgeDistances< int > * m_med
Definition: EdgeRouter.h:204
List.h
Declaration of doubly linked lists and iterators.
ogdf::EdgeRouter::outEntry
adjEntry outEntry(NodeInfo &inf, OrthoDir d, int pos)
adjEntries for edges in inLists
Definition: EdgeRouter.h:124
ogdf::EdgeRouter::uppe
EdgeArray< int > uppe
Definition: EdgeRouter.h:280
ogdf::EdgeRouter::infos
NodeArray< NodeInfo > infos
holds the cage and placement information
Definition: EdgeRouter.h:208
ogdf::EdgeRouter::m_nodeheight
NodeArray< int > * m_nodeheight
Definition: EdgeRouter.h:206
ogdf::EdgeRouter::m_orp
OrthoRep * m_orp
Definition: EdgeRouter.h:201
ogdf::GridLayoutMapped
Extends GridLayout by a grid mapping mechanism.
Definition: GridLayoutMapped.h:49
ogdf::EdgeRouter::m_sep
int m_sep
minimum separation
Definition: EdgeRouter.h:210
ogdf::ListIteratorBase
Encapsulates a pointer to a list element.
Definition: List.h:51
RoutingChannel.h
Declaration of class RoutingChannel which maintains required size of routing channels and separation,...
ogdf::MinimumEdgeDistances
Maintains input sizes for improvement compaction (deltas and epsilons)
Definition: EdgeRouter.h:49
ogdf::OrthoRep::prevDir
static OrthoDir prevDir(OrthoDir d)
Returns the previous OrthoDir (in a clockwise manner)
Definition: OrthoRep.h:400
ogdf::EdgeRouter::m_minDelta
bool m_minDelta
set minimum delta values for flip decision and adjust distances correspondingly
Definition: EdgeRouter.h:225
ogdf::Graph::NodeType::highDegreeExpander
@ highDegreeExpander
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::EdgeRouter::m_abends
AdjEntryArray< BendType > m_abends
bends
Definition: EdgeRouter.h:292
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716
ogdf::RoutingChannel< int >
ogdf::EdgeRouter::BendType
BendType
Edge types, defined by necessary bends.
Definition: EdgeRouter.h:166