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
36#include <ogdf/basic/FaceSet.h>
37#include <ogdf/basic/Graph.h>
38#include <ogdf/basic/NodeSet.h>
39#include <ogdf/basic/SList.h>
40#include <ogdf/basic/tuples.h>
41
42namespace ogdf {
43
53public:
54 struct Crossing {
55 Crossing() { m_adj = nullptr; }
56
57 explicit Crossing(adjEntry adj) { m_adj = adj; }
58
62
63 friend std::ostream& operator<<(std::ostream& os, const Crossing& c) {
64 os << "(" << c.m_adj << ")";
65 return os;
66 }
67 };
68
75 class NodeSplit {
76 public:
81
85 explicit NodeSplit(ListIterator<NodeSplit> it) : m_nsIterator(it) { }
86
90 node source() const { return m_path.front()->source(); }
91
95 node target() const { return m_path.back()->target(); }
96
99 };
100
103
104
111
120
122
127
129 const Graph& original() const { return *m_pGraph; }
130
132 node original(node v) const { return m_vOrig[v]; }
133
135 const List<node>& expansion(node vOrig) const { return m_vCopy[vOrig]; }
136
138 node copy(node vOrig) const { return m_vCopy[vOrig].front(); }
139
141 edge originalEdge(edge e) const { return m_eOrig[e]; }
142
144 const List<edge>& chain(edge eOrig) const { return m_eCopy[eOrig]; }
145
147 edge copy(edge eOrig) const { return m_eCopy[eOrig].front(); }
148
150 bool splittable(node v) const { return m_splittable[v]; }
151
153 bool splittableOrig(node vOrig) const { return m_splittableOrig[vOrig]; }
154
156 NodeSplit* nodeSplitOf(edge e) const { return m_eNodeSplit[e]; }
157
159 int numberOfNodeSplits() const { return m_nodeSplits.size(); }
160
162
164 List<NodeSplit>& nodeSplits() { return m_nodeSplits; }
165
176
177 ListConstIterator<edge> position(edge e) const { return m_eIterator[e]; }
178
179 bool isPseudoCrossing(node v) const;
180
183
185
189
190
194 int numberOfCCs() const { return m_nodesInCC.size(); }
195
199 int currentCC() const { return m_currentCC; }
200
206 const List<node>& nodesInCC(int i) const { return m_nodesInCC[i]; }
207
211 const List<node>& nodesInCC() const { return m_nodesInCC[m_currentCC]; }
212
221 void initCC(int i);
222
223
225
229
230 edge split(edge e) override;
231
232 void unsplit(edge eIn, edge eOut) override;
233
235 virtual void delEdge(edge e) override;
236
238 bool embed();
239
241 edge eSrc, edge eTgt);
242
257
273
284
294
303
315
326
339
351
362
372
382
384
397
399
401
403
407
408#ifdef OGDF_DEBUG
409 void consistencyCheck() const;
410#endif
411
413
414private:
415 void doInit(const Graph& G, const List<node>& splittableNodes);
418
426
431
434
437};
438
439}
Declaration of CombinatorialEmbedding and face.
Declaration and implementation of ogdf::FaceSet.
Includes declaration of graph class.
Declaration and implementation of ogdf::NodeSet.
Declaration of singly linked lists and iterators.
Class for adjacency list elements.
Definition Graph_d.h:79
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:214
Combinatorial embeddings of planar graphs with modification functionality.
Dynamic arrays indexed with edges.
Definition EdgeArray.h:125
Class for the representation of edges.
Definition Graph_d.h:300
Face sets.
Definition FaceSet.h:53
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Doubly linked lists (maintaining the length of the list).
Definition List.h:1435
Encapsulates a pointer to a list element.
Definition List.h:103
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Class for the representation of nodes.
Definition Graph_d.h:177
Node sets.
Definition NodeSet.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 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.
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 removeEdgePathEmbedded(CombinatorialEmbedding &E, edge eOrig, nodeSplit ns, FaceSet< false > &newFaces, NodeSet< false > &mergedNodes, node &oldSrc, node &oldTgt)
Removes the insertion path of eOrig or ns.
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:833
Tuples of two elements (2-tuples).
Definition tuples.h:46
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
friend std::ostream & operator<<(std::ostream &os, const Crossing &c)
Declaration and implementation of class Tuple2, Tuple3 and Tuple4.