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/Array.h>
36 #include <ogdf/basic/Graph.h>
37 #include <ogdf/basic/List.h>
38 #include <ogdf/basic/SList.h>
39 #include <ogdf/basic/basic.h>
42 
43 #include <cstdint>
44 
45 namespace ogdf {
46 class StaticPlanarSPQRTree;
47 enum class RemoveReinsertType;
48 
50 
59 public:
62 
65 
68 
70  virtual EdgeInsertionModule* clone() const override;
71 
73  MultiEdgeApproxInserter& operator=(const MultiEdgeApproxInserter& inserter);
74 
76  void removeReinsertFix(RemoveReinsertType rrOption) { m_rrOptionFix = rrOption; }
77 
79  RemoveReinsertType removeReinsertFix() const { return m_rrOptionFix; }
80 
82  void removeReinsertVar(RemoveReinsertType rrOption) { m_rrOptionVar = rrOption; }
83 
85  RemoveReinsertType removeReinsertVar() const { return m_rrOptionVar; }
86 
88 
92  void percentMostCrossedFix(double percent) { m_percentMostCrossedFix = percent; }
93 
95  double percentMostCrossedFix() const { return m_percentMostCrossedFix; }
96 
98 
102  void percentMostCrossedVar(double percent) { m_percentMostCrossedVar = percent; }
103 
105  double percentMostCrossedVar() const { return m_percentMostCrossedVar; }
106 
107  void statistics(bool b) { m_statistics = b; }
108 
109  bool statistics() const { return m_statistics; }
110 
111  int sumInsertionCosts() const { return m_sumInsertionCosts; }
112 
113  int sumFEInsertionCosts() const { return m_sumFEInsertionCosts; }
114 
115 private:
116  enum class PathDir { Left, Right, None };
117 
119  static inline PathDir oppDir(PathDir dir) {
120  switch (dir) {
121  case PathDir::Left:
122  return PathDir::Right;
123  case PathDir::Right:
124  return PathDir::Left;
125  default:
126  return PathDir::None;
127  }
128  };
129 
131  class Block;
133  class EmbeddingPreference;
134 
135  struct VertexBlock {
136  VertexBlock(node v, int b) : m_vertex(v), m_block(b) { }
137 
139  int m_block;
140  };
141 
143  ReturnType doCall(PlanRepLight& pr, const Array<edge>& origEdges, const EdgeArray<int>* costOrig,
144  const EdgeArray<bool>* forbiddenEdge, const EdgeArray<uint32_t>* edgeSubGraphs) override;
145 
146  MultiEdgeApproxInserter::Block* constructBlock(int i);
147  node copy(node vOrig, int b);
148 
149  static bool dfsPathSPQR(node v, node v2, edge eParent, List<edge>& path);
150  int computePathSPQR(int b, node v, node w, int k);
151 
152  bool dfsPathVertex(node v, int parent, int k, node t);
153  bool dfsPathBlock(int b, node parent, int k, node t);
154  void computePathBC(int k);
155 
156  void embedBlock(int b, int m);
157  void recFlipPref(adjEntry adjP, NodeArray<EmbeddingPreference>& pi_pick,
158  const NodeArray<bool>& visited, StaticPlanarSPQRTree& spqr);
159 
160  void cleanup();
161 
166  bool m_statistics; // !< Generates further statistic information.
167 
168  PlanRepLight* m_pPG; // pointer to plan-rep passed in call
170 
171  NodeArray<SList<int>> m_compV; // m_compV[v] = list of blocks containing v
172  Array<SList<node>> m_verticesB; // m_verticesB[i] = list of vertices in block i
173  Array<SList<edge>> m_edgesB; // edgesB[i] = list of edges in block i
174  NodeArray<node> m_GtoBC; // temporary mapping of nodes in PG to copies in block
175  NodeArray<SList<VertexBlock>> m_copyInBlocks; // mapping of nodes in PG to copies in block
176 
177  const Array<edge>* m_edge; // pointer to array of edges to be inserted
178  Array<List<VertexBlock>> m_pathBCs; // insertion path in BC-tree for each edge
179  Array<int> m_insertionCosts; // computed insertion costs for each edge
180  Array<Block*> m_block; // array of blocks
181 
182  // statistics of last run
185 
186  // just for testing
187  void constructDual(const PlanRepLight& pr);
188  int findShortestPath(node s, node t);
189 
194  node m_vS, m_vT;
195 };
196 
197 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::MultiEdgeApproxInserter::statistics
bool statistics() const
Definition: MultiEdgeApproxInserter.h:109
ogdf::MultiEdgeApproxInserter::m_copyInBlocks
NodeArray< SList< VertexBlock > > m_copyInBlocks
Definition: MultiEdgeApproxInserter.h:175
ogdf::MultiEdgeApproxInserter::percentMostCrossedFix
double percentMostCrossedFix() const
Returns the current setting of option percentMostCrossed.
Definition: MultiEdgeApproxInserter.h:95
ogdf::MultiEdgeApproxInserter::m_edgesB
Array< SList< edge > > m_edgesB
Definition: MultiEdgeApproxInserter.h:173
ogdf::MultiEdgeApproxInserter::statistics
void statistics(bool b)
Definition: MultiEdgeApproxInserter.h:107
Graph.h
Includes declaration of graph class.
ogdf::MultiEdgeApproxInserter::m_percentMostCrossedVar
double m_percentMostCrossedVar
The portion of most crossed edges considered (variable embedding).
Definition: MultiEdgeApproxInserter.h:165
ogdf::MultiEdgeApproxInserter::percentMostCrossedFix
void percentMostCrossedFix(double percent)
Sets the option percentMostCrossed to percent.
Definition: MultiEdgeApproxInserter.h:92
ogdf::MultiEdgeApproxInserter::VertexBlock::m_vertex
node m_vertex
Definition: MultiEdgeApproxInserter.h:138
ogdf::MultiEdgeApproxInserter
Multi edge inserter with approximation guarantee.
Definition: MultiEdgeApproxInserter.h:58
ogdf::MultiEdgeApproxInserter::sumFEInsertionCosts
int sumFEInsertionCosts() const
Definition: MultiEdgeApproxInserter.h:113
ogdf::MultiEdgeApproxInserter::oppDir
static PathDir oppDir(PathDir dir)
Returns the opposite direction of dir.
Definition: MultiEdgeApproxInserter.h:119
ogdf::MultiEdgeApproxInserter::m_GtoBC
NodeArray< node > m_GtoBC
Definition: MultiEdgeApproxInserter.h:174
ogdf::MultiEdgeApproxInserter::m_primalAdj
AdjEntryArray< adjEntry > m_primalAdj
Definition: MultiEdgeApproxInserter.h:193
ogdf::MultiEdgeApproxInserter::removeReinsertFix
RemoveReinsertType removeReinsertFix() const
Returns the current setting of the remove-reinsert postprocessing method.
Definition: MultiEdgeApproxInserter.h:79
ogdf::Block
Class representing idea of Blocks used in GlobalSifting and GridSifting algorithms.
Definition: BlockOrder.h:68
ogdf::PlanRepLight
Light-weight version of a planarized representation, associated with a PlanRep.
Definition: PlanRepLight.h:45
ogdf::MultiEdgeApproxInserter::~MultiEdgeApproxInserter
~MultiEdgeApproxInserter()
Destructor.
Definition: MultiEdgeApproxInserter.h:67
ogdf::EdgeInsertionModule
Interface for edge insertion algorithms.
Definition: EdgeInsertionModule.h:50
ogdf::MultiEdgeApproxInserter::m_pathBCs
Array< List< VertexBlock > > m_pathBCs
Definition: MultiEdgeApproxInserter.h:178
ogdf::MultiEdgeApproxInserter::m_block
Array< Block * > m_block
Definition: MultiEdgeApproxInserter.h:180
ogdf::MultiEdgeApproxInserter::sumInsertionCosts
int sumInsertionCosts() const
Definition: MultiEdgeApproxInserter.h:111
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::MultiEdgeApproxInserter::PathDir
PathDir
Definition: MultiEdgeApproxInserter.h:116
ogdf::MultiEdgeApproxInserter::percentMostCrossedVar
double percentMostCrossedVar() const
Returns the current setting of option percentMostCrossed (variable embedding).
Definition: MultiEdgeApproxInserter.h:105
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:166
ogdf::MultiEdgeApproxInserter::removeReinsertVar
void removeReinsertVar(RemoveReinsertType rrOption)
Sets the remove-reinsert postprocessing method.
Definition: MultiEdgeApproxInserter.h:82
ogdf::MultiEdgeApproxInserter::m_dual
Graph m_dual
Definition: MultiEdgeApproxInserter.h:191
SList.h
Declaration of singly linked lists and iterators.
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:219
ogdf::MultiEdgeApproxInserter::m_sumInsertionCosts
int m_sumInsertionCosts
Definition: MultiEdgeApproxInserter.h:183
ogdf::MultiEdgeApproxInserter::VertexBlock::m_block
int m_block
Definition: MultiEdgeApproxInserter.h:139
ogdf::MultiEdgeApproxInserter::m_pPG
PlanRepLight * m_pPG
Definition: MultiEdgeApproxInserter.h:168
ogdf::MultiEdgeApproxInserter::VertexBlock
Definition: MultiEdgeApproxInserter.h:135
ogdf::MultiEdgeApproxInserter::m_edge
const Array< edge > * m_edge
Definition: MultiEdgeApproxInserter.h:177
ogdf::MultiEdgeApproxInserter::m_rrOptionVar
RemoveReinsertType m_rrOptionVar
The remove-reinsert method for variable embedding.
Definition: MultiEdgeApproxInserter.h:163
ogdf::List< edge >
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::FaceArrayBase
RegisteredArray for labeling the faces of a CombinatorialEmbedding.
Definition: CombinatorialEmbedding.h:181
ogdf::MultiEdgeApproxInserter::m_sumFEInsertionCosts
int m_sumFEInsertionCosts
Definition: MultiEdgeApproxInserter.h:184
PlanRepLight.h
Declaration of class PlanRepLight.
ogdf::StaticPlanarSPQRTree
SPQR-trees of planar graphs.
Definition: StaticPlanarSPQRTree.h:55
ogdf::ConstCombinatorialEmbedding
Combinatorial embeddings of planar graphs.
Definition: CombinatorialEmbedding.h:216
EdgeInsertionModule.h
Declaration of interface for edge insertion algorithms.
ogdf::MultiEdgeApproxInserter::m_compV
NodeArray< SList< int > > m_compV
Definition: MultiEdgeApproxInserter.h:171
ogdf::MultiEdgeApproxInserter::removeReinsertVar
RemoveReinsertType removeReinsertVar() const
Returns the current setting of the remove-reinsert postprocessing method.
Definition: MultiEdgeApproxInserter.h:85
basic.h
Basic declarations, included by all source files.
CombinatorialEmbedding.h
Declaration of CombinatorialEmbedding and face.
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:190
ogdf::RemoveReinsertType
RemoveReinsertType
The postprocessing method for edge insertion algorithms.
Definition: RemoveReinsertType.h:41
Array.h
Declaration and implementation of Array class and Array algorithms.
ogdf::MultiEdgeApproxInserter::VertexBlock::VertexBlock
VertexBlock(node v, int b)
Definition: MultiEdgeApproxInserter.h:136
ogdf::MultiEdgeApproxInserter::m_verticesB
Array< SList< node > > m_verticesB
Definition: MultiEdgeApproxInserter.h:172
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
List.h
Declaration of doubly linked lists and iterators.
ogdf::MultiEdgeApproxInserter::percentMostCrossedVar
void percentMostCrossedVar(double percent)
Sets the option percentMostCrossedVar to percent.
Definition: MultiEdgeApproxInserter.h:102
ogdf::MultiEdgeApproxInserter::m_rrOptionFix
RemoveReinsertType m_rrOptionFix
The remove-reinsert method for fixed embedding.
Definition: MultiEdgeApproxInserter.h:162
ogdf::MultiEdgeApproxInserter::m_vT
node m_vT
Definition: MultiEdgeApproxInserter.h:194
ogdf::Module::ReturnType
ReturnType
The return type of a module.
Definition: Module.h:52
ogdf::MultiEdgeApproxInserter::m_faceNode
FaceArray< node > m_faceNode
Definition: MultiEdgeApproxInserter.h:192
ogdf::IntersectionType::None
@ None
Two geometric objects do not intersect.
ogdf::MultiEdgeApproxInserter::m_insertionCosts
Array< int > m_insertionCosts
Definition: MultiEdgeApproxInserter.h:179
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::MultiEdgeApproxInserter::m_costOrig
const EdgeArray< int > * m_costOrig
Definition: MultiEdgeApproxInserter.h:169
ogdf::MultiEdgeApproxInserter::m_percentMostCrossedFix
double m_percentMostCrossedFix
The portion of most crossed edges considered (fixed embedding).
Definition: MultiEdgeApproxInserter.h:164
ogdf::MultiEdgeApproxInserter::removeReinsertFix
void removeReinsertFix(RemoveReinsertType rrOption)
Sets the remove-reinsert postprocessing method.
Definition: MultiEdgeApproxInserter.h:76
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716