Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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 public:
54 
57 
60 
62  virtual EdgeInsertionModule* clone() const override;
63 
65  MultiEdgeApproxInserter& operator=(const MultiEdgeApproxInserter& inserter);
66 
68  void removeReinsertFix(RemoveReinsertType rrOption) { m_rrOptionFix = rrOption; }
69 
71  RemoveReinsertType removeReinsertFix() const { return m_rrOptionFix; }
72 
74  void removeReinsertVar(RemoveReinsertType rrOption) { m_rrOptionVar = rrOption; }
75 
77  RemoveReinsertType removeReinsertVar() const { return m_rrOptionVar; }
78 
80 
84  void percentMostCrossedFix(double percent) { m_percentMostCrossedFix = percent; }
85 
87  double percentMostCrossedFix() const { return m_percentMostCrossedFix; }
88 
90 
94  void percentMostCrossedVar(double percent) { m_percentMostCrossedVar = percent; }
95 
97  double percentMostCrossedVar() const { return m_percentMostCrossedVar; }
98 
99  void statistics(bool b) { m_statistics = b; }
100 
101  bool statistics() const { return m_statistics; }
102 
103  int sumInsertionCosts() const { return m_sumInsertionCosts; }
104 
105  int sumFEInsertionCosts() const { return m_sumFEInsertionCosts; }
106 
107 private:
108  enum class PathDir { Left, Right, None };
109 
111  static inline PathDir oppDir(PathDir dir) {
112  switch (dir) {
113  case PathDir::Left:
114  return PathDir::Right;
115  case PathDir::Right:
116  return PathDir::Left;
117  default:
118  return PathDir::None;
119  }
120  };
121 
123  class Block;
124 
126  class EmbeddingPreference;
127 
128  struct VertexBlock {
129  VertexBlock(node v, int b) : m_vertex(v), m_block(b) { }
130 
132  int m_block;
133  };
134 
136  ReturnType doCall(PlanRepLight& pr, const Array<edge>& origEdges, const EdgeArray<int>* costOrig,
137  const EdgeArray<bool>* forbiddenEdge, const EdgeArray<uint32_t>* edgeSubGraphs) override;
138 
139  MultiEdgeApproxInserter::Block* constructBlock(int i);
140  node copy(node vOrig, int b);
141 
142  static bool dfsPathSPQR(node v, node v2, edge eParent, List<edge>& path);
143  int computePathSPQR(int b, node v, node w, int k);
144 
145  bool dfsPathVertex(node v, int parent, int k, node t);
146  bool dfsPathBlock(int b, node parent, int k, node t);
147  void computePathBC(int k);
148 
149  void embedBlock(int b, int m);
150  void recFlipPref(adjEntry adjP, NodeArray<EmbeddingPreference>& pi_pick,
151  const NodeArray<bool>& visited, StaticPlanarSPQRTree& spqr);
152 
153  void cleanup();
154 
159  bool m_statistics; // !< Generates further statistic information.
160 
161  PlanRepLight* m_pPG; // pointer to plan-rep passed in call
163 
164  NodeArray<SList<int>> m_compV; // m_compV[v] = list of blocks containing v
165  Array<SList<node>> m_verticesB; // m_verticesB[i] = list of vertices in block i
166  Array<SList<edge>> m_edgesB; // edgesB[i] = list of edges in block i
167  NodeArray<node> m_GtoBC; // temporary mapping of nodes in PG to copies in block
168  NodeArray<SList<VertexBlock>> m_copyInBlocks; // mapping of nodes in PG to copies in block
169 
170  const Array<edge>* m_edge; // pointer to array of edges to be inserted
171  Array<List<VertexBlock>> m_pathBCs; // insertion path in BC-tree for each edge
172  Array<int> m_insertionCosts; // computed insertion costs for each edge
173  Array<Block*> m_block; // array of blocks
174 
175  // statistics of last run
178 
179  // just for testing
180  void constructDual(const PlanRepLight& pr);
181  int findShortestPath(node s, node t);
182 
187  node m_vS, m_vT;
188 };
189 
190 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::MultiEdgeApproxInserter::statistics
bool statistics() const
Definition: MultiEdgeApproxInserter.h:101
ogdf::MultiEdgeApproxInserter::m_copyInBlocks
NodeArray< SList< VertexBlock > > m_copyInBlocks
Definition: MultiEdgeApproxInserter.h:168
ogdf::MultiEdgeApproxInserter::percentMostCrossedFix
double percentMostCrossedFix() const
Returns the current setting of option percentMostCrossed.
Definition: MultiEdgeApproxInserter.h:87
ogdf::MultiEdgeApproxInserter::m_edgesB
Array< SList< edge > > m_edgesB
Definition: MultiEdgeApproxInserter.h:166
ogdf::MultiEdgeApproxInserter::statistics
void statistics(bool b)
Definition: MultiEdgeApproxInserter.h:99
ogdf::MultiEdgeApproxInserter::m_percentMostCrossedVar
double m_percentMostCrossedVar
The portion of most crossed edges considered (variable embedding).
Definition: MultiEdgeApproxInserter.h:158
ogdf::MultiEdgeApproxInserter::percentMostCrossedFix
void percentMostCrossedFix(double percent)
Sets the option percentMostCrossed to percent.
Definition: MultiEdgeApproxInserter.h:84
ogdf::MultiEdgeApproxInserter::VertexBlock::m_vertex
node m_vertex
Definition: MultiEdgeApproxInserter.h:131
ogdf::MultiEdgeApproxInserter
Multi edge inserter with approximation guarantee.
Definition: MultiEdgeApproxInserter.h:50
ogdf::MultiEdgeApproxInserter::sumFEInsertionCosts
int sumFEInsertionCosts() const
Definition: MultiEdgeApproxInserter.h:105
StaticPlanarSPQRTree.h
Declaration of class StaticPlanarSPQRTree.
ogdf::MultiEdgeApproxInserter::oppDir
static PathDir oppDir(PathDir dir)
Returns the opposite direction of dir.
Definition: MultiEdgeApproxInserter.h:111
ogdf::MultiEdgeApproxInserter::m_GtoBC
NodeArray< node > m_GtoBC
Definition: MultiEdgeApproxInserter.h:167
ogdf::MultiEdgeApproxInserter::m_primalAdj
AdjEntryArray< adjEntry > m_primalAdj
Definition: MultiEdgeApproxInserter.h:186
ogdf::MultiEdgeApproxInserter::removeReinsertFix
RemoveReinsertType removeReinsertFix() const
Returns the current setting of the remove-reinsert postprocessing method.
Definition: MultiEdgeApproxInserter.h:71
RemoveReinsertType.h
Definition of RemoveReinsertType (used for postprocessing in edge insertion algorithms).
ogdf::Block
Class representing idea of Blocks used in GlobalSifting and GridSifting algorithms.
Definition: BlockOrder.h:70
ogdf::PlanRepLight
Light-weight version of a planarized representation, associated with a PlanRep.
Definition: PlanRepLight.h:43
ogdf::MultiEdgeApproxInserter::~MultiEdgeApproxInserter
~MultiEdgeApproxInserter()
Destructor.
Definition: MultiEdgeApproxInserter.h:59
ogdf::EdgeInsertionModule
Interface for edge insertion algorithms.
Definition: EdgeInsertionModule.h:45
ogdf::MultiEdgeApproxInserter::m_pathBCs
Array< List< VertexBlock > > m_pathBCs
Definition: MultiEdgeApproxInserter.h:171
ogdf::MultiEdgeApproxInserter::m_block
Array< Block * > m_block
Definition: MultiEdgeApproxInserter.h:173
FaceArray.h
declaration and implementation of FaceArray class
ogdf::MultiEdgeApproxInserter::sumInsertionCosts
int sumInsertionCosts() const
Definition: MultiEdgeApproxInserter.h:103
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:135
ogdf::MultiEdgeApproxInserter::PathDir
PathDir
Definition: MultiEdgeApproxInserter.h:108
ogdf::MultiEdgeApproxInserter::percentMostCrossedVar
double percentMostCrossedVar() const
Returns the current setting of option percentMostCrossed (variable embedding).
Definition: MultiEdgeApproxInserter.h:97
Minisat::Internal::copy
static void copy(const T &from, T &to)
Definition: Alg.h:61
ogdf::MultiEdgeApproxInserter::m_statistics
bool m_statistics
Definition: MultiEdgeApproxInserter.h:159
ogdf::MultiEdgeApproxInserter::removeReinsertVar
void removeReinsertVar(RemoveReinsertType rrOption)
Sets the remove-reinsert postprocessing method.
Definition: MultiEdgeApproxInserter.h:74
ogdf::MultiEdgeApproxInserter::m_dual
Graph m_dual
Definition: MultiEdgeApproxInserter.h:184
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:214
ogdf::MultiEdgeApproxInserter::m_sumInsertionCosts
int m_sumInsertionCosts
Definition: MultiEdgeApproxInserter.h:176
ogdf::MultiEdgeApproxInserter::VertexBlock::m_block
int m_block
Definition: MultiEdgeApproxInserter.h:132
ogdf::MultiEdgeApproxInserter::m_pPG
PlanRepLight * m_pPG
Definition: MultiEdgeApproxInserter.h:161
ogdf::MultiEdgeApproxInserter::VertexBlock
Definition: MultiEdgeApproxInserter.h:128
ogdf::MultiEdgeApproxInserter::m_edge
const Array< edge > * m_edge
Definition: MultiEdgeApproxInserter.h:170
ogdf::MultiEdgeApproxInserter::m_rrOptionVar
RemoveReinsertType m_rrOptionVar
The remove-reinsert method for variable embedding.
Definition: MultiEdgeApproxInserter.h:156
ogdf::List< edge >
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:651
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:862
ogdf::FaceArrayBase
RegisteredArray for labeling the faces of a CombinatorialEmbedding.
Definition: CombinatorialEmbedding.h:172
ogdf::MultiEdgeApproxInserter::m_sumFEInsertionCosts
int m_sumFEInsertionCosts
Definition: MultiEdgeApproxInserter.h:177
ogdf::StaticPlanarSPQRTree
SPQR-trees of planar graphs.
Definition: StaticPlanarSPQRTree.h:56
ogdf::ConstCombinatorialEmbedding
Combinatorial embeddings of planar graphs.
Definition: CombinatorialEmbedding.h:207
EdgeInsertionModule.h
Declaration of interface for edge insertion algorithms.
ogdf::MultiEdgeApproxInserter::m_compV
NodeArray< SList< int > > m_compV
Definition: MultiEdgeApproxInserter.h:164
ogdf::MultiEdgeApproxInserter::removeReinsertVar
RemoveReinsertType removeReinsertVar() const
Returns the current setting of the remove-reinsert postprocessing method.
Definition: MultiEdgeApproxInserter.h:77
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::MultiEdgeApproxInserter::m_E
ConstCombinatorialEmbedding m_E
Definition: MultiEdgeApproxInserter.h:183
ogdf::RemoveReinsertType
RemoveReinsertType
The postprocessing method for edge insertion algorithms.
Definition: RemoveReinsertType.h:41
ogdf::MultiEdgeApproxInserter::VertexBlock::VertexBlock
VertexBlock(node v, int b)
Definition: MultiEdgeApproxInserter.h:129
ogdf::MultiEdgeApproxInserter::m_verticesB
Array< SList< node > > m_verticesB
Definition: MultiEdgeApproxInserter.h:165
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
ogdf::MultiEdgeApproxInserter::percentMostCrossedVar
void percentMostCrossedVar(double percent)
Sets the option percentMostCrossedVar to percent.
Definition: MultiEdgeApproxInserter.h:94
ogdf::MultiEdgeApproxInserter::m_rrOptionFix
RemoveReinsertType m_rrOptionFix
The remove-reinsert method for fixed embedding.
Definition: MultiEdgeApproxInserter.h:155
ogdf::MultiEdgeApproxInserter::m_vT
node m_vT
Definition: MultiEdgeApproxInserter.h:187
ogdf::Module::ReturnType
ReturnType
The return type of a module.
Definition: Module.h:50
ogdf::MultiEdgeApproxInserter::m_faceNode
FaceArray< node > m_faceNode
Definition: MultiEdgeApproxInserter.h:185
ogdf::IntersectionType::None
@ None
Two geometric objects do not intersect.
ogdf::MultiEdgeApproxInserter::m_insertionCosts
Array< int > m_insertionCosts
Definition: MultiEdgeApproxInserter.h:172
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::MultiEdgeApproxInserter::m_costOrig
const EdgeArray< int > * m_costOrig
Definition: MultiEdgeApproxInserter.h:162
ogdf::MultiEdgeApproxInserter::m_percentMostCrossedFix
double m_percentMostCrossedFix
The portion of most crossed edges considered (fixed embedding).
Definition: MultiEdgeApproxInserter.h:157
ogdf::MultiEdgeApproxInserter::removeReinsertFix
void removeReinsertFix(RemoveReinsertType rrOption)
Sets the remove-reinsert postprocessing method.
Definition: MultiEdgeApproxInserter.h:68
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:709