↰ Return to documentation for file (include/networkit/centrality/PageRank.hpp
)
/*
* PageRank.h
*
* Created on: 19.03.2014
* Author: Henning
*/
#ifndef NETWORKIT_CENTRALITY_PAGE_RANK_HPP_
#define NETWORKIT_CENTRALITY_PAGE_RANK_HPP_
#include <atomic>
#include <limits>
#include <memory>
#include <networkit/centrality/Centrality.hpp>
namespace NetworKit {
class PageRank final : public Centrality {
public:
enum Norm {
L1_NORM,
L2_NORM,
L1Norm = L1_NORM, // this + following added for backwards compatibility
L2Norm = L2_NORM
};
enum SinkHandling { NO_SINK_HANDLING, DISTRIBUTE_SINKS };
PageRank(const Graph &G, double damp = 0.85, double tol = 1e-8, bool normalized = false,
SinkHandling distributeSinks = SinkHandling::NO_SINK_HANDLING);
void run() override;
double maximum() override;
count numberOfIterations() const {
assureFinished();
return iterations;
}
// Maximum number of iterations allowed
count maxIterations = std::numeric_limits<count>::max();
// Norm used as stopping criterion
Norm norm = Norm::L2_NORM;
private:
double damp;
double tol;
count iterations;
bool normalized;
SinkHandling distributeSinks;
std::atomic<double> max;
};
} /* namespace NetworKit */
#endif // NETWORKIT_CENTRALITY_PAGE_RANK_HPP_