Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
PlanRepExpansion.h
Go to the documentation of this file.
1
33#pragma once
34
35#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>
40
41#include <ostream>
42
43namespace ogdf {
44class CombinatorialEmbedding;
45class FaceSet;
46class NodeSet;
47template<class E1, class E2>
48class Tuple2;
49
59public:
60 struct Crossing {
61 Crossing() { m_adj = nullptr; }
62
63 explicit Crossing(adjEntry adj) { m_adj = adj; }
64
68
69 friend std::ostream& operator<<(std::ostream& os, const Crossing& c) {
70 os << "(" << c.m_adj << ")";
71 return os;
72 }
73 };
74
81 class NodeSplit {
82 public:
87
91 explicit NodeSplit(ListIterator<NodeSplit> it) : m_nsIterator(it) { }
92
96 node source() const { return m_path.front()->source(); }
97
101 node target() const { return m_path.back()->target(); }
102
105 };
106
109
110
117
125 PlanRepExpansion(const Graph& G, const List<node>& splittableNodes);
126
128
133
135 const Graph& original() const { return *m_pGraph; }
136
138 node original(node v) const { return m_vOrig[v]; }
139
141 const List<node>& expansion(node vOrig) const { return m_vCopy[vOrig]; }
142
144 node copy(node vOrig) const { return m_vCopy[vOrig].front(); }
145
147 edge originalEdge(edge e) const { return m_eOrig[e]; }
148
150 const List<edge>& chain(edge eOrig) const { return m_eCopy[eOrig]; }
151
153 edge copy(edge eOrig) const { return m_eCopy[eOrig].front(); }
154
156 bool splittable(node v) const { return m_splittable[v]; }
157
159 bool splittableOrig(node vOrig) const { return m_splittableOrig[vOrig]; }
160
162 NodeSplit* nodeSplitOf(edge e) const { return m_eNodeSplit[e]; }
163
165 int numberOfNodeSplits() const { return m_nodeSplits.size(); }
166
168
170 List<NodeSplit>& nodeSplits() { return m_nodeSplits; }
171
182
183 ListConstIterator<edge> position(edge e) const { return m_eIterator[e]; }
184
185 bool isPseudoCrossing(node v) const;
186
189
191
195
196
200 int numberOfCCs() const { return m_nodesInCC.size(); }
201
205 int currentCC() const { return m_currentCC; }
206
212 const List<node>& nodesInCC(int i) const { return m_nodesInCC[i]; }
213
217 const List<node>& nodesInCC() const { return m_nodesInCC[m_currentCC]; }
218
227 void initCC(int i);
228
229
231
235
236 edge split(edge e) override;
237
238 void unsplit(edge eIn, edge eOut) override;
239
241 virtual void delEdge(edge e) override;
242
244 bool embed();
245
246 void insertEdgePath(edge eOrig, nodeSplit ns, node vStart, node vEnd, List<Crossing>& eip,
247 edge eSrc, edge eTgt);
248
262 const List<Tuple2<adjEntry, adjEntry>>& crossedEdges);
263
278 FaceSet& newFaces, NodeSet& mergedNodes, node& oldSrc, node& oldTgt);
279
289 void removeEdgePath(edge eOrig, nodeSplit ns, node& oldSrc, node& oldTgt);
290
300
309
321
331 edge unsplitExpandNode(node u, edge eContract, edge eExpand);
332
345
357
368
378
388
390
403
404 edge separateDummy(adjEntry adj_1, adjEntry adj_2, node vStraight, bool isSrc);
405
407
409
413
414#ifdef OGDF_DEBUG
415 void consistencyCheck() const;
416#endif
417
419
420private:
421 void doInit(const Graph& G, const List<node>& splittableNodes);
422 void prepareNodeSplit(const SList<adjEntry>& partitionLeft, adjEntry& adjLeft,
423 adjEntry& adjRight);
424
432
437
440
443};
444
445}
Declaration and implementation of Array class and Array algorithms.
Includes declaration of graph class.
Declaration of doubly linked lists and iterators.
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
Combinatorial embeddings of planar graphs with modification functionality.
Class for the representation of edges.
Definition Graph_d.h:364
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
Encapsulates a pointer to a list element.
Definition List.h:113
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.
List< edge > m_path
The insertion path of the node split.
ListIterator< NodeSplit > m_nsIterator
This node split's iterator in the list of all node splits.
NodeSplit(ListIterator< NodeSplit > it)
Creates a node split and sets its iterator in the list of all node splits.
node target() const
Returns the last node on the node split's insertion path.
NodeSplit()
Creates an empty node split.
node source() const
Returns the first node on the node split's insertion path.
Planarized representations (of a connected component) of a graph.
edge unsplitExpandNode(node u, edge eContract, edge eExpand)
Unsplits a superfluous expansion node of degree 2.
bool embed()
Embeds the planarized expansion; returns true iff it is planar.
EdgeArray< ListIterator< edge > > m_eIterator
The position of copy edge in the list.
const List< node > & expansion(node vOrig) const
Returns the list of copy nodes of vOrig.
NodeArray< bool > m_splittable
edge separateDummy(adjEntry adj_1, adjEntry adj_2, node vStraight, bool isSrc)
EdgeArray< NodeSplit * > m_eNodeSplit
void consistencyCheck() const
void contractSplit(nodeSplit ns)
Removes an (unneccessary) node split consisting of a single edge.
edge split(edge e) override
Splits edge e into two edges introducing a new node.
void removeEdgePathEmbedded(CombinatorialEmbedding &E, edge eOrig, nodeSplit ns, FaceSet &newFaces, NodeSet &mergedNodes, node &oldSrc, node &oldTgt)
Removes the insertion path of eOrig or ns.
int m_currentCC
The index of the current component.
int m_numCC
The number of components in the original graph.
NodeSplit * nodeSplitOf(edge e) const
Returns the node split associated with e, or 0 if none (e.g., e belongs to an original edge).
Array< List< node > > m_nodesInCC
The list of original nodes in each component.
edge unsplitExpandNode(node u, edge eContract, edge eExpand, CombinatorialEmbedding &E)
Unsplits a superfluous expansion node of degree 2.
edge splitNodeSplit(edge e, CombinatorialEmbedding &E)
Introduces a new node split by splitting an exisiting node split.
NodeArray< List< node > > m_vCopy
The corresponding list of nodes in the graph copy.
NodeArray< ListIterator< node > > m_vIterator
The position of copy node in the list.
List< edge > & setOrigs(edge e, edge &eOrig, nodeSplit &ns)
Sets the original edge and corresponding node split of e and returns the corresponding insertion path...
bool isPseudoCrossing(node v) const
NodeArray< bool > m_splittableOrig
void doInit(const Graph &G, const List< node > &splittableNodes)
const List< node > & nodesInCC() const
Returns the list of (original) nodes in the current connected component.
const Graph * m_pGraph
The original graph.
void removeSelfLoop(edge e)
PlanRepExpansion(const Graph &G)
Creates a planarized expansion of graph G.
PlanRepExpansion::nodeSplit convertDummy(node u, node vOrig, PlanRepExpansion::nodeSplit ns)
Converts a dummy node u to a copy of an original node vOrig.
int numberOfCCs() const
Returns the number of connected components in the original graph.
void contractSplit(nodeSplit ns, CombinatorialEmbedding &E)
Removes an (unneccessary) node split consisting of a single edge.
void unsplit(edge eIn, edge eOut) override
Undoes a split operation.
PlanRepExpansion(const Graph &G, const List< node > &splittableNodes)
Creates a planarized expansion of graph G with given splittable nodes.
void insertEdgePath(edge eOrig, nodeSplit ns, node vStart, node vEnd, List< Crossing > &eip, edge eSrc, edge eTgt)
bool splittableOrig(node vOrig) const
Returns true iff vOrig is splittable.
void removeEdgePath(edge eOrig, nodeSplit ns, node &oldSrc, node &oldTgt)
Removes the insertion path of eOrig or ns.
node copy(node vOrig) const
Returns the first copy node of vOrig.
virtual void delEdge(edge e) override
Removes edge e from the planarized expansion.
edge splitNodeSplit(edge e)
Introduces a new node split by splitting an exisiting node split.
int numberOfNodeSplits() const
Returns the number of node splits.
int currentCC() const
Returns the index of the current connected component (-1 if not yet initialized).
int numberOfSplittedNodes() const
bool splittable(node v) const
Returns true iff v is splittable.
void resolvePseudoCrossing(node v)
const Graph & original() const
Returns a reference to the original graph.
EdgeArray< edge > m_eAuxCopy
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).
int computeNumberOfCrossings() const
Computes the number of crossings.
void prepareNodeSplit(const SList< adjEntry > &partitionLeft, adjEntry &adjLeft, adjEntry &adjRight)
const List< edge > & chain(edge eOrig) const
Returns the insertion path of edge eOrig.
ListConstIterator< edge > position(edge e) const
NodeArray< node > m_vOrig
The corresponding node in the original graph.
node original(node v) const
Returns the original node of v, or 0 if v is a dummy.
const List< node > & nodesInCC(int i) const
Returns the list of (original) nodes in connected component i.
List< NodeSplit > m_nodeSplits
EdgeArray< edge > m_eOrig
The corresponding edge in the original graph.
edge copy(edge eOrig) const
Returns the first edge in eOrig's insertion path.
void initCC(int i)
Initializes the planarized representation for connected component i.
edge enlargeSplit(node v, edge e, CombinatorialEmbedding &E)
Splits edge e and introduces a new node split starting at v.
edge enlargeSplit(node v, edge e)
Splits edge e and introduces a new node split starting at v.
void insertEdgePathEmbedded(edge eOrig, nodeSplit ns, CombinatorialEmbedding &E, const List< Tuple2< adjEntry, adjEntry > > &crossedEdges)
Inserts an edge or a node split according to insertion path crossedEdges.
void removeSelfLoop(edge e, CombinatorialEmbedding &E)
Removes a self-loop e = (u,u).
EdgeArray< List< edge > > m_eCopy
The corresponding list of edges in the graph copy.
List< NodeSplit > & nodeSplits()
Returns the list of node splits.
Singly linked lists (maintaining the length of the list).
Definition SList.h:845
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
The namespace for all OGDF objects.
friend std::ostream & operator<<(std::ostream &os, const Crossing &c)