Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

DynamicSPQRTree.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
35 #include <ogdf/basic/List.h>
36 #include <ogdf/basic/basic.h>
40 
41 namespace ogdf {
42 class PertinentGraph;
43 class Skeleton;
44 template<class E>
45 class SList;
46 
80 class OGDF_EXPORT DynamicSPQRTree : public virtual SPQRTree, public DynamicSPQRForest {
81 public:
82  friend class DynamicSkeleton;
83 
84  // constructors
85 
91  explicit DynamicSPQRTree(Graph& G) : DynamicSPQRForest(G) { init(G.firstEdge()); }
92 
99 
100  // destructor
101 
102  ~DynamicSPQRTree();
103 
104  //
105  // a) Access operations
106  //
107 
109  const Graph& originalGraph() const override { return m_G; }
110 
112  const Graph& tree() const override { return m_T; }
113 
115  edge rootEdge() const override { return m_rootEdge; }
116 
118  node rootNode() const override { return findSPQR(m_bNode_SPQR[m_B.firstNode()]); }
119 
121  int numberOfSNodes() const override { return m_bNode_numS[m_B.firstNode()]; }
122 
124  int numberOfPNodes() const override { return m_bNode_numP[m_B.firstNode()]; }
125 
127  int numberOfRNodes() const override { return m_bNode_numR[m_B.firstNode()]; }
128 
133  NodeType typeOf(node v) const override { return (NodeType)m_tNode_type[findSPQR(v)]; }
134 
136  List<node> nodesOfType(NodeType t) const override;
137 
140  return findPathSPQR(m_gNode_hNode[s], m_gNode_hNode[t]);
141  }
142 
147  Skeleton& skeleton(node v) const override {
148  v = findSPQR(v);
149  if (!m_sk[v]) {
150  return createSkeleton(v);
151  }
152  return *m_sk[v];
153  }
154 
159  const Skeleton& skeletonOfReal(edge e) const override {
160  return skeleton(spqrproper(m_gEdge_hEdge[e]));
161  }
162 
167  edge copyOfReal(edge e) const override {
168  e = m_gEdge_hEdge[e];
169  skeleton(spqrproper(e));
170  return m_skelEdge[e];
171  }
172 
178  edge skeletonEdge(node v, node w) const {
179  edge e = virtualEdge(v, w);
180  if (!e) {
181  return e;
182  }
183  skeleton(w);
184  return m_skelEdge[e];
185  }
186 
187  //
188  // b) Update operations
189  //
190 
195  node rootTreeAt(edge e) override;
196 
201  node rootTreeAt(node v) override;
202 
207  edge updateInsertedEdge(edge e) override;
208 
213  node updateInsertedNode(edge e, edge f) override;
214 
215 
216 protected:
218  void init(edge e);
219 
221  DynamicSkeleton& createSkeleton(node vT) const;
222 
227  void cpRec(node v, PertinentGraph& Gp) const override {
228  v = findSPQR(v);
229  for (ListConstIterator<edge> i = m_tNode_hEdges[v]->begin(); i.valid(); ++i) {
230  edge e = m_hEdge_gEdge[*i];
231  if (e) {
232  cpAddEdge(e, Gp);
233  } else if (*i != m_tNode_hRefEdge[v]) {
234  cpRec(spqrproper(*i), Gp);
235  }
236  }
237  }
238 
240 
242 
246 
248 };
249 
250 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
Graph.h
Includes declaration of graph class.
ogdf::DynamicSkeleton
Skeleton graphs of nodes in a dynamic SPQR-tree.
Definition: DynamicSkeleton.h:62
ogdf::DynamicSPQRTree::copyOfReal
edge copyOfReal(edge e) const override
Returns the skeleton edge that corresponds to the real edge e.
Definition: DynamicSPQRTree.h:167
SPQRTree.h
Declaration of class SPQRTree.
ogdf::DynamicSPQRTree
Linear-time implementation of dynamic SPQR-trees.
Definition: DynamicSPQRTree.h:80
ogdf::begin
HypergraphRegistry< HypernodeElement >::iterator begin(const HypergraphRegistry< HypernodeElement > &self)
ogdf::DynamicSPQRTree::tree
const Graph & tree() const override
Returns a reference to the tree T.
Definition: DynamicSPQRTree.h:112
ogdf::SList
Singly linked lists (maintaining the length of the list).
Definition: SList.h:845
ogdf::DynamicSPQRTree::DynamicSPQRTree
DynamicSPQRTree(Graph &G)
Creates an SPQR tree T for graph G rooted at the first edge of G.
Definition: DynamicSPQRTree.h:91
ogdf::SPQRTree
Linear-time implementation of static SPQR-trees.
Definition: SPQRTree.h:73
ogdf::DynamicSPQRTree::rootNode
node rootNode() const override
Returns the root node of T.
Definition: DynamicSPQRTree.h:118
ogdf::DynamicSPQRTree::rootEdge
edge rootEdge() const override
Returns the edge of G at which T is rooted.
Definition: DynamicSPQRTree.h:115
ogdf::DynamicSPQRTree::originalGraph
const Graph & originalGraph() const override
Returns a reference to the original graph G.
Definition: DynamicSPQRTree.h:109
ogdf::DynamicSPQRTree::DynamicSPQRTree
DynamicSPQRTree(Graph &G, edge e)
Creates an SPQR tree T for graph G rooted at the edge e.
Definition: DynamicSPQRTree.h:98
ogdf::DynamicSPQRTree::cpRec
void cpRec(node v, PertinentGraph &Gp) const override
Recursively performs the task of adding edges (and nodes) to the pertinent graph Gp for each involved...
Definition: DynamicSPQRTree.h:227
ogdf::DynamicSPQRTree::m_sk
NodeArray< DynamicSkeleton * > m_sk
pointer to skeleton of a node in T
Definition: DynamicSPQRTree.h:241
ogdf::DynamicSPQRTree::numberOfRNodes
int numberOfRNodes() const override
Returns the number of R-nodes in T.
Definition: DynamicSPQRTree.h:127
DynamicSPQRForest.h
Declaration of class DynamicSPQRForest.
ogdf::DynamicSPQRForest
Dynamic SPQR-forest.
Definition: DynamicSPQRForest.h:56
ogdf::DynamicSPQRTree::m_skelEdge
EdgeArray< edge > m_skelEdge
copies of real and virtual edges in their skeleton graphs (invalid, if the skeleton does not actually...
Definition: DynamicSPQRTree.h:245
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: DfsMakeBiconnected.h:40
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::DynamicSPQRTree::typeOf
NodeType typeOf(node v) const override
Returns the type of node v.
Definition: DynamicSPQRTree.h:133
ogdf::graphics::init
void init()
Definition: graphics.h:450
ogdf::DynamicSPQRTree::skeletonEdge
edge skeletonEdge(node v, node w) const
Returns the virtual edge in the skeleton of w that corresponds to the tree edge between v and w.
Definition: DynamicSPQRTree.h:178
basic.h
Basic declarations, included by all source files.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::SPQRTree::NodeType
NodeType
The type of a tree node in T.
Definition: SPQRTree.h:76
ogdf::DynamicSPQRTree::m_rootEdge
edge m_rootEdge
edge of G at which T is rooted
Definition: DynamicSPQRTree.h:239
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
ogdf::DynamicSPQRTree::skeleton
Skeleton & skeleton(node v) const override
Returns the skeleton of node v.
Definition: DynamicSPQRTree.h:147
ogdf::DynamicSPQRTree::numberOfPNodes
int numberOfPNodes() const override
Returns the number of P-nodes in T.
Definition: DynamicSPQRTree.h:124
List.h
Declaration of doubly linked lists and iterators.
ogdf::Skeleton
Skeleton graphs of nodes in an SPQR-tree.
Definition: Skeleton.h:60
ogdf::PertinentGraph
Pertinent graphs of nodes in an SPQR-tree.
Definition: PertinentGraph.h:58
ogdf::DynamicSPQRTree::skeletonOfReal
const Skeleton & skeletonOfReal(edge e) const override
Returns the skeleton that contains the real edge e.
Definition: DynamicSPQRTree.h:159
ogdf::ListIteratorBase
Encapsulates a pointer to a list element.
Definition: List.h:51
ogdf::DynamicSPQRTree::findPath
SList< node > & findPath(node s, node t)
Finds the shortest path between the two sets of vertices of T which s and t of G belong to.
Definition: DynamicSPQRTree.h:139
ogdf::DynamicSPQRTree::numberOfSNodes
int numberOfSNodes() const override
Returns the number of S-nodes in T.
Definition: DynamicSPQRTree.h:121
DynamicSkeleton.h
Declaration of class DynamicSkeleton.
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::DynamicSPQRTree::m_mapV
NodeArray< node > m_mapV
temporary array used by createSkeleton()
Definition: DynamicSPQRTree.h:247
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716