Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
DynamicSPQRTree.h
Go to the documentation of this file.
1
32#pragma once
33
37
38namespace ogdf {
39
73class OGDF_EXPORT DynamicSPQRTree : public virtual SPQRTree, public DynamicSPQRForest {
74public:
75 friend class DynamicSkeleton;
76
77 // constructors
78
84 explicit DynamicSPQRTree(Graph& G) : DynamicSPQRForest(G) { init(G.firstEdge()); }
85
92
93 // destructor
94
96
97 //
98 // a) Access operations
99 //
100
102 const Graph& originalGraph() const override { return m_G; }
103
105 const Graph& tree() const override { return m_T; }
106
108 edge rootEdge() const override { return m_rootEdge; }
109
111 node rootNode() const override { return findSPQR(m_bNode_SPQR[m_B.firstNode()]); }
112
114 int numberOfSNodes() const override { return m_bNode_numS[m_B.firstNode()]; }
115
117 int numberOfPNodes() const override { return m_bNode_numP[m_B.firstNode()]; }
118
120 int numberOfRNodes() const override { return m_bNode_numR[m_B.firstNode()]; }
121
126 NodeType typeOf(node v) const override { return (NodeType)m_tNode_type[findSPQR(v)]; }
127
130
133 return findPathSPQR(m_gNode_hNode[s], m_gNode_hNode[t]);
134 }
135
140 Skeleton& skeleton(node v) const override {
141 v = findSPQR(v);
142 if (!m_sk[v]) {
143 return createSkeleton(v);
144 }
145 return *m_sk[v];
146 }
147
152 const Skeleton& skeletonOfReal(edge e) const override {
153 return skeleton(spqrproper(m_gEdge_hEdge[e]));
154 }
155
160 edge copyOfReal(edge e) const override {
161 e = m_gEdge_hEdge[e];
162 skeleton(spqrproper(e));
163 return m_skelEdge[e];
164 }
165
172 edge e = virtualEdge(v, w);
173 if (!e) {
174 return e;
175 }
176 skeleton(w);
177 return m_skelEdge[e];
178 }
179
180 //
181 // b) Update operations
182 //
183
188 node rootTreeAt(edge e) override;
189
194 node rootTreeAt(node v) override;
195
201
207
208
209protected:
211 void init(edge e);
212
215
220 void cpRec(node v, PertinentGraph& Gp) const override {
221 v = findSPQR(v);
222 for (ListConstIterator<edge> i = m_tNode_hEdges[v]->begin(); i.valid(); ++i) {
223 edge e = m_hEdge_gEdge[*i];
224 if (e) {
225 cpAddEdge(e, Gp);
226 } else if (*i != m_tNode_hRefEdge[v]) {
227 cpRec(spqrproper(*i), Gp);
228 }
229 }
230 }
231
233
235
239
241};
242
243}
Declaration of class DynamicSPQRForest.
Declaration of class DynamicSkeleton.
Declaration of class SPQRTree.
Dynamic SPQR-forest.
Linear-time implementation of dynamic SPQR-trees.
NodeArray< node > m_mapV
temporary array used by createSkeleton()
DynamicSkeleton & createSkeleton(node vT) const
Creates the skeleton graph belonging to a given vertex vT of T.
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.
int numberOfSNodes() const override
Returns the number of S-nodes in T.
const Graph & originalGraph() const override
Returns a reference to the original graph G.
NodeArray< DynamicSkeleton * > m_sk
pointer to skeleton of a node in T
node rootNode() const override
Returns the root node of T.
DynamicSPQRTree(Graph &G)
Creates an SPQR tree T for graph G rooted at the first edge of G.
edge updateInsertedEdge(edge e) override
Updates the whole data structure after a new edge e has been inserted into G.
const Graph & tree() const override
Returns a reference to the tree T.
edge rootEdge() const override
Returns the edge of G at which T is rooted.
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...
NodeType typeOf(node v) const override
Returns the type of node v.
edge m_rootEdge
edge of G at which T is rooted
const Skeleton & skeletonOfReal(edge e) const override
Returns the skeleton that contains the real edge e.
void init(edge e)
Initialization (called by constructors).
List< node > nodesOfType(NodeType t) const override
Returns the list of all nodes with type t.
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.
DynamicSPQRTree(Graph &G, edge e)
Creates an SPQR tree T for graph G rooted at the edge e.
Skeleton & skeleton(node v) const override
Returns the skeleton of node v.
node updateInsertedNode(edge e, edge f) override
Updates the whole data structure after a new vertex has been inserted into G by splitting an edge int...
node rootTreeAt(edge e) override
Roots T at edge e and returns the new root node of T.
EdgeArray< edge > m_skelEdge
copies of real and virtual edges in their skeleton graphs (invalid, if the skeleton does not actually...
int numberOfRNodes() const override
Returns the number of R-nodes in T.
edge copyOfReal(edge e) const override
Returns the skeleton edge that corresponds to the real edge e.
node rootTreeAt(node v) override
Roots T at node v and returns v.
int numberOfPNodes() const override
Returns the number of P-nodes in T.
Skeleton graphs of nodes in a dynamic SPQR-tree.
Dynamic arrays indexed with edges.
Definition EdgeArray.h:125
Class for the representation of edges.
Definition Graph_d.h:300
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
bool valid() const
Returns true iff the iterator points to an element.
Definition List.h:137
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Class for the representation of nodes.
Definition Graph_d.h:177
Pertinent graphs of nodes in an SPQR-tree.
Singly linked lists (maintaining the length of the list).
Definition SList.h:833
Linear-time implementation of static SPQR-trees.
Definition SPQRTree.h:70
NodeType
The type of a tree node in T.
Definition SPQRTree.h:73
Skeleton graphs of nodes in an SPQR-tree.
Definition Skeleton.h:59
#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.