6 * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7 ***************************************************************/
10 * \brief Declaration of class Skeleton.
12 * \author Carsten Gutwenger
15 * This file is part of the Open Graph Drawing Framework (OGDF).
19 * See README.txt in the root directory of the OGDF installation for details.
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * Version 2 or 3 as published by the Free Software Foundation;
25 * see the file LICENSE.txt included in the packaging of this file
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
35 * You should have received a copy of the GNU General Public
36 * License along with this program; if not, write to the Free
37 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
38 * Boston, MA 02110-1301, USA.
40 * \see http://www.gnu.org/copyleft/gpl.html
41 ***************************************************************/
49 #ifndef OGDF_SKELETON_H
50 #define OGDF_SKELETON_H
53 #include <ogdf/basic/NodeArray.h>
54 #include <ogdf/basic/EdgeArray.h>
59 class OGDF_EXPORT SPQRTree
;
62 //! %Skeleton graphs of nodes in an SPQR-tree.
64 * The class Skeleton maintains the skeleton \a S of a node \a vT in an SPQR-tree
65 * \a T. We call \a T the owner tree of \a S and \a vT the corresponding tree node. Let
66 * \a G be the original graph of \a T.
68 * \a S consists of an undirected multi-graph \a M. If the owner tree of \a S is
69 * a PlanarSPQRTree, then \a M represents a combinatorial embedding.
70 * The vertices in \a M correspond to vertices in \a G. The edges in \a M are of
71 * two types: Real edges correspond to edges in \a G and virtual edges correspond
72 * to tree-edges in \a T having \a vT as an endpoint.
74 * Let \a e in \a M be a virtual edge and \a eT be the corresponding tree-edge.
75 * Then there exists exactly one edge \a e' in another skeleton \a S' of \a T that
76 * corresponds to \a eT as well. We call \a e' the twin edge of \a e.
78 class OGDF_EXPORT Skeleton
84 //! Creates a skeleton \a S with owner tree \a T and corresponding node \a vT.
86 * \pre \a vT is a node in \a T
88 * \remarks Skeletons are created by the constructor of SPQRTree
89 * and can be accessed with the skeleton() function of SPQRTree.
91 Skeleton(node vT
) : m_treeNode(vT
) { }
95 virtual ~Skeleton() { }
98 //! Returns the owner tree \a T.
99 virtual const SPQRTree
&owner() const=0;
101 //! Returns the corresponding node in the owner tree \a T to which \a S belongs.
102 node
treeNode() const {
106 //! Returns the reference edge of \a S in \a M.
108 * The reference edge is a real edge if \a S is the skeleton of the root node
109 * of \a T, and a virtual edge otherwise.
111 edge
referenceEdge() const {
112 return m_referenceEdge
;
115 //! Returns a reference to the skeleton graph \a M.
116 const Graph
&getGraph() const {
120 //! Returns a reference to the skeleton graph \a M.
125 //! Returns the vertex in the original graph \a G that corresponds to \a v.
127 * \pre \a v is a node in \a M.
129 virtual node
original (node v
) const=0;
131 //! Returns true iff \a e is a virtual edge.
133 * \pre \a e is an edge in \a M
135 virtual bool isVirtual (edge e
) const=0;
137 //! Returns the real edge that corresponds to skeleton edge \a e
139 * If \a e is virtual edge, then 0 is returned.
140 * \pre \a e is an edge in \a M
142 virtual edge
realEdge (edge e
) const=0;
144 //! Returns the twin edge of skeleton edge \a e.
146 * If \a e is not a virtual edge, then 0 is returned.
147 * \pre \a e is an edge in \a M
149 virtual edge
twinEdge (edge e
) const=0;
151 //! Returns the tree node in T containing the twin edge of skeleton edge \a e.
153 * If \a e is not a virtual edge, then 0 is returned.
154 * \pre \a e is an edge in \a M
156 virtual node
twinTreeNode (edge e
) const=0;
161 node m_treeNode
; //!< corresp. tree node in owner tree
162 edge m_referenceEdge
; //!< reference edge
163 Graph m_M
; //!< actual skeleton graph
167 } // end namespace ogdf