Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

StaticSPQRTree.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
35 #include <ogdf/basic/GraphList.h>
36 #include <ogdf/basic/List.h>
37 #include <ogdf/basic/basic.h>
41 
42 namespace ogdf {
43 class PertinentGraph;
44 class Triconnectivity;
45 
79 class OGDF_EXPORT StaticSPQRTree : public virtual SPQRTree {
80 public:
81  friend class StaticSkeleton;
82 
83  // constructors
84 
90  explicit StaticSPQRTree(const Graph& G) : m_skOf(G), m_copyOf(G) {
91  OGDF_ASSERT(G.numberOfEdges() > 0);
92  m_pGraph = &G;
93  init(G.firstEdge());
94  }
95 
101  StaticSPQRTree(const Graph& G, edge e) : m_skOf(G), m_copyOf(G) {
102  m_pGraph = &G;
103  init(e);
104  }
105 
111  StaticSPQRTree(const Graph& G, Triconnectivity& tricComp) : m_skOf(G), m_copyOf(G) {
112  m_pGraph = &G;
113  init(G.firstEdge(), tricComp);
114  }
115 
117  ~StaticSPQRTree();
118 
121 
123  const Graph& originalGraph() const override { return *m_pGraph; }
124 
126  const Graph& tree() const override { return m_tree; }
127 
129  edge rootEdge() const override { return m_rootEdge; }
130 
132  node rootNode() const override { return m_rootNode; }
133 
135  int numberOfSNodes() const override { return m_numS; }
136 
138  int numberOfPNodes() const override { return m_numP; }
139 
141  int numberOfRNodes() const override { return m_numR; }
142 
147  NodeType typeOf(node v) const override { return m_type[v]; }
148 
150  List<node> nodesOfType(NodeType t) const override;
151 
156  Skeleton& skeleton(node v) const override { return *m_sk[v]; }
157 
162  edge skeletonEdgeSrc(edge e) const { return m_skEdgeSrc[e]; }
163 
168  edge skeletonEdgeTgt(edge e) const { return m_skEdgeTgt[e]; }
169 
174  const Skeleton& skeletonOfReal(edge e) const override { return *m_skOf[e]; }
175 
180  edge copyOfReal(edge e) const override { return m_copyOf[e]; }
181 
185 
190  node rootTreeAt(edge e) override;
191 
196  node rootTreeAt(node v) override;
197 
199 
200 protected:
202  void init(edge e);
203 
205  void init(edge eRef, Triconnectivity& tricComp);
206 
208  void rootRec(node v, edge ef);
209 
214  void cpRec(node v, PertinentGraph& Gp) const override {
215  const Skeleton& S = skeleton(v);
216 
217  for (edge e : S.getGraph().edges) {
218  edge eOrig = S.realEdge(e);
219  if (eOrig != nullptr) {
220  cpAddEdge(eOrig, Gp);
221  }
222  }
223 
224  for (adjEntry adj : v->adjEntries) {
225  node w = adj->theEdge()->target();
226  if (w != v) {
227  cpRec(w, Gp);
228  }
229  }
230  }
231 
232  const Graph* m_pGraph;
234 
237 
238  int m_numS;
239  int m_numP;
240  int m_numR;
241 
243 
247 
250 };
251 
252 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
Graph.h
Includes declaration of graph class.
ogdf::StaticSPQRTree::m_sk
NodeArray< StaticSkeleton * > m_sk
pointer to skeleton of a node in T
Definition: StaticSPQRTree.h:244
ogdf::StaticSPQRTree
Linear-time implementation of static SPQR-trees.
Definition: StaticSPQRTree.h:79
ogdf::StaticSPQRTree::m_skEdgeSrc
EdgeArray< edge > m_skEdgeSrc
corresponding edge in skeleton(source(e))
Definition: StaticSPQRTree.h:245
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:66
ogdf::StaticSkeleton
Skeleton graphs of nodes in a static SPQR-tree.
Definition: StaticSkeleton.h:62
SPQRTree.h
Declaration of class SPQRTree.
ogdf::Skeleton::realEdge
virtual edge realEdge(edge e) const =0
Returns the real edge that corresponds to skeleton edge e.
ogdf::StaticSPQRTree::copyOfReal
edge copyOfReal(edge e) const override
Returns the skeleton edge that corresponds to the real edge e.
Definition: StaticSPQRTree.h:180
ogdf::StaticSPQRTree::skeletonEdgeSrc
edge skeletonEdgeSrc(edge e) const
Returns the edge in skeleton of source(e) that corresponds to tree edge e.
Definition: StaticSPQRTree.h:162
ogdf::StaticSPQRTree::numberOfRNodes
int numberOfRNodes() const override
Returns the number of R-nodes in T.
Definition: StaticSPQRTree.h:141
ogdf::SPQRTree
Linear-time implementation of static SPQR-trees.
Definition: SPQRTree.h:73
ogdf::StaticSPQRTree::skeletonOfReal
const Skeleton & skeletonOfReal(edge e) const override
Returns the skeleton that contains the real edge e.
Definition: StaticSPQRTree.h:174
ogdf::StaticSPQRTree::m_skEdgeTgt
EdgeArray< edge > m_skEdgeTgt
corresponding edge in skeleton(target(e))
Definition: StaticSPQRTree.h:246
ogdf::StaticSPQRTree::numberOfSNodes
int numberOfSNodes() const override
Returns the number of S-nodes in T.
Definition: StaticSPQRTree.h:135
ogdf::StaticSPQRTree::StaticSPQRTree
StaticSPQRTree(const Graph &G, Triconnectivity &tricComp)
Creates an SPQR tree T for graph G rooted at the first edge of G.
Definition: StaticSPQRTree.h:111
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::StaticSPQRTree::m_numS
int m_numS
number of S-nodes
Definition: StaticSPQRTree.h:238
ogdf::StaticSPQRTree::m_skOf
EdgeArray< StaticSkeleton * > m_skOf
skeleton containing real edge e
Definition: StaticSPQRTree.h:248
ogdf::StaticSPQRTree::skeleton
Skeleton & skeleton(node v) const override
Returns the skeleton of node v.
Definition: StaticSPQRTree.h:156
ogdf::StaticSPQRTree::skeletonEdgeTgt
edge skeletonEdgeTgt(edge e) const
Returns the edge in skeleton of target(e) that corresponds to tree edge e.
Definition: StaticSPQRTree.h:168
ogdf::AdjElement::theEdge
edge theEdge() const
Returns the edge associated with this adjacency entry.
Definition: Graph_d.h:160
ogdf::StaticSPQRTree::m_type
NodeArray< NodeType > m_type
type of nodes in T
Definition: StaticSPQRTree.h:242
ogdf::StaticSPQRTree::m_copyOf
EdgeArray< edge > m_copyOf
skeleton edge corresponding to real edge e
Definition: StaticSPQRTree.h:249
Skeleton.h
Declaration of class Skeleton.
StaticSkeleton.h
Declaration of class StaticSkeleton.
ogdf::StaticSPQRTree::m_tree
Graph m_tree
underlying tree graph
Definition: StaticSPQRTree.h:233
ogdf::StaticSPQRTree::m_numP
int m_numP
number of P-nodes
Definition: StaticSPQRTree.h:239
GraphList.h
Decralation of GraphElement and GraphList classes.
ogdf::StaticSPQRTree::rootEdge
edge rootEdge() const override
Returns the edge of G at which T is rooted.
Definition: StaticSPQRTree.h:129
ogdf::NodeElement::adjEntries
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
Definition: Graph_d.h:271
ogdf::StaticSPQRTree::m_numR
int m_numR
number of R-nodes
Definition: StaticSPQRTree.h:240
ogdf::StaticSPQRTree::m_rootNode
node m_rootNode
root node of T
Definition: StaticSPQRTree.h:236
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::StaticSPQRTree::StaticSPQRTree
StaticSPQRTree(const Graph &G, edge e)
Creates an SPQR tree T for graph G rooted at the edge e.
Definition: StaticSPQRTree.h:101
ogdf::StaticSPQRTree::originalGraph
const Graph & originalGraph() const override
Returns a reference to the original graph G.
Definition: StaticSPQRTree.h:123
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::StaticSPQRTree::numberOfPNodes
int numberOfPNodes() const override
Returns the number of P-nodes in T.
Definition: StaticSPQRTree.h:138
ogdf::Skeleton::getGraph
const Graph & getGraph() const
Returns a reference to the skeleton graph M.
Definition: Skeleton.h:90
ogdf::StaticSPQRTree::m_pGraph
const Graph * m_pGraph
pointer to original graph
Definition: StaticSPQRTree.h:232
ogdf::StaticSPQRTree::typeOf
NodeType typeOf(node v) const override
Returns the type of node v.
Definition: StaticSPQRTree.h:147
ogdf::StaticSPQRTree::m_rootEdge
edge m_rootEdge
edge of G at which T is rooted
Definition: StaticSPQRTree.h:235
ogdf::graphics::init
void init()
Definition: graphics.h:450
ogdf::StaticSPQRTree::tree
const Graph & tree() const override
Returns a reference to the tree T.
Definition: StaticSPQRTree.h:126
ogdf::Graph::edges
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Definition: Graph_d.h:935
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::StaticSPQRTree::rootNode
node rootNode() const override
Returns the root node of T.
Definition: StaticSPQRTree.h:132
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
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::Triconnectivity
realizes Hopcroft/Tarjan algorithm for finding the triconnected components of a biconnected multi-gra...
Definition: Triconnectivity.h:50
ogdf::EdgeElement::target
node target() const
Returns the target node of the edge.
Definition: Graph_d.h:401
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::StaticSPQRTree::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: StaticSPQRTree.h:214
ogdf::StaticSPQRTree::StaticSPQRTree
StaticSPQRTree(const Graph &G)
Creates an SPQR tree T for graph G rooted at the first edge of G.
Definition: StaticSPQRTree.h:90
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716