6 * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7 ***************************************************************/
10 * \brief Includes declaration of dual graph class.
12 * \author Michael Schulz
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 ***************************************************************/
47 #ifndef OGDF_DUAL_GRAPH_H
48 #define OGDF_DUAL_GRAPH_H
51 #include <ogdf/basic/CombinatorialEmbedding.h>
52 #include <ogdf/basic/NodeArray.h>
53 #include <ogdf/basic/EdgeArray.h>
54 #include <ogdf/basic/FaceArray.h>
58 //! A dual graph including its combinatorial embedding of an embedded graph
59 class OGDF_EXPORT DualGraph
: public CombinatorialEmbedding
62 //! Constructor; creates dual graph and its combinatorial embedding
63 DualGraph(CombinatorialEmbedding
&CE
);
66 //! Returns a reference to the combinatorial embedding of the primal graph
67 const CombinatorialEmbedding
&getPrimalEmbedding() const { return *m_primalEmbedding
; }
68 //! Returns a reference to the primal graph
69 const Graph
&getPrimalGraph() const { return m_primalEmbedding
->getGraph(); }
71 //! Returns the node in the primal graph corresponding to \a f.
73 * @param f is a face in the embedding of the dual graph
74 * \return the corresponding node in the primal graph
76 const node
&primalNode(face f
) const { return m_primalNode
[f
]; }
77 //! Returns the edge in the primal graph corresponding to \a e.
79 * @param e is an edge in the dual graph
80 * \return the corresponding edge in the primal graph
82 const edge
&primalEdge(edge e
) const { return m_primalEdge
[e
]; }
83 //! Returns the face in the embedding of the primal graph corresponding to \a v.
85 * @param v is a node in the dual graph
86 * \return the corresponding face in the embedding of the primal graph
88 const face
&primalFace(node v
) const { return m_primalFace
[v
]; }
89 //! Returns the node in the dual graph corresponding to \a f.
91 * @param f is a face in the embedding of the primal graph
92 * \return the corresponding node in the dual graph
94 const node
&dualNode(face f
) const { return m_dualNode
[f
]; }
95 //! Returns the edge in the dual graph corresponding to \a e.
97 * @param e is an edge in the primal graph
98 * \return the corresponding edge in the dual graph
100 const edge
&dualEdge(edge e
) const { return m_dualEdge
[e
]; }
101 //! Returns the face in the embedding of the dual graph corresponding to \a v.
103 * @param v is a node in the primal graph
104 * \return the corresponding face in the embedding of the dual graph
106 const face
&dualFace(node v
) const { return m_dualFace
[v
]; }
109 CombinatorialEmbedding
*m_primalEmbedding
; //!< The embedding of the primal graph.
110 FaceArray
<node
> m_primalNode
; //!< The corresponding node in the primal graph.
111 NodeArray
<face
> m_primalFace
; //!< The corresponding facee in the embedding of the primal graph.
112 EdgeArray
<edge
> m_primalEdge
; //!< The corresponding edge in the primal graph.
113 FaceArray
<node
> m_dualNode
; //!< The corresponding node in the dual graph.
114 NodeArray
<face
> m_dualFace
; //!< The corresponding face in embedding of the dual graph.
115 EdgeArray
<edge
> m_dualEdge
; //!< The corresponding edge in the dual graph.
116 }; // class DualGraph
118 } // end namespace ogdf