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/GridLayout.h>
39 #include <ogdf/basic/Layout.h>
44 #include <ogdf/planarity/PlanRep.h>
45 
46 namespace ogdf {
47 
54 
55 public:
56  //constructor
57  EdgeRouter() { }
58 
61  NodeArray<int>& nodeheight);
62 
63  virtual ~EdgeRouter() { }
64 
65  void init(PlanRep& pru, RoutingChannel<int>& rou, bool align = false);
66 
68  void setDistances();
69 
71  void call();
72 
74  void call(PlanRep& pru, OrthoRep& H, GridLayoutMapped& L, CombinatorialEmbedding& E,
76  NodeArray<int>& nodeheight, bool align = false);
77 
79  void place(node v /*, int l_sep, int l_overh*/);
80 
82  void compute_place(node v, NodeInfo& inf /*, int sep = 10.0, int overh = 2*/);
83 
85  void compute_routing(node v);
86 
88  void compute_glue_points_y(node v);
89 
91  void compute_gen_glue_points_y(node v);
92 
94  void compute_glue_points_x(node& v);
95 
97  void compute_gen_glue_points_x(node v);
98 
100  void initialize_node_info(node v, int sep);
101 
103  int cp_x(adjEntry ae) { return m_acp_x[ae]; }
104 
106  int cp_y(adjEntry ae) { return m_acp_y[ae]; }
107 
109  int gp_x(adjEntry ae) { return m_agp_x[ae]; }
110 
112  int gp_y(adjEntry ae) { return m_agp_y[ae]; }
113 
114  void addbends(BendString& bs, const char* s2);
115 
116  edge addRightBend(edge e);
117 
118  edge addLeftBend(edge e);
119 
121  adjEntry outEntry(NodeInfo& inf, OrthoDir d, int pos) {
122  if (inf.is_in_edge(d, pos)) {
123  return (*inf.inList(d).get(pos))->adjTarget();
124  } else {
125  return (*inf.inList(d).get(pos))->adjSource(); //we only bend on outentries
126  }
127  }
128 
130  adjEntry inEntry(NodeInfo& inf, OrthoDir d, int pos) {
131  if (inf.is_in_edge(d, pos)) {
132  return (*inf.inList(d).get(pos))->adjSource();
133  } else {
134  return (*inf.inList(d).get(pos))->adjTarget();
135  }
136  }
137 
139  void set_position(node v, int x = 0, int y = 0);
140 
142  void fix_position(node v, int x = 0, int y = 0);
143 
145 
148  void multiDelta();
149 
151 
154  void align(bool b) { m_align = b; }
155 
156 #if 0
157  void setOrSep(int sep) {m_hasOrSep = true; m_orSep = sep;}
159 #endif
160 
161 private:
163  enum class BendType {
165  BendFree,
167  Bend1Left,
169  Bend1Right,
171  Bend2Left,
173  Bend2Right,
175  ProbBf,
177  ProbB1L,
179  ProbB1R,
181  ProbB2L,
183  ProbB2R
184  };
185 
187  enum class ProcessType {
189  unprocessed,
191  processed,
193  used
194  };
195 
204 
206 
207  int m_sep;
208  int m_overh;
209  double Cconst;
210 
211  BendType abendType(adjEntry ae) { return m_abends[ae]; }
212 
213  void unsplit(edge e1, edge e2);
214 
216  void set_corners(node v);
217 
219  int alpha_move(OrthoDir s_to, OrthoDir s_from, node v);
220 
223 
225  node oppositeNode(adjEntry ae) { return ae->twinNode(); }
226 
229  Graph::NodeType nt;
230  nt = m_prup->typeOf(oppositeNode(ae));
232  }
233 
234  //if yes, set its m_oppositeBendType value according to the newly introduced bend
235 
237 
241  int beta_move(OrthoDir s_from, OrthoDir s_to, int move_num, node v);
242 
244 
247  int compute_move(OrthoDir s_from, OrthoDir s_to, int& kflip, node v);
248 
249  int updateBends(const node v, ListIterator<edge>& it, const bool updateX, const OrthoDir dir,
250  const bool bendLeft, const bool bendUp, int pos = 0);
251 
252  void updateBends(const node v, ListIterator<edge>& it, int& pos, int& lastunbend,
253  const bool updateX, const OrthoDir dir, const bool bendLeft, const bool bendUp,
254  const bool subtract);
255 
256  void updateLowerEdgesBends(const node v, ListIterator<edge>& it, int& pos, int& base,
257  const bool updateX, const OrthoDir dir, const bool bendLeft);
258 
259  void updateOneBend(const bool isDoubleBend, const adjEntry adj, const node v, const OrthoDir dir,
260  const bool bendLeft, const BendType btSingle, const BendType btDouble) {
261  const OrthoDir dirB = bendLeft ? OrthoRep::nextDir(dir) : OrthoRep::prevDir(dir);
262  auto& inf = infos[v];
263 
264  if (isDoubleBend) { // paper E^
265  // must be double-bend
266  m_abends[adj] = btDouble;
267  inf.inc_E(dirB, dir);
268  } else {
269  // may be single-bend
270  m_abends[adj] = btSingle;
271  inf.inc_E_hook(dirB, dir);
272  }
273  }
274 
277  EdgeArray<int> lowe, uppe, lefte, righte;
278  AdjEntryArray<int> alowe, auppe, alefte, arighte;
282 
284 
290 
293 
296 
297  //alignment test
300  bool m_align;
301 };
302 
303 }
ogdf::EdgeRouter::m_mergeDir
NodeArray< OrthoDir > m_mergeDir
direction of adjacent (to) merger edges
Definition: EdgeRouter.h:299
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::EdgeRouter::m_layoutp
GridLayoutMapped * m_layoutp
Definition: EdgeRouter.h:197
ogdf::EdgeRouter::m_nodewidth
NodeArray< int > * m_nodewidth
Definition: EdgeRouter.h:202
ogdf::EdgeRouter::m_prup
PlanRep * m_prup
Definition: EdgeRouter.h:196
ogdf::PlanRep
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:57
Layout.h
Declaration of class Layout.
ogdf::edge_router::NodeInfo
Definition: NodeInfo.h:51
ogdf::EdgeRouter::m_mergerSon
NodeArray< bool > m_mergerSon
is part of merger son cage
Definition: EdgeRouter.h:298
ogdf::OrthoDir
OrthoDir
Definition: OrthoRep.h:50
GridLayoutMapped.h
Declaration of class GridLayoutMapped which extends GridLayout by a grid mapping mechanism.
ogdf::BendString
Represents the bends on an edge e consisting of vertical and horizontal segments.
Definition: OrthoRep.h:67
ogdf::EdgeRouter::m_agp_y
AdjEntryArray< int > m_agp_y
because edges can connect two replacement cages
Definition: EdgeRouter.h:279
ogdf::EdgeRouter
Places node boxes in replacement areas of orthogonal drawing step and route edges to minimize bends.
Definition: EdgeRouter.h:52
ogdf::EdgeRouter::m_align
bool m_align
Definition: EdgeRouter.h:300
ogdf::EdgeRouter::m_acp_y
AdjEntryArray< int > m_acp_y
edge connection point coordinates before treatment
Definition: EdgeRouter.h:281
NodeInfo.h
Declaration of class NodeInfo.
ogdf::EdgeRouter::m_comb
CombinatorialEmbedding * m_comb
Definition: EdgeRouter.h:199
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:259
ogdf::EdgeRouter::gp_x
int gp_x(adjEntry ae)
Returns assigned glue point (node border) x-coordinate.
Definition: EdgeRouter.h:109
ogdf::EdgeRouter::abendType
BendType abendType(adjEntry ae)
Definition: EdgeRouter.h:211
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:295
ogdf::edge_router::NodeInfo::is_in_edge
bool is_in_edge(OrthoDir od, int pos)
Definition: NodeInfo.h:187
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:135
ogdf::EdgeRouter::oppositeExpander
bool oppositeExpander(adjEntry ae)
check if the target node of the outgoing adjEntry still is a expander
Definition: EdgeRouter.h:228
OrthoRep.h
Declaration of orthogonal representation of planar graphs.
ogdf::OrthoRep
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:219
ogdf::EdgeRouter::gp_y
int gp_y(adjEntry ae)
Returns assigned glue point (node border) y-coordinate.
Definition: EdgeRouter.h:112
MinimumEdgeDistances.h
Declaration of class MinimumEdgeDistances which maintains minimum distances between attached edges at...
ogdf::EdgeRouter::align
void align(bool b)
set alignment option: place nodes in cage at outgoing generalization
Definition: EdgeRouter.h:154
ogdf::EdgeRouter::m_overh
int m_overh
minimum overhang
Definition: EdgeRouter.h:208
ogdf::PlanRep::typeOf
Graph::NodeType typeOf(node v) const
Returns the type of node v.
Definition: PlanRep.h:188
ogdf::EdgeRouter::~EdgeRouter
virtual ~EdgeRouter()
Definition: EdgeRouter.h:63
ogdf::EdgeRouter::m_cage_point
AdjEntryArray< node > m_cage_point
newly introduced bends destroy edge to point connection
Definition: EdgeRouter.h:280
ogdf::OrthoRep::nextDir
static OrthoDir nextDir(OrthoDir d)
Returns the next OrthoDir (in a clockwise manner)
Definition: OrthoRep.h:389
ogdf::EdgeRouter::auppe
AdjEntryArray< int > auppe
Definition: EdgeRouter.h:278
ogdf::EdgeRouter::m_fixed
NodeArray< bool > m_fixed
saves info about changed position, no further change is allowed
Definition: EdgeRouter.h:276
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:651
ogdf::EdgeRouter::m_newy
NodeArray< int > m_newy
new placement position for original node
Definition: EdgeRouter.h:275
ogdf::Graph::NodeType
NodeType
The type of nodes.
Definition: Graph_d.h:904
ogdf::EdgeRouter::m_rc
RoutingChannel< int > * m_rc
Definition: EdgeRouter.h:200
ogdf::AdjElement::twinNode
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Definition: Graph_d.h:168
ogdf::EdgeRouter::oppositeNode
node oppositeNode(adjEntry ae)
helper for oppositeExpander
Definition: EdgeRouter.h:225
ogdf::EdgeRouter::cp_y
int cp_y(adjEntry ae)
Returns assigned connection point (cage border) y-coordinate of ae 's source.
Definition: EdgeRouter.h:106
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:292
ogdf::EdgeRouter::cp_x
int cp_x(adjEntry ae)
Returns assigned connection point (cage border) x-coordinate of ae 's source.
Definition: EdgeRouter.h:103
ogdf::graphics::init
void init()
Definition: graphics.h:446
ogdf::edge_router::NodeInfo::inList
List< edge > & inList(OrthoDir bs)
Definition: NodeInfo.h:129
ogdf::EdgeRouter::inEntry
adjEntry inEntry(NodeInfo &inf, OrthoDir d, int pos)
adjEntries for edges in inLists
Definition: EdgeRouter.h:130
ogdf::EdgeRouter::Cconst
double Cconst
relative sep to overhang / delta to eps
Definition: EdgeRouter.h:209
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:397
ogdf::Graph::NodeType::lowDegreeExpander
@ lowDegreeExpander
ogdf::EdgeRouter::EdgeRouter
EdgeRouter()
Definition: EdgeRouter.h:57
ogdf::EdgeRouter::ProcessType
ProcessType
Process status of nodes.
Definition: EdgeRouter.h:187
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
ogdf::EdgeRouter::m_med
MinimumEdgeDistances< int > * m_med
Definition: EdgeRouter.h:201
ogdf::EdgeRouter::outEntry
adjEntry outEntry(NodeInfo &inf, OrthoDir d, int pos)
adjEntries for edges in inLists
Definition: EdgeRouter.h:121
ogdf::EdgeRouter::uppe
EdgeArray< int > uppe
Definition: EdgeRouter.h:277
ogdf::EdgeRouter::infos
NodeArray< NodeInfo > infos
holds the cage and placement information
Definition: EdgeRouter.h:205
ogdf::EdgeRouter::m_nodeheight
NodeArray< int > * m_nodeheight
Definition: EdgeRouter.h:203
ogdf::EdgeRouter::m_orp
OrthoRep * m_orp
Definition: EdgeRouter.h:198
ogdf::GridLayoutMapped
Extends GridLayout by a grid mapping mechanism.
Definition: GridLayoutMapped.h:46
ogdf::EdgeRouter::m_sep
int m_sep
minimum separation
Definition: EdgeRouter.h:207
ogdf::ListIteratorBase
Encapsulates a pointer to a list element.
Definition: List.h:46
RoutingChannel.h
Declaration of class RoutingChannel which maintains required size of routing channels and separation,...
ogdf::MinimumEdgeDistances< int >
ogdf::OrthoRep::prevDir
static OrthoDir prevDir(OrthoDir d)
Returns the previous OrthoDir (in a clockwise manner)
Definition: OrthoRep.h:394
ogdf::EdgeRouter::m_minDelta
bool m_minDelta
set minimum delta values for flip decision and adjust distances correspondingly
Definition: EdgeRouter.h:222
ogdf::Graph::NodeType::highDegreeExpander
@ highDegreeExpander
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
GridLayout.h
Declaration of class GridLayout.
ogdf::EdgeRouter::m_abends
AdjEntryArray< BendType > m_abends
bends
Definition: EdgeRouter.h:289
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:709
ogdf::RoutingChannel< int >
ogdf::EdgeRouter::BendType
BendType
Edge types, defined by necessary bends.
Definition: EdgeRouter.h:163