Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / ogdf / graphalg / PageRank.h
blob4b98b15113c88972d2651dc47228884edfed5558
1 /*
2 * $Revision: 2597 $
4 * last checkin:
5 * $Author: gutwenger $
6 * $Date: 2012-07-15 19:26:11 +0200 (So, 15. Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief Declaration of basic page rank.
12 * \author Martin Gronemann
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 #ifndef OGDF_PAGE_RANK_H_
44 #define OGDF_PAGE_RANK_H_
46 #include <ogdf/basic/NodeArray.h>
47 #include <ogdf/basic/EdgeArray.h>
49 namespace ogdf {
51 //! Basic page rank calculation
52 class BasicPageRank
54 public:
55 BasicPageRank()
57 initDefaultOptions();
60 //! main algorithm call
61 void call(
62 const Graph& graph,
63 const EdgeArray<double>& edgeWeight,
64 NodeArray<double>& pageRankResult);
66 //! sets the default options.
67 void initDefaultOptions()
69 m_dampingFactor = 0.85;
70 m_maxNumIterations = 1000;
71 m_threshold = 0.0;
74 //! returns the damping factor for each iteration (default is 0.85)
75 double dampingFactor() const
77 return m_dampingFactor;
80 //! sets the damping factor for each iteration (default is 0.85)
81 void setDampingFactor(double dampingFactor)
83 m_dampingFactor = dampingFactor;
86 //! the maximum number of iterations (default is 1000)
87 int maxNumIterations() const
89 return m_maxNumIterations;
92 //! sets the maximum number of iterations (default is 1000)
93 void setMaxNumIterations(int maxNumIterations)
95 m_maxNumIterations = maxNumIterations;
98 /*! returns the threshold/epsilon. After each iteration the result is compared to
99 * to the old one and in case all changes are smaller than threshold the algorithm
100 * stops. Note that the default value is 0.0 resulting in maxNumIterations usually.
102 double threshold() const
104 return m_threshold;
108 //! sets the threshold to t. See threshold for more information
109 void setThreshold(double t)
111 m_threshold = t;
114 private:
115 //! the damping factor
116 double m_dampingFactor;
118 //! maximum number of iterations
119 int m_maxNumIterations;
121 //! the threshold
122 double m_threshold;
125 } // end of namespace ogdf
127 #endif // OGDF_PAGE_RANK_H_