Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / ogdf / energybased / multilevelmixer / MultilevelBuilder.h
blob144e282d1f98045f7d718c7dc58841e5cc697922
1 /*
2 * $Revision: 2523 $
4 * last checkin:
5 * $Author: gutwenger $
6 * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief Abstract MultilevelBuilder builds all Levels
12 * \author Gereon Bartel
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
47 #ifndef OGDF_MULTILEVEL_BUILDER_H
48 #define OGDF_MULTILEVEL_BUILDER_H
50 #include <ogdf/basic/Graph.h>
51 #include <ogdf/internal/energybased/MultilevelGraph.h>
53 namespace ogdf {
55 class OGDF_EXPORT MultilevelBuilder
57 private:
58 /**
59 * \brief This method constructs one more level on top of an existing MultilevelGraph.
60 * It must be implemented in any MultilevelBuilder. A level is built by
61 * adding node-merges to the MultilevelGraph and updating the graph accordingly.
62 * This is achieved by calling MLG.
64 * @param MLG is the MultilevelGraph for which a new gevel will be built.
66 * @return true if the Graph was changed or false if no Level can be built.
68 virtual bool buildOneLevel(MultilevelGraph &MLG) = 0;
70 protected:
71 // if set to true the length of the edge between two merged nodes will be added to
72 // all edges that are moved to the other node in this merge.
73 int m_adjustEdgeLengths;
74 int m_numLevels; //!< stores number of levels for statistics purposes
76 public:
77 virtual ~MultilevelBuilder() { }
78 MultilevelBuilder():m_adjustEdgeLengths(0),m_numLevels(1) { }
80 virtual void buildAllLevels(MultilevelGraph &MLG)
82 m_numLevels = 1;
83 MLG.updateReverseIndizes();
84 MLG.updateMergeWeights();
85 while (buildOneLevel(MLG))
87 m_numLevels++;
89 MLG.updateReverseIndizes();
92 void setEdgeLengthAdjustment(int factor) { m_adjustEdgeLengths = factor; }
93 int getNumLevels() {return m_numLevels;}
97 } // namespace ogdf
99 #endif