6 * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7 ***************************************************************/
10 * \brief Declaration of the classes BoyerMyrvoldInit and BucketLowPoint
12 * \author Jens Schmidt
16 * This file is part of the Open Graph Drawing Framework (OGDF).
20 * See README.txt in the root directory of the OGDF installation for details.
23 * This program is free software; you can redistribute it and/or
24 * modify it under the terms of the GNU General Public License
25 * Version 2 or 3 as published by the Free Software Foundation;
26 * see the file LICENSE.txt included in the packaging of this file
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
36 * You should have received a copy of the GNU General Public
37 * License along with this program; if not, write to the Free
38 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
39 * Boston, MA 02110-1301, USA.
41 * \see http://www.gnu.org/copyleft/gpl.html
42 ***************************************************************/
48 #ifndef OGDF_BOYER_MYRVOLD_INIT_H
49 #define OGDF_BOYER_MYRVOLD_INIT_H
52 #include <ogdf/internal/planarity/BoyerMyrvoldPlanar.h>
53 #include <ogdf/basic/List.h>
58 //! This class is used in the Boyer-Myrvold planarity test for preprocessing purposes.
60 * Among these is the computation of lowpoints, highestSubtreeDFIs,
61 * separatedDFSChildList and of course building the DFS-tree.
63 class BoyerMyrvoldInit
{
65 //! Constructor, the parameter BoyerMyrvoldPlanar is needed
66 BoyerMyrvoldInit(BoyerMyrvoldPlanar
* pBM
);
69 ~BoyerMyrvoldInit() { }
71 //! Creates the DFSTree
74 //! Computes lowpoint, highestSubtreeDFI and links virtual to nonvirtual vertices
75 void computeLowPoints();
77 //! Computes the list of separated DFS children for all nodes
78 void computeDFSChildLists();
80 // avoid automatic creation of assignment operator
81 //! Assignment operator is undefined!
82 BoyerMyrvoldInit
&operator=(const BoyerMyrvoldInit
&);
88 //! Some parameters... see BoyerMyrvold.h for further instructions
89 const int& m_embeddingGrade
;
90 const bool& m_randomDFSTree
;
92 //! Link to non-virtual vertex of a virtual Vertex.
93 /** A virtual vertex has negative DFI of the DFS-Child of related non-virtual Vertex
95 NodeArray
<node
>& m_realVertex
;
97 //! The one and only DFI-Array
98 NodeArray
<int>& m_dfi
;
100 //! Returns appropriate node from given DFI
101 Array
<node
>& m_nodeFromDFI
;
103 //! Links to opposite adjacency entries on external face in clockwise resp. ccw order
104 /** m_link[0]=CCW, m_link[1]=CW
106 NodeArray
<adjEntry
> (&m_link
)[2];
108 //! The adjEntry which goes from DFS-parent to current vertex
109 NodeArray
<adjEntry
>& m_adjParent
;
111 //! The DFI of the least ancestor node over all backedges
112 /** If no backedge exists, the least ancestor is the DFI of that node itself
114 NodeArray
<int>& m_leastAncestor
;
116 //! Contains the type of each \a edge
117 /** @param 0 = EDGE_UNDEFINED
118 * @param 1 = EDGE_SELFLOOP
119 * @param 2 = EDGE_BACK
120 * @param 3 = EDGE_DFS
121 * @param 4 = EDGE_DFS_PARALLEL
122 * @param 5 = EDGE_BACK_DELETED
124 EdgeArray
<int>& m_edgeType
;
126 //! The lowpoint of each \a node
127 NodeArray
<int>& m_lowPoint
;
129 //! The highest DFI in a subtree with \a node as root
130 NodeArray
<int>& m_highestSubtreeDFI
;
132 //! A list to all separated DFS-children of \a node
133 /** The list is sorted by lowpoint values (in linear time)
135 NodeArray
<ListPure
<node
> >& m_separatedDFSChildList
;
137 //! Pointer to \a node contained in the DFSChildList of his parent, if exists.
138 /** If node isn't in list or list doesn't exist, the pointer is set to NULL.
140 NodeArray
<ListIterator
<node
> >& m_pNodeInParent
;
142 //! Creates and links a virtual vertex of the node belonging to \a father
143 void createVirtualVertex(const adjEntry father
);
146 //! BucketFunction for lowPoint buckets
147 /** Parameter lowPoint may not be deleted til destruction of this class.
149 class BucketLowPoint
: public BucketFunc
<node
> {
151 BucketLowPoint(const NodeArray
<int>& lowPoint
) :m_pLow(&lowPoint
) { }
153 //! This function has to be derived from BucketFunc, it gets the buckets from lowPoint-Array
154 int getBucket(const node
& v
) {
158 //! Stored to be able to get the buckets
159 const NodeArray
<int>* m_pLow
;