Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
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
45namespace ogdf {
46class StaticPlanarSPQRTree;
47enum class RemoveReinsertType;
48
50
59public:
62
65
68
70 virtual EdgeInsertionModule* clone() const override;
71
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
115private:
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
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);
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
189
194 node m_vS, m_vT;
195};
196
197}
Declaration and implementation of Array class and Array algorithms.
Declaration of CombinatorialEmbedding and face.
Declaration of interface for edge insertion algorithms.
Includes declaration of graph class.
Declaration of doubly linked lists and iterators.
Declaration of class PlanRepLight.
Declaration of singly linked lists and iterators.
Basic declarations, included by all source files.
Class for adjacency list elements.
Definition Graph_d.h:143
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:219
Class representing idea of Blocks used in GlobalSifting and GridSifting algorithms.
Definition BlockOrder.h:68
Combinatorial embeddings of planar graphs.
Class for the representation of edges.
Definition Graph_d.h:364
Interface for edge insertion algorithms.
RegisteredArray for labeling the faces of a CombinatorialEmbedding.
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
Doubly linked lists (maintaining the length of the list).
Definition List.h:1451
ReturnType
The return type of a module.
Definition Module.h:52
Multi edge inserter with approximation guarantee.
virtual EdgeInsertionModule * clone() const override
Returns a new instance of the multi-edge approx inserter with the same option settings.
RemoveReinsertType removeReinsertFix() const
Returns the current setting of the remove-reinsert postprocessing method.
double percentMostCrossedVar() const
Returns the current setting of option percentMostCrossed (variable embedding).
Array< List< VertexBlock > > m_pathBCs
NodeArray< SList< VertexBlock > > m_copyInBlocks
static PathDir oppDir(PathDir dir)
Returns the opposite direction of dir.
RemoveReinsertType m_rrOptionFix
The remove-reinsert method for fixed embedding.
void removeReinsertVar(RemoveReinsertType rrOption)
Sets the remove-reinsert postprocessing method.
double m_percentMostCrossedFix
The portion of most crossed edges considered (fixed embedding).
bool dfsPathVertex(node v, int parent, int k, node t)
ReturnType doCall(PlanRepLight &pr, const Array< edge > &origEdges, const EdgeArray< int > *costOrig, const EdgeArray< bool > *forbiddenEdge, const EdgeArray< uint32_t > *edgeSubGraphs) override
Implements the algorithm call.
double percentMostCrossedFix() const
Returns the current setting of option percentMostCrossed.
bool dfsPathBlock(int b, node parent, int k, node t)
int computePathSPQR(int b, node v, node w, int k)
int findShortestPath(node s, node t)
AdjEntryArray< adjEntry > m_primalAdj
MultiEdgeApproxInserter::Block * constructBlock(int i)
node copy(node vOrig, int b)
void embedBlock(int b, int m)
void recFlipPref(adjEntry adjP, NodeArray< EmbeddingPreference > &pi_pick, const NodeArray< bool > &visited, StaticPlanarSPQRTree &spqr)
ConstCombinatorialEmbedding m_E
void constructDual(const PlanRepLight &pr)
RemoveReinsertType m_rrOptionVar
The remove-reinsert method for variable embedding.
void removeReinsertFix(RemoveReinsertType rrOption)
Sets the remove-reinsert postprocessing method.
RemoveReinsertType removeReinsertVar() const
Returns the current setting of the remove-reinsert postprocessing method.
static bool dfsPathSPQR(node v, node v2, edge eParent, List< edge > &path)
MultiEdgeApproxInserter(const MultiEdgeApproxInserter &inserter)
Creates an instance of multi-edge approx inserter with the same settings as inserter.
void percentMostCrossedFix(double percent)
Sets the option percentMostCrossed to percent.
MultiEdgeApproxInserter()
Creates an instance of multi-edge approx inserter with default option settings.
double m_percentMostCrossedVar
The portion of most crossed edges considered (variable embedding).
void percentMostCrossedVar(double percent)
Sets the option percentMostCrossedVar to percent.
MultiEdgeApproxInserter & operator=(const MultiEdgeApproxInserter &inserter)
Assignment operator. Copies option settings only.
Class for the representation of nodes.
Definition Graph_d.h:241
Light-weight version of a planarized representation, associated with a PlanRep.
SPQR-trees of planar graphs.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
RemoveReinsertType
The postprocessing method for edge insertion algorithms.
The namespace for all OGDF objects.
@ None
Two geometric objects do not intersect.