Program Listing for File KatzCentrality.hpp

Return to documentation for file (include/networkit/centrality/KatzCentrality.hpp)

/*
 * KatzCentrality.hpp
 *
 *  Created on: 09.01.2015
 *      Author: Henning
 */

#ifndef NETWORKIT_CENTRALITY_KATZ_CENTRALITY_HPP_
#define NETWORKIT_CENTRALITY_KATZ_CENTRALITY_HPP_

#include <networkit/centrality/Centrality.hpp>

namespace NetworKit {

enum EdgeDirection : char {
    IN_EDGES = 0,
    OUT_EDGES = 1,
    InEdges = IN_EDGES, // this + following added for backwards compatibility
    OutEdges = OUT_EDGES
};

class KatzCentrality : public Centrality {
    std::vector<double> values;

protected:
    const double alpha; // damping
    const double beta;  // constant centrality amount
    const double tol;   // error tolerance
    static double defaultAlpha(const Graph &G);

public:
    KatzCentrality(const Graph &G, double alpha = 0, double beta = 0.1, double tol = 1e-8);

    void run() override;

    // Whether to count in-edges or out-edges
    EdgeDirection edgeDirection = EdgeDirection::IN_EDGES;
};

} /* namespace NetworKit */
#endif // NETWORKIT_CENTRALITY_KATZ_CENTRALITY_HPP_