Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

PlanRepExpansion.h
Go to the documentation of this file.
1 
33 #pragma once
34 
35 #include <ogdf/basic/Array.h>
36 #include <ogdf/basic/FaceSet.h>
37 #include <ogdf/basic/Graph.h>
38 #include <ogdf/basic/GraphSets.h>
39 #include <ogdf/basic/List.h>
40 #include <ogdf/basic/SList.h>
41 #include <ogdf/basic/basic.h>
42 
43 #include <ostream>
44 
45 namespace ogdf {
46 class CombinatorialEmbedding;
47 template<class E1, class E2>
48 class Tuple2;
49 
59 public:
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:
86  NodeSplit() { }
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 
116  PlanRepExpansion(const Graph& G);
117 
125  PlanRepExpansion(const Graph& G, const List<node>& splittableNodes);
126 
128 
132 
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 
167  int numberOfSplittedNodes() const;
168 
170  List<NodeSplit>& nodeSplits() { return m_nodeSplits; }
171 
181  List<edge>& setOrigs(edge e, edge& eOrig, nodeSplit& ns);
182 
183  ListConstIterator<edge> position(edge e) const { return m_eIterator[e]; }
184 
185  bool isPseudoCrossing(node v) const;
186 
188  int computeNumberOfCrossings() const;
189 
191 
194 
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 
234 
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 
261  void insertEdgePathEmbedded(edge eOrig, nodeSplit ns, CombinatorialEmbedding& E,
262  const List<Tuple2<adjEntry, adjEntry>>& crossedEdges);
263 
277  void removeEdgePathEmbedded(CombinatorialEmbedding& E, edge eOrig, nodeSplit ns,
278  FaceSet<false>& newFaces, NodeSet<false>& mergedNodes, node& oldSrc, node& oldTgt);
279 
289  void removeEdgePath(edge eOrig, nodeSplit ns, node& oldSrc, node& oldTgt);
290 
299  void contractSplit(nodeSplit ns, CombinatorialEmbedding& E);
300 
308  void contractSplit(nodeSplit ns);
309 
320  edge unsplitExpandNode(node u, edge eContract, edge eExpand, CombinatorialEmbedding& E);
321 
331  edge unsplitExpandNode(node u, edge eContract, edge eExpand);
332 
344  edge enlargeSplit(node v, edge e, CombinatorialEmbedding& E);
345 
356  edge enlargeSplit(node v, edge e);
357 
367  edge splitNodeSplit(edge e, CombinatorialEmbedding& E);
368 
377  edge splitNodeSplit(edge e);
378 
387  void removeSelfLoop(edge e, CombinatorialEmbedding& E);
388 
389  void removeSelfLoop(edge e);
390 
403 
404  edge separateDummy(adjEntry adj_1, adjEntry adj_2, node vStraight, bool isSrc);
405 
406  void resolvePseudoCrossing(node v);
407 
409 
412 
414 #ifdef OGDF_DEBUG
415  void consistencyCheck() const;
416 #endif
417 
419 
420 private:
421  void doInit(const Graph& G, const List<node>& splittableNodes);
422  void prepareNodeSplit(const SList<adjEntry>& partitionLeft, adjEntry& adjLeft,
423  adjEntry& adjRight);
424 
425  const Graph* m_pGraph;
432 
437 
439  int m_numCC;
440 
443 };
444 
445 }
ogdf::PlanRepExpansion::NodeSplit::m_path
List< edge > m_path
The insertion path of the node split.
Definition: PlanRepExpansion.h:103
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::PlanRepExpansion::Crossing
Definition: PlanRepExpansion.h:60
ogdf::PlanRepExpansion::Crossing::m_adj
adjEntry m_adj
Definition: PlanRepExpansion.h:65
ogdf::PlanRepExpansion::m_currentCC
int m_currentCC
The index of the current component.
Definition: PlanRepExpansion.h:438
Graph.h
Includes declaration of graph class.
ogdf::PlanRepExpansion::Crossing::m_partitionLeft
SList< adjEntry > m_partitionLeft
Definition: PlanRepExpansion.h:66
FaceSet.h
Declaration and implementation of ogdf::FaceSet.
ogdf::PlanRepExpansion::currentCC
int currentCC() const
Returns the index of the current connected component (-1 if not yet initialized).
Definition: PlanRepExpansion.h:205
ogdf::PlanRepExpansion::m_eAuxCopy
EdgeArray< edge > m_eAuxCopy
Definition: PlanRepExpansion.h:442
ogdf::PlanRepExpansion::splittable
bool splittable(node v) const
Returns true iff v is splittable.
Definition: PlanRepExpansion.h:156
ogdf::Tuple2
Tuples of two elements (2-tuples).
Definition: tuples.h:49
ogdf::PlanRepExpansion::Crossing::m_partitionRight
SList< adjEntry > m_partitionRight
Definition: PlanRepExpansion.h:67
ogdf::PlanRepExpansion::NodeSplit::m_nsIterator
ListIterator< NodeSplit > m_nsIterator
This node split's iterator in the list of all node splits.
Definition: PlanRepExpansion.h:104
ogdf::sync_plan::split
std::pair< node, node > split(Graph &G, sync_plan::PipeBij &bij, const EdgeArray< edge > *new_edges=nullptr, const EdgeArray< bool > *reverse_edges=nullptr, node src=nullptr, node tgt=nullptr)
ogdf::SList
Singly linked lists (maintaining the length of the list).
Definition: SList.h:845
ogdf::PlanRepExpansion::m_numCC
int m_numCC
The number of components in the original graph.
Definition: PlanRepExpansion.h:439
ogdf::PlanRepExpansion
Planarized representations (of a connected component) of a graph.
Definition: PlanRepExpansion.h:58
ogdf::PlanRepExpansion::m_splittableOrig
NodeArray< bool > m_splittableOrig
Definition: PlanRepExpansion.h:434
ogdf::PlanRepExpansion::nodeSplitOf
NodeSplit * nodeSplitOf(edge e) const
Returns the node split associated with e, or 0 if none (e.g., e belongs to an original edge).
Definition: PlanRepExpansion.h:162
ogdf::PlanRepExpansion::m_vCopy
NodeArray< List< node > > m_vCopy
The corresponding list of nodes in the graph copy.
Definition: PlanRepExpansion.h:431
ogdf::NodeSet< false >
ogdf::PlanRepExpansion::m_eCopy
EdgeArray< List< edge > > m_eCopy
The corresponding list of edges in the graph copy.
Definition: PlanRepExpansion.h:429
ogdf::PlanRepExpansion::m_nodesInCC
Array< List< node > > m_nodesInCC
The list of original nodes in each component.
Definition: PlanRepExpansion.h:441
ogdf::PlanRepExpansion::Crossing::Crossing
Crossing()
Definition: PlanRepExpansion.h:61
GraphSets.h
Declaration and implementation of NodeSet, EdgeSet, and AdjEntrySet classes.
ogdf::PlanRepExpansion::NodeSplit::source
node source() const
Returns the first node on the node split's insertion path.
Definition: PlanRepExpansion.h:96
ogdf::PlanRepExpansion::expansion
const List< node > & expansion(node vOrig) const
Returns the list of copy nodes of vOrig.
Definition: PlanRepExpansion.h:141
ogdf::PlanRepExpansion::NodeSplit::target
node target() const
Returns the last node on the node split's insertion path.
Definition: PlanRepExpansion.h:101
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::PlanRepExpansion::nodesInCC
const List< node > & nodesInCC() const
Returns the list of (original) nodes in the current connected component.
Definition: PlanRepExpansion.h:217
ogdf::PlanRepExpansion::m_vIterator
NodeArray< ListIterator< node > > m_vIterator
The position of copy node in the list.
Definition: PlanRepExpansion.h:430
ogdf::PlanRepExpansion::m_eOrig
EdgeArray< edge > m_eOrig
The corresponding edge in the original graph.
Definition: PlanRepExpansion.h:427
ogdf::PlanRepExpansion::copy
node copy(node vOrig) const
Returns the first copy node of vOrig.
Definition: PlanRepExpansion.h:144
ogdf::PlanRepExpansion::chain
const List< edge > & chain(edge eOrig) const
Returns the insertion path of edge eOrig.
Definition: PlanRepExpansion.h:150
ogdf::PlanRepExpansion::NodeSplit::NodeSplit
NodeSplit(ListIterator< NodeSplit > it)
Creates a node split and sets its iterator in the list of all node splits.
Definition: PlanRepExpansion.h:91
SList.h
Declaration of singly linked lists and iterators.
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:219
ogdf::PlanRepExpansion::splittableOrig
bool splittableOrig(node vOrig) const
Returns true iff vOrig is splittable.
Definition: PlanRepExpansion.h:159
ogdf::FaceSet< false >
ogdf::PlanRepExpansion::m_eNodeSplit
EdgeArray< NodeSplit * > m_eNodeSplit
Definition: PlanRepExpansion.h:435
ogdf::PlanRepExpansion::numberOfCCs
int numberOfCCs() const
Returns the number of connected components in the original graph.
Definition: PlanRepExpansion.h:200
ogdf::PlanRepExpansion::NodeSplit::NodeSplit
NodeSplit()
Creates an empty node split.
Definition: PlanRepExpansion.h:86
ogdf::PlanRepExpansion::position
ListConstIterator< edge > position(edge e) const
Definition: PlanRepExpansion.h:183
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::PlanRepExpansion::m_splittable
NodeArray< bool > m_splittable
Definition: PlanRepExpansion.h:433
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::PlanRepExpansion::m_nodeSplits
List< NodeSplit > m_nodeSplits
Definition: PlanRepExpansion.h:436
ogdf::PlanRepExpansion::m_eIterator
EdgeArray< ListIterator< edge > > m_eIterator
The position of copy edge in the list.
Definition: PlanRepExpansion.h:428
ogdf::PlanRepExpansion::copy
edge copy(edge eOrig) const
Returns the first edge in eOrig's insertion path.
Definition: PlanRepExpansion.h:153
ogdf::PlanRepExpansion::nodeSplits
List< NodeSplit > & nodeSplits()
Returns the list of node splits.
Definition: PlanRepExpansion.h:170
ogdf::PlanRepExpansion::m_vOrig
NodeArray< node > m_vOrig
The corresponding node in the original graph.
Definition: PlanRepExpansion.h:426
ogdf::PlanRepExpansion::Crossing::Crossing
Crossing(adjEntry adj)
Definition: PlanRepExpansion.h:63
basic.h
Basic declarations, included by all source files.
ogdf::PlanRepExpansion::original
node original(node v) const
Returns the original node of v, or 0 if v is a dummy.
Definition: PlanRepExpansion.h:138
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::CombinatorialEmbedding
Combinatorial embeddings of planar graphs with modification functionality.
Definition: CombinatorialEmbedding.h:406
ogdf::PlanRepExpansion::original
const Graph & original() const
Returns a reference to the original graph.
Definition: PlanRepExpansion.h:135
Array.h
Declaration and implementation of Array class and Array algorithms.
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
List.h
Declaration of doubly linked lists and iterators.
ogdf::PlanRepExpansion::numberOfNodeSplits
int numberOfNodeSplits() const
Returns the number of node splits.
Definition: PlanRepExpansion.h:165
ogdf::ListIteratorBase
Encapsulates a pointer to a list element.
Definition: List.h:51
ogdf::PlanRepExpansion::nodesInCC
const List< node > & nodesInCC(int i) const
Returns the list of (original) nodes in connected component i.
Definition: PlanRepExpansion.h:212
ogdf::PlanRepExpansion::Crossing::operator<<
friend std::ostream & operator<<(std::ostream &os, const Crossing &c)
Definition: PlanRepExpansion.h:69
ogdf::PlanRepExpansion::m_pGraph
const Graph * m_pGraph
The original graph.
Definition: PlanRepExpansion.h:425
ogdf::PlanRepExpansion::~PlanRepExpansion
~PlanRepExpansion()
Definition: PlanRepExpansion.h:127
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716