Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

MMFixedEmbeddingInserter.h
Go to the documentation of this file.
1 
32 #pragma once
33 
35 #include <ogdf/basic/FaceSet.h>
36 #include <ogdf/basic/Graph.h>
37 #include <ogdf/basic/GraphSets.h>
38 #include <ogdf/basic/basic.h>
42 
43 namespace ogdf {
44 template<class E1, class E2>
45 class Tuple2;
46 template<class E>
47 class List;
48 
50 
54 public:
57 
58  // destruction
60 
68  m_rrOption = rrOption;
69  }
70 
72  RemoveReinsertType removeReinsert() const { return m_rrOption; }
73 
75 
80  void percentMostCrossed(double percent) { m_percentMostCrossed = percent; }
81 
83  double percentMostCrossed() const { return m_percentMostCrossed; }
84 
85 
86 private:
96  virtual ReturnType doCall(PlanRepExpansion& PG, const List<edge>& origEdges,
97  const EdgeArray<bool>* forbiddenEdgeOrig) override;
98 
100 
104  void constructDual(const PlanRepExpansion& PG, const CombinatorialEmbedding& E);
105 
107 
122  void findShortestPath(const PlanRepExpansion& PG, const CombinatorialEmbedding& E,
123  const List<node>& sources, const List<node>& targets,
124  List<Tuple2<adjEntry, adjEntry>>& crossed, const EdgeArray<bool>* forbiddenEdgeOrig);
125 
126  void prepareAnchorNode(PlanRepExpansion& PG, CombinatorialEmbedding& E, adjEntry& adjStart,
127  node srcOrig);
128 
129  void preprocessInsertionPath(PlanRepExpansion& PG, CombinatorialEmbedding& E, node srcOrig,
130  node tgtOrig,
131  //PlanRepExpansion::nodeSplit ns,
132  List<Tuple2<adjEntry, adjEntry>>& crossed);
133 
149  void insertEdge(PlanRepExpansion& PG, CombinatorialEmbedding& E, edge eOrig, node srcOrig,
150  node tgtOrig, PlanRepExpansion::NodeSplit* nodeSplit,
151  List<Tuple2<adjEntry, adjEntry>>& crossed);
152 
165  void removeEdge(PlanRepExpansion& PG, CombinatorialEmbedding& E, edge eOrig,
166  PlanRepExpansion::NodeSplit* nodeSplit, node& oldSrc, node& oldTgt);
167 
175  void insertDualEdge(node vDual, adjEntry adj, const CombinatorialEmbedding& E);
176 
183  void insertDualEdges(node v, const CombinatorialEmbedding& E);
184 
192  void contractSplit(PlanRepExpansion& PG, CombinatorialEmbedding& E,
193  PlanRepExpansion::NodeSplit* nodeSplit);
194 
204  void contractSplitIfReq(PlanRepExpansion& PG, CombinatorialEmbedding& E, node u,
205  const PlanRepExpansion::nodeSplit nsCurrent = nullptr);
206 
210  void convertDummy(PlanRepExpansion& PG, CombinatorialEmbedding& E, node u, node vOrig,
212 
222  void collectAnchorNodes(node v, NodeSet<>& nodes, const PlanRepExpansion::NodeSplit* nsParent,
223  const PlanRepExpansion& PG) const;
224 
232  void anchorNodes(node vOrig, NodeSet<>& nodes, const PlanRepExpansion& PG) const;
233 
243  void findSourcesAndTargets(node src, node tgt, NodeSet<>& sources, NodeSet<>& targets,
244  const PlanRepExpansion& PG) const;
245 
252  node commonDummy(NodeSet<>& sources, NodeSet<>& targets);
253 
255  bool checkDualGraph(PlanRepExpansion& PG, const CombinatorialEmbedding& E) const;
256 
257  bool checkSplitDeg(PlanRepExpansion& PG) const;
258 
260  const EdgeArray<bool>* forbiddenEdgeOrig) const {
261  if (forbiddenEdgeOrig == nullptr) {
262  return false;
263  }
264 
265  if (e->source() == m_vS || e->target() == m_vT) {
266  return false;
267  }
268 
269  if (m_primalNode[e->source()] != nullptr) {
270  return false;
271  }
272  if (m_primalNode[e->target()] != nullptr) {
273  return false;
274  }
275 
276  adjEntry adj = m_primalAdj[e];
277  if (adj == nullptr) {
278  return false;
279  }
280 
281  edge eOrig = PG.originalEdge(adj->theEdge());
282  if (eOrig != nullptr) {
283 #if 0
284  if((*forbiddenEdgeOrig)[eOrig]) {
285  std::cout << "forbidden: " << eOrig << ", dual: " << e << std::endl;
286  }
287 #endif
288  return (*forbiddenEdgeOrig)[eOrig];
289  } else {
290  return false;
291  }
292  }
293 
294  void drawDual(const PlanRepExpansion& PG, const EdgeArray<bool>* forbiddenEdgeOrig);
295 
298 
306 
309  int m_maxCost;
310 
314 };
315 
316 }
MMEdgeInsertionModule.h
Declaration of interface for minor-monotone edge insertion algorithms.
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
Graph.h
Includes declaration of graph class.
ogdf::MMFixedEmbeddingInserter::m_dualEdge
AdjEntryArray< edge > m_dualEdge
The dual edge corresponding to crossing the adjacency entry.
Definition: MMFixedEmbeddingInserter.h:304
ogdf::MMFixedEmbeddingInserter::percentMostCrossed
double percentMostCrossed() const
Returns the current setting of the option percentMostCrossed.
Definition: MMFixedEmbeddingInserter.h:83
FaceSet.h
Declaration and implementation of ogdf::FaceSet.
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:66
ogdf::MMFixedEmbeddingInserter::m_dualOfFace
FaceArray< node > m_dualOfFace
The node in dual corresponding to face in primal.
Definition: MMFixedEmbeddingInserter.h:300
ogdf::MMFixedEmbeddingInserter::m_newFaces
FaceSet< false > * m_newFaces
Definition: MMFixedEmbeddingInserter.h:312
ogdf::Tuple2
Tuples of two elements (2-tuples).
Definition: tuples.h:49
ogdf::PlanRepExpansion
Planarized representations (of a connected component) of a graph.
Definition: PlanRepExpansion.h:58
RemoveReinsertType.h
Definition of RemoveReinsertType (used for postprocessing in edge insertion algorithms).
ogdf::NodeSet
Node sets.
Definition: GraphSets.h:57
ogdf::MMFixedEmbeddingInserter::percentMostCrossed
void percentMostCrossed(double percent)
Sets the portion of most crossed edges used during postprocessing.
Definition: MMFixedEmbeddingInserter.h:80
ogdf::MMFixedEmbeddingInserter::m_dualOfNode
NodeArray< node > m_dualOfNode
The node in dual corresponding to node in primal.
Definition: MMFixedEmbeddingInserter.h:301
ogdf::MMFixedEmbeddingInserter::m_vT
node m_vT
Represents the end node for the path search.
Definition: MMFixedEmbeddingInserter.h:308
GraphSets.h
Declaration and implementation of NodeSet, EdgeSet, and AdjEntrySet classes.
ogdf::MMFixedEmbeddingInserter::m_maxCost
int m_maxCost
The maximal cost of an edge in the search network + 1.
Definition: MMFixedEmbeddingInserter.h:309
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::MMFixedEmbeddingInserter::m_delFaces
FaceSet< false > * m_delFaces
Definition: MMFixedEmbeddingInserter.h:311
ogdf::AdjElement::theEdge
edge theEdge() const
Returns the edge associated with this adjacency entry.
Definition: Graph_d.h:160
ogdf::MMFixedEmbeddingInserter::m_percentMostCrossed
double m_percentMostCrossed
The percentMostCrossed option.
Definition: MMFixedEmbeddingInserter.h:297
ogdf::MMFixedEmbeddingInserter::m_mergedNodes
NodeSet< false > * m_mergedNodes
Definition: MMFixedEmbeddingInserter.h:313
ogdf::MMFixedEmbeddingInserter::m_dual
Graph m_dual
The search network (extended dual graph).
Definition: MMFixedEmbeddingInserter.h:299
ogdf::FaceSet< false >
ogdf::MMEdgeInsertionModule
Interface for minor-monotone edge insertion algorithms.
Definition: MMEdgeInsertionModule.h:50
PlanRepExpansion.h
Declaration of class PlanRepExpansion representing a planarized representation of the expansion of a ...
ogdf::EdgeElement::source
node source() const
Returns the source node of the edge.
Definition: Graph_d.h:398
ogdf::PlanRepExpansion::originalEdge
edge originalEdge(edge e) const
Returns the original edge of e, or 0 if e has none (e.g., e belongs to a node split).
Definition: PlanRepExpansion.h:147
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::MMFixedEmbeddingInserter::m_vS
node m_vS
Represents the start node for the path search.
Definition: MMFixedEmbeddingInserter.h:307
basic.h
Basic declarations, included by all source files.
ogdf::MMFixedEmbeddingInserter::origOfDualForbidden
bool origOfDualForbidden(edge e, const PlanRepExpansion &PG, const EdgeArray< bool > *forbiddenEdgeOrig) const
Definition: MMFixedEmbeddingInserter.h:259
ogdf::MMFixedEmbeddingInserter::m_primalAdj
EdgeArray< adjEntry > m_primalAdj
The adjacency entry in primal graph corresponding to edge in dual.
Definition: MMFixedEmbeddingInserter.h:303
CombinatorialEmbedding.h
Declaration of CombinatorialEmbedding and face.
ogdf::MMFixedEmbeddingInserter::~MMFixedEmbeddingInserter
virtual ~MMFixedEmbeddingInserter()
Definition: MMFixedEmbeddingInserter.h:59
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::MMFixedEmbeddingInserter::removeReinsert
void removeReinsert(RemoveReinsertType rrOption)
Sets the remove-reinsert option for postprocessing.
Definition: MMFixedEmbeddingInserter.h:66
ogdf::CombinatorialEmbedding
Combinatorial embeddings of planar graphs with modification functionality.
Definition: CombinatorialEmbedding.h:406
ogdf::RemoveReinsertType
RemoveReinsertType
The postprocessing method for edge insertion algorithms.
Definition: RemoveReinsertType.h:41
ogdf::PlanRepExpansion::NodeSplit
Representation of a node split in a planarized expansion.
Definition: PlanRepExpansion.h:81
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
ogdf::MMFixedEmbeddingInserter
Minor-monotone edge insertion with fixed embedding.
Definition: MMFixedEmbeddingInserter.h:53
ogdf::MMFixedEmbeddingInserter::m_primalNode
NodeArray< node > m_primalNode
The node in PG corresponding to dual node (0 if face).
Definition: MMFixedEmbeddingInserter.h:302
ogdf::MMFixedEmbeddingInserter::removeReinsert
RemoveReinsertType removeReinsert() const
Returns the current setting of the remove-reinsert option.
Definition: MMFixedEmbeddingInserter.h:72
ogdf::RemoveReinsertType::IncInserted
@ IncInserted
Postprocessing for (so far) inserted edges after each edge insertion.
ogdf::EdgeElement::target
node target() const
Returns the target node of the edge.
Definition: Graph_d.h:401
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::MMFixedEmbeddingInserter::m_dualCost
EdgeArray< int > m_dualCost
The cost of an edge in the seach network.
Definition: MMFixedEmbeddingInserter.h:305
ogdf::MMFixedEmbeddingInserter::m_rrOption
RemoveReinsertType m_rrOption
The remove-reinsert option.
Definition: MMFixedEmbeddingInserter.h:296
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716