Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

MultiEdgeApproxInserter.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/FaceArray.h>
38 
39 namespace ogdf {
40 
42 
51 {
52 public:
55 
58 
61 
63  virtual EdgeInsertionModule *clone() const override;
64 
66  MultiEdgeApproxInserter &operator=(const MultiEdgeApproxInserter &inserter);
67 
70  m_rrOptionFix = rrOption;
71  }
72 
75  return m_rrOptionFix;
76  }
77 
80  m_rrOptionVar = rrOption;
81  }
82 
85  return m_rrOptionVar;
86  }
87 
89 
93  void percentMostCrossedFix(double percent) {
94  m_percentMostCrossedFix = percent;
95  }
96 
98  double percentMostCrossedFix() const {
99  return m_percentMostCrossedFix;
100  }
101 
103 
107  void percentMostCrossedVar(double percent) {
108  m_percentMostCrossedVar = percent;
109  }
110 
112  double percentMostCrossedVar() const {
113  return m_percentMostCrossedVar;
114  }
115 
116  void statistics(bool b) {
117  m_statistics = b;
118  }
119 
120  bool statistics() const {
121  return m_statistics;
122  }
123 
124  int sumInsertionCosts() const { return m_sumInsertionCosts; }
125  int sumFEInsertionCosts() const { return m_sumFEInsertionCosts; }
126 
127 private:
128  enum class PathDir { Left, Right, None };
129 
131  static inline PathDir oppDir(PathDir dir){
132  switch (dir) {
133  case PathDir::Left:
134  return PathDir::Right;
135  case PathDir::Right:
136  return PathDir::Left;
137  default:
138  return PathDir::None;
139  }
140  };
141 
143  class Block;
144 
146  class EmbeddingPreference;
147 
148  struct VertexBlock {
149  VertexBlock(node v, int b) : m_vertex(v), m_block(b) { }
150 
152  int m_block;
153  };
154 
156  ReturnType doCall(
157  PlanRepLight &pr,
158  const Array<edge> &origEdges,
159  const EdgeArray<int> *costOrig,
160  const EdgeArray<bool> *forbiddenEdge,
161  const EdgeArray<uint32_t> *edgeSubGraphs) override;
162 
163  MultiEdgeApproxInserter::Block *constructBlock(int i);
164  node copy(node vOrig, int b);
165 
166  static bool dfsPathSPQR(node v, node v2, edge eParent, List<edge> &path);
167  int computePathSPQR(int b, node v, node w, int k);
168 
169  bool dfsPathVertex(node v, int parent, int k, node t);
170  bool dfsPathBlock(int b, node parent, int k, node t);
171  void computePathBC(int k);
172 
173  void embedBlock(int b, int m);
174  void recFlipPref(adjEntry adjP, NodeArray<EmbeddingPreference> &pi_pick, const NodeArray<bool> &visited, StaticPlanarSPQRTree &spqr);
175 
176  void cleanup();
177 
182  bool m_statistics; // !< Generates further statistic information.
183 
184  PlanRepLight *m_pPG; // pointer to plan-rep passed in call
186 
187  NodeArray<SList<int> > m_compV; // m_compV[v] = list of blocks containing v
188  Array<SList<node> > m_verticesB; // m_verticesB[i] = list of vertices in block i
189  Array<SList<edge> > m_edgesB; // edgesB[i] = list of edges in block i
190  NodeArray<node> m_GtoBC; // temporary mapping of nodes in PG to copies in block
191  NodeArray<SList<VertexBlock> > m_copyInBlocks; // mapping of nodes in PG to copies in block
192 
193  const Array<edge> *m_edge; // pointer to array of edges to be inserted
194  Array<List<VertexBlock> > m_pathBCs; // insertion path in BC-tree for each edge
195  Array<int> m_insertionCosts; // computed insertion costs for each edge
196  Array<Block*> m_block; // array of blocks
197 
198  // statistics of last run
201 
202  // just for testing
203  void constructDual(const PlanRepLight &pr);
204  int findShortestPath(node s, node t);
205 
210  node m_vS, m_vT;
211 };
212 
213 }
RemoveReinsertType m_rrOptionVar
The remove-reinsert method for variable embedding.
double percentMostCrossedVar() const
Returns the current setting of option percentMostCrossed (variable embedding).
void removeReinsertFix(RemoveReinsertType rrOption)
Sets the remove-reinsert postprocessing method.
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:200
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:492
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
Declaration of interface for edge insertion algorithms.
Combinatorial embeddings of planar graphs.
RemoveReinsertType
The postprocessing method for edge insertion algorithms.
void percentMostCrossedFix(double percent)
Sets the option percentMostCrossed to percent.
double m_percentMostCrossedVar
The portion of most crossed edges considered (variable embedding).
Interface for edge insertion algorithms.
Dynamic arrays indexed with adjacency entries.
declaration and implementation of FaceArray class
Definition of RemoveReinsertType (used for postprocessing in edge insertion algorithms).
ReturnType
The return type of a module.
Definition: Module.h:51
Array< List< VertexBlock > > m_pathBCs
Light-weight version of a planarized representation, associated with a PlanRep.
Definition: PlanRepLight.h:44
Declaration of class StaticPlanarSPQRTree.
RemoveReinsertType removeReinsertVar() const
Returns the current setting of the remove-reinsert postprocessing method.
AdjEntryArray< adjEntry > m_primalAdj
double m_percentMostCrossedFix
The portion of most crossed edges considered (fixed embedding).
Dynamic arrays indexed with faces of a combinatorial embedding.
Dynamic arrays indexed with nodes.
Definition: Graph_d.h:438
double percentMostCrossedFix() const
Returns the current setting of option percentMostCrossed.
void percentMostCrossedVar(double percent)
Sets the option percentMostCrossedVar to percent.
const EdgeArray< int > * m_costOrig
NodeArray< SList< int > > m_compV
static void copy(const T &from, T &to)
Definition: Alg.h:61
Class representing idea of Blocks used in GlobalSifting and GridSifting algorithms.
Definition: BlockOrder.h:72
Class for the representation of edges.
Definition: Graph_d.h:292
RemoveReinsertType removeReinsertFix() const
Returns the current setting of the remove-reinsert postprocessing method.
Class for the representation of nodes.
Definition: Graph_d.h:169
ConstCombinatorialEmbedding m_E
Two geometric objects do not intersect.
Multi edge inserter with approximation guarantee.
The namespace for all OGDF objects.
static PathDir oppDir(PathDir dir)
Returns the opposite direction of dir.
SPQR-trees of planar graphs.
void removeReinsertVar(RemoveReinsertType rrOption)
Sets the remove-reinsert postprocessing method.
RemoveReinsertType m_rrOptionFix
The remove-reinsert method for fixed embedding.
Class for adjacency list elements.
Definition: Graph_d.h:79
NodeArray< SList< VertexBlock > > m_copyInBlocks