Open
Graph Drawing
Framework

 v.2012.07
 

StaticSPQRTree.h
Go to the documentation of this file.
1 /*
2  * $Revision: 2523 $
3  *
4  * last checkin:
5  * $Author: gutwenger $
6  * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7  ***************************************************************/
8 
44 #ifdef _MSC_VER
45 #pragma once
46 #endif
47 
48 
49 #ifndef OGDF_STATIC_SPQR_TREE_H
50 #define OGDF_STATIC_SPQR_TREE_H
51 
52 
55 
56 
57 namespace ogdf {
58 
59  class TricComp;
60 
61 //---------------------------------------------------------
62 // StaticSPQRTree
63 // SPQR-tree data structure (static environment)
64 //---------------------------------------------------------
65 
98 class OGDF_EXPORT StaticSPQRTree : public virtual SPQRTree
99 {
100 public:
101 
102  friend class StaticSkeleton;
103 
104 
105  // constructors
106 
112  StaticSPQRTree(const Graph &G) : m_skOf(G), m_copyOf(G) { m_pGraph = &G; init(G.firstEdge()); }
113 
119  StaticSPQRTree(const Graph &G, edge e) : m_skOf(G), m_copyOf(G) { m_pGraph = &G; init(e); }
120 
126  StaticSPQRTree(const Graph &G, TricComp &tricComp) : m_skOf(G), m_copyOf(G) { m_pGraph = &G; init(G.firstEdge(),tricComp); }
127 
128 
129  // destructor
130 
131  ~StaticSPQRTree();
132 
133 
134  //
135  // a) Access operations
136  //
137 
139  const Graph &originalGraph() const { return *m_pGraph; }
140 
142  const Graph &tree() const { return m_tree; }
143 
145  edge rootEdge() const { return m_rootEdge; }
146 
148  node rootNode() const { return m_rootNode; }
149 
151  int numberOfSNodes() const { return m_numS; }
152 
154  int numberOfPNodes() const { return m_numP; }
155 
157  int numberOfRNodes() const { return m_numR; }
158 
163  NodeType typeOf(node v) const { return m_type[v]; }
164 
166  List<node> nodesOfType(NodeType t) const;
167 
172  Skeleton &skeleton(node v) const { return *m_sk[v]; }
173 
178  edge skeletonEdgeSrc(edge e) const { return m_skEdgeSrc[e]; }
179 
184  edge skeletonEdgeTgt(edge e) const { return m_skEdgeTgt[e]; }
185 
190  const Skeleton &skeletonOfReal(edge e) const { return *m_skOf[e]; }
191 
196  edge copyOfReal(edge e) const { return m_copyOf[e]; }
197 
198 
199  //
200  // b) Update operations
201  //
202 
207  node rootTreeAt(edge e);
208 
213  node rootTreeAt(node v);
214 
215 
216 protected:
217 
219  void init(edge e);
220 
222  void init(edge eRef, TricComp &tricComp);
223 
225  void rootRec(node v, edge ef);
226 
231  void cpRec(node v, PertinentGraph &Gp) const
232  {
233  edge e;
234  const Skeleton &S = skeleton(v);
235 
236  forall_edges(e,S.getGraph()) {
237  edge eOrig = S.realEdge(e);
238  if (eOrig != 0) cpAddEdge(eOrig,Gp);
239  }
240 
241  forall_adj_edges(e,v) {
242  node w = e->target();
243  if (w != v) cpRec(w,Gp);
244  }
245  }
246 
247 
248  const Graph *m_pGraph;
250 
253 
254  int m_numS;
255  int m_numP;
256  int m_numR;
257 
259 
263 
266 
267 }; // class StaticSPQRTree
268 
269 
270 } // end namespace ogdf
271 
272 
273 #endif