Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

MultiEdgeApproxInserter.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/FaceArray.h>
38 
39 
40 namespace ogdf {
41 
42 
44 
53 {
54 public:
57 
60 
63 
65  virtual EdgeInsertionModule *clone() const override;
66 
68  MultiEdgeApproxInserter &operator=(const MultiEdgeApproxInserter &inserter);
69 
72  m_rrOptionFix = rrOption;
73  }
74 
77  return m_rrOptionFix;
78  }
79 
82  m_rrOptionVar = rrOption;
83  }
84 
87  return m_rrOptionVar;
88  }
89 
91 
95  void percentMostCrossedFix(double percent) {
96  m_percentMostCrossedFix = percent;
97  }
98 
100  double percentMostCrossedFix() const {
101  return m_percentMostCrossedFix;
102  }
103 
105 
109  void percentMostCrossedVar(double percent) {
110  m_percentMostCrossedVar = percent;
111  }
112 
114  double percentMostCrossedVar() const {
115  return m_percentMostCrossedVar;
116  }
117 
118  void statistics(bool b) {
119  m_statistics = b;
120  }
121 
122  bool statistics() const {
123  return m_statistics;
124  }
125 
126  int sumInsertionCosts() const { return m_sumInsertionCosts; }
127  int sumFEInsertionCosts() const { return m_sumFEInsertionCosts; }
128 
129 private:
130  enum class PathDir { Left, Right, None };
131  static PathDir s_oppDir[3];
132 
134  class Block;
135 
137  class EmbeddingPreference;
138 
139  struct VertexBlock {
140  VertexBlock(node v, int b) : m_vertex(v), m_block(b) { }
141 
143  int m_block;
144  };
145 
147  ReturnType doCall(
148  PlanRepLight &pr,
149  const Array<edge> &origEdges,
150  const EdgeArray<int> *costOrig,
151  const EdgeArray<bool> *forbiddenEdge,
152  const EdgeArray<uint32_t> *edgeSubGraphs) override;
153 
154  MultiEdgeApproxInserter::Block *constructBlock(int i);
155  node copy(node vOrig, int b);
156 
157  static bool dfsPathSPQR(node v, node v2, edge eParent, List<edge> &path);
158  int computePathSPQR(int b, node v, node w, int k);
159 
160  bool dfsPathVertex(node v, int parent, int k, node t);
161  bool dfsPathBlock(int b, node parent, int k, node t);
162  void computePathBC(int k);
163 
164  void embedBlock(int b, int m);
165  void recFlipPref(adjEntry adjP, NodeArray<EmbeddingPreference> &pi_pick, const NodeArray<bool> &visited, StaticPlanarSPQRTree &spqr);
166 
167  void cleanup();
168 
173  bool m_statistics; // !< Generates further statistic information.
174 
175  PlanRepLight *m_pPG; // pointer to plan-rep passed in call
177 
178  NodeArray<SList<int> > m_compV; // m_compV[v] = list of blocks containing v
179  Array<SList<node> > m_verticesB; // m_verticesB[i] = list of vertices in block i
180  Array<SList<edge> > m_edgesB; // edgesB[i] = list of edges in block i
181  NodeArray<node> m_GtoBC; // temporary mapping of nodes in PG to copies in block
182  NodeArray<SList<VertexBlock> > m_copyInBlocks; // mapping of nodes in PG to copies in block
183 
184  const Array<edge> *m_edge; // pointer to array of edges to be inserted
185  Array<List<VertexBlock> > m_pathBCs; // insertion path in BC-tree for each edge
186  Array<int> m_insertionCosts; // computed insertion costs for each edge
187  Array<Block*> m_block; // array of blocks
188 
189  // statistics of last run
192 
193  // just for testing
194  void constructDual(const PlanRepLight &pr);
195  int findShortestPath(node s, node t);
196 
201  node m_vS, m_vT;
202 };
203 
204 
205 } // end namespace ogdf
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:56
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:472
#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:423
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:291
RemoveReinsertType removeReinsertFix() const
Returns the current setting of the remove-reinsert postprocessing method.
Class for the representation of nodes.
Definition: Graph_d.h:167
ConstCombinatorialEmbedding m_E
Multi edge inserter with approximation guarantee.
The namespace for all OGDF objects.
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:78
NodeArray< SList< VertexBlock > > m_copyInBlocks