Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / ogdf / planarity / FastPlanarSubgraph.h
blob21a2907fc518dfb7d910ea1fdbed56cb8a5bcf8b
1 /*
2 * $Revision: 2566 $
4 * last checkin:
5 * $Author: gutwenger $
6 * $Date: 2012-07-07 23:10:08 +0200 (Sa, 07. Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief Declaration of the FastPlanarSubgraph.
12 * \author Sebastian Leipert
14 * \par License:
15 * This file is part of the Open Graph Drawing Framework (OGDF).
17 * \par
18 * Copyright (C)<br>
19 * See README.txt in the root directory of the OGDF installation for details.
21 * \par
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
26 * for details.
28 * \par
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.
34 * \par
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 ***************************************************************/
43 #ifdef _MSC_VER
44 #pragma once
45 #endif
48 #ifndef OGDF_FAST_PLANAR_SUBGRAPH_H
49 #define OGDF_FAST_PLANAR_SUBGRAPH_H
53 #include <ogdf/module/PlanarSubgraphModule.h>
56 namespace ogdf {
58 /**
59 * \brief Computation of a planar subgraph using PQ-trees.
61 * Literature: Jayakumar, Thulasiraman, Swamy 1989
63 * <h3>Optional Parameters</h3>
65 * <table>
66 * <tr>
67 * <th>Option</th><th>Type</th><th>Default</th><th>Description</th>
68 * </tr><tr>
69 * <td><i>runs</i></td><td>int</td><td>0</td>
70 * <td>the number of randomized runs performed by the algorithm; the best
71 * solution is picked among all the runs. If runs is 0, one
72 * deterministic run is performed.</td>
73 * </tr>
74 * </table>
76 * Observe that this algorithm by theory does not compute a maximal
77 * planar subgraph. It is however the fastest known good heuristic.
79 class OGDF_EXPORT FastPlanarSubgraph : public PlanarSubgraphModule{
81 public:
82 //! Creates an instance of the fast planar subgraph algorithm.
83 FastPlanarSubgraph() : PlanarSubgraphModule() {
84 m_nRuns = 0;
87 // destructor
88 ~FastPlanarSubgraph() { }
91 // options
93 //! Sets the number of randomized runs to \a nRuns.
94 void runs (int nRuns) {
95 m_nRuns = nRuns;
98 //! Returns the current number of randomized runs.
99 int runs() const {
100 return m_nRuns;
104 protected:
105 //! Returns true, if G is planar, false otherwise.
107 * \todo Add timeout support (limit number of runs when timeout is reached).
109 ReturnType doCall(const Graph &G,
110 const List<edge> &preferedEdges,
111 List<edge> &delEdges,
112 const EdgeArray<int> *pCost,
113 bool preferedImplyPlanar);
116 private:
117 int m_nRuns; //!< The number of runs for randomization.
120 //! Computes the list of edges to be deleted in \a G.
121 /** Also performs randomization of the planarization algorithm.
123 void computeDelEdges(const Graph &G,
124 const EdgeArray<int> *pCost,
125 const EdgeArray<edge> *backTableEdges,
126 List<edge> &delEdges);
128 //! Performs a planarization on a biconnected component pf \a G.
129 /** The numbering contains an st-numbering of the component.
131 void planarize(
132 const Graph &G,
133 NodeArray<int> &numbering,
134 List<edge> &delEdges);
138 #endif