Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

StaticSPQRTree.h
Go to the documentation of this file.
1 
32 #pragma once
33 
37 
38 namespace ogdf {
39 
73 class OGDF_EXPORT StaticSPQRTree : public virtual SPQRTree
74 {
75 public:
76  friend class StaticSkeleton;
77 
78  // constructors
79 
85  explicit StaticSPQRTree(const Graph &G) : m_skOf(G), m_copyOf(G) { OGDF_ASSERT(G.numberOfEdges() > 0); m_pGraph = &G; init(G.firstEdge()); }
86 
92  StaticSPQRTree(const Graph &G, edge e) : m_skOf(G), m_copyOf(G) { m_pGraph = &G; init(e); }
93 
99  StaticSPQRTree(const Graph &G, Triconnectivity &tricComp) : m_skOf(G), m_copyOf(G) { m_pGraph = &G; init(G.firstEdge(),tricComp); }
100 
102  ~StaticSPQRTree();
103 
106 
108  const Graph &originalGraph() const override { return *m_pGraph; }
109 
111  const Graph &tree() const override { return m_tree; }
112 
114  edge rootEdge() const override { return m_rootEdge; }
115 
117  node rootNode() const override { return m_rootNode; }
118 
120  int numberOfSNodes() const override { return m_numS; }
121 
123  int numberOfPNodes() const override { return m_numP; }
124 
126  int numberOfRNodes() const override { return m_numR; }
127 
132  NodeType typeOf(node v) const override { return m_type[v]; }
133 
135  List<node> nodesOfType(NodeType t) const override;
136 
141  Skeleton &skeleton(node v) const override { return *m_sk[v]; }
142 
147  edge skeletonEdgeSrc(edge e) const { return m_skEdgeSrc[e]; }
148 
153  edge skeletonEdgeTgt(edge e) const { return m_skEdgeTgt[e]; }
154 
159  const Skeleton &skeletonOfReal(edge e) const override { return *m_skOf[e]; }
160 
165  edge copyOfReal(edge e) const override { return m_copyOf[e]; }
166 
170 
175  node rootTreeAt(edge e) override;
176 
181  node rootTreeAt(node v) override;
182 
184 
185 protected:
186 
188  void init(edge e);
189 
191  void init(edge eRef, Triconnectivity &tricComp);
192 
194  void rootRec(node v, edge ef);
195 
200  void cpRec(node v, PertinentGraph &Gp) const override
201  {
202  const Skeleton &S = skeleton(v);
203 
204  for(edge e : S.getGraph().edges) {
205  edge eOrig = S.realEdge(e);
206  if (eOrig != nullptr) cpAddEdge(eOrig,Gp);
207  }
208 
209  for(adjEntry adj : v->adjEntries) {
210  node w = adj->theEdge()->target();
211  if (w != v) cpRec(w,Gp);
212  }
213  }
214 
215 
216  const Graph *m_pGraph;
218 
221 
222  int m_numS;
223  int m_numP;
224  int m_numR;
225 
227 
231 
234 
235 }; // class StaticSPQRTree
236 
237 
238 } // end namespace ogdf
Skeleton graphs of nodes in a static SPQR-tree.
node target() const
Returns the target node of the edge.
Definition: Graph_d.h:327
virtual edge realEdge(edge e) const =0
Returns the real edge that corresponds to skeleton edge e.
edge skeletonEdgeTgt(edge e) const
Returns the edge in skeleton of target(e) that corresponds to tree edge e.
edge theEdge() const
Returns the edge associated with this adjacency entry.
Definition: Graph_d.h:95
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:472
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
int numberOfSNodes() const override
Returns the number of S-nodes in T.
const Graph & getGraph() const
Returns a reference to the skeleton graph M.
Definition: Skeleton.h:99
EdgeArray< edge > m_copyOf
skeleton edge corresponding to real edge e
const Skeleton & skeletonOfReal(edge e) const override
Returns the skeleton that contains the real edge e.
const Graph & originalGraph() const override
Returns a reference to the original graph G.
NodeArray< StaticSkeleton * > m_sk
pointer to skeleton of a node in T
int numberOfRNodes() const override
Returns the number of R-nodes in T.
Dynamic arrays indexed with edges.
Definition: EdgeArray.h:112
Skeleton graphs of nodes in an SPQR-tree.
Definition: Skeleton.h:61
EdgeArray< StaticSkeleton * > m_skOf
skeleton containing real edge e
Pertinent graphs of nodes in an SPQR-tree.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Definition: Graph_d.h:548
int numberOfEdges() const
Returns the number of edges in the graph.
Definition: Graph_d.h:581
EdgeArray< edge > m_skEdgeSrc
corresponding edge in skeleton(source(e))
NodeType typeOf(node v) const override
Returns the type of node v.
edge firstEdge() const
Returns the first edge in the list of all edges.
Definition: Graph_d.h:603
edge rootEdge() const override
Returns the edge of G at which T is rooted.
int m_numS
number of S-nodes
Doubly linked lists (maintaining the length of the list).
Definition: List.h:39
Declares class Triconnectivity which realizes the Hopcroft/Tarjan algorithm for finding the triconnec...
Class for the representation of edges.
Definition: Graph_d.h:291
StaticSPQRTree(const Graph &G, edge e)
Creates an SPQR tree T for graph G rooted at the edge e.
Class for the representation of nodes.
Definition: Graph_d.h:167
Declaration of class SPQRTree.
node m_rootNode
root node of T
NodeArray< NodeType > m_type
type of nodes in T
Graph m_tree
underlying tree graph
Skeleton & skeleton(node v) const override
Returns the skeleton of node v.
StaticSPQRTree(const Graph &G, Triconnectivity &tricComp)
Creates an SPQR tree T for graph G rooted at the first edge of G.
Linear-time implementation of static SPQR-trees.
EdgeArray< edge > m_skEdgeTgt
corresponding edge in skeleton(target(e))
node rootNode() const override
Returns the root node of T.
edge m_rootEdge
edge of G at which T is rooted
Linear-time implementation of static SPQR-trees.
Definition: SPQRTree.h:71
int m_numP
number of P-nodes
The namespace for all OGDF objects.
const Graph * m_pGraph
pointer to original graph
StaticSPQRTree(const Graph &G)
Creates an SPQR tree T for graph G rooted at the first edge of G.
edge copyOfReal(edge e) const override
Returns the skeleton edge that corresponds to the real edge e.
int m_numR
number of R-nodes
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...
Class for adjacency list elements.
Definition: Graph_d.h:78
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:41
Declaration of class StaticSkeleton.
int numberOfPNodes() const override
Returns the number of P-nodes in T.
edge skeletonEdgeSrc(edge e) const
Returns the edge in skeleton of source(e) that corresponds to tree edge e.
const Graph & tree() const override
Returns a reference to the tree T.
realizes Hopcroft/Tarjan algorithm for finding the triconnected components of a biconnected multi-gra...
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
Definition: Graph_d.h:198