Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
MMFixedEmbeddingInserter.h
Go to the documentation of this file.
1
32#pragma once
33
35#include <ogdf/basic/Graph.h>
36#include <ogdf/basic/basic.h>
40
41namespace ogdf {
42class FaceSet;
43class NodeSet;
44template<class E1, class E2>
45class Tuple2;
46template<class E>
47class List;
48
50
54public:
57
58 // destruction
60
67 OGDF_ASSERT(rrOption != RemoveReinsertType::IncInserted);
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
86private:
96 virtual ReturnType doCall(PlanRepExpansion& PG, const List<edge>& origEdges,
97 const EdgeArray<bool>* forbiddenEdgeOrig) override;
98
100
105
107
123 const List<node>& sources, const List<node>& targets,
124 List<Tuple2<adjEntry, adjEntry>>& crossed, const EdgeArray<bool>* forbiddenEdgeOrig);
125
127 node srcOrig);
128
130 node tgtOrig,
131 //PlanRepExpansion::nodeSplit ns,
133
150 node tgtOrig, PlanRepExpansion::NodeSplit* nodeSplit,
152
166 PlanRepExpansion::NodeSplit* nodeSplit, node& oldSrc, node& oldTgt);
167
176
184
193 PlanRepExpansion::NodeSplit* nodeSplit);
194
205 const PlanRepExpansion::nodeSplit nsCurrent = nullptr);
206
212
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
256
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
310
314};
315
316}
Declaration of CombinatorialEmbedding and face.
Includes declaration of graph class.
Declaration of interface for minor-monotone edge insertion algorithms.
Declaration of class PlanRepExpansion representing a planarized representation of the expansion of a ...
Definition of RemoveReinsertType (used for postprocessing in edge insertion algorithms).
Basic declarations, included by all source files.
Class for adjacency list elements.
Definition Graph_d.h:143
edge theEdge() const
Returns the edge associated with this adjacency entry.
Definition Graph_d.h:161
Combinatorial embeddings of planar graphs with modification functionality.
Class for the representation of edges.
Definition Graph_d.h:364
node target() const
Returns the target node of the edge.
Definition Graph_d.h:402
node source() const
Returns the source node of the edge.
Definition Graph_d.h:399
RegisteredArray for labeling the faces of a CombinatorialEmbedding.
Face sets.
Definition FaceSet.h:51
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
Interface for minor-monotone edge insertion algorithms.
Minor-monotone edge insertion with fixed embedding.
EdgeArray< adjEntry > m_primalAdj
The adjacency entry in primal graph corresponding to edge in dual.
AdjEntryArray< edge > m_dualEdge
The dual edge corresponding to crossing the adjacency entry.
double m_percentMostCrossed
The percentMostCrossed option.
void collectAnchorNodes(node v, NodeSet &nodes, const PlanRepExpansion::NodeSplit *nsParent, const PlanRepExpansion &PG) const
Collects all anchor nodes (including dummies) of a node.
void findShortestPath(const PlanRepExpansion &PG, const CombinatorialEmbedding &E, const List< node > &sources, const List< node > &targets, List< Tuple2< adjEntry, adjEntry > > &crossed, const EdgeArray< bool > *forbiddenEdgeOrig)
Finds a shortest insertion path for an edge.
void insertEdge(PlanRepExpansion &PG, CombinatorialEmbedding &E, edge eOrig, node srcOrig, node tgtOrig, PlanRepExpansion::NodeSplit *nodeSplit, List< Tuple2< adjEntry, adjEntry > > &crossed)
Inserts an edge according to a given insertion path and updates the search network.
bool checkDualGraph(PlanRepExpansion &PG, const CombinatorialEmbedding &E) const
Performs several consistency checks on the seach network.
void removeReinsert(RemoveReinsertType rrOption)
Sets the remove-reinsert option for postprocessing.
void preprocessInsertionPath(PlanRepExpansion &PG, CombinatorialEmbedding &E, node srcOrig, node tgtOrig, List< Tuple2< adjEntry, adjEntry > > &crossed)
NodeArray< node > m_dualOfNode
The node in dual corresponding to node in primal.
void contractSplitIfReq(PlanRepExpansion &PG, CombinatorialEmbedding &E, node u, const PlanRepExpansion::nodeSplit nsCurrent=nullptr)
Reduces the insertion path of a node split at node u if required.
void convertDummy(PlanRepExpansion &PG, CombinatorialEmbedding &E, node u, node vOrig, PlanRepExpansion::nodeSplit ns)
Converts a dummy node to a copy of an original node.
void insertDualEdge(node vDual, adjEntry adj, const CombinatorialEmbedding &E)
Inserts dual edges between vertex node vDual and left face of adj.
virtual ReturnType doCall(PlanRepExpansion &PG, const List< edge > &origEdges, const EdgeArray< bool > *forbiddenEdgeOrig) override
Implementation of algorithm call.
void constructDual(const PlanRepExpansion &PG, const CombinatorialEmbedding &E)
Constructs the search network (extended dual graph).
void drawDual(const PlanRepExpansion &PG, const EdgeArray< bool > *forbiddenEdgeOrig)
MMFixedEmbeddingInserter()
Creates a minor-monotone fixed embedding inserter.
FaceArray< node > m_dualOfFace
The node in dual corresponding to face in primal.
void anchorNodes(node vOrig, NodeSet &nodes, const PlanRepExpansion &PG) const
Returns all anchor nodes of vOrig in n nodes.
int m_maxCost
The maximal cost of an edge in the search network + 1.
void removeEdge(PlanRepExpansion &PG, CombinatorialEmbedding &E, edge eOrig, PlanRepExpansion::NodeSplit *nodeSplit, node &oldSrc, node &oldTgt)
Removes the insertion path of an original edge or a node split and updates the search network.
void contractSplit(PlanRepExpansion &PG, CombinatorialEmbedding &E, PlanRepExpansion::NodeSplit *nodeSplit)
Removes a (redundant) node split consisting of a single edge.
void prepareAnchorNode(PlanRepExpansion &PG, CombinatorialEmbedding &E, adjEntry &adjStart, node srcOrig)
RemoveReinsertType m_rrOption
The remove-reinsert option.
void percentMostCrossed(double percent)
Sets the portion of most crossed edges used during postprocessing.
EdgeArray< int > m_dualCost
The cost of an edge in the seach network.
bool checkSplitDeg(PlanRepExpansion &PG) const
double percentMostCrossed() const
Returns the current setting of the option percentMostCrossed.
void insertDualEdges(node v, const CombinatorialEmbedding &E)
Inserts all dual edges incident to v's dual node.
bool origOfDualForbidden(edge e, const PlanRepExpansion &PG, const EdgeArray< bool > *forbiddenEdgeOrig) const
void findSourcesAndTargets(node src, node tgt, NodeSet &sources, NodeSet &targets, const PlanRepExpansion &PG) const
Finds the set of anchor nodes of src and tgt.
node m_vS
Represents the start node for the path search.
NodeArray< node > m_primalNode
The node in PG corresponding to dual node (0 if face).
node m_vT
Represents the end node for the path search.
Graph m_dual
The search network (extended dual graph).
RemoveReinsertType removeReinsert() const
Returns the current setting of the remove-reinsert option.
node commonDummy(NodeSet &sources, NodeSet &targets)
Returns a common dummy node in sources and targets, or 0 of no such node exists.
ReturnType
The return type of a module.
Definition Module.h:52
Class for the representation of nodes.
Definition Graph_d.h:241
Node sets.
Definition GraphSets.h:54
Representation of a node split in a planarized expansion.
Planarized representations (of a connected component) of a graph.
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).
Tuples of two elements (2-tuples).
Definition tuples.h:49
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.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:52
The namespace for all OGDF objects.