Program Listing for File PowerlawDegreeSequence.hpp

Return to documentation for file (include/networkit/generators/PowerlawDegreeSequence.hpp)

#ifndef NETWORKIT_GENERATORS_POWERLAW_DEGREE_SEQUENCE_HPP_
#define NETWORKIT_GENERATORS_POWERLAW_DEGREE_SEQUENCE_HPP_

#include <vector>

#include <networkit/Globals.hpp>
#include <networkit/base/Algorithm.hpp>
#include <networkit/graph/Graph.hpp>

namespace NetworKit {

class PowerlawDegreeSequence final : public Algorithm {
public:
    PowerlawDegreeSequence(count minDeg, count maxDeg, double gamma);

    PowerlawDegreeSequence(const std::vector<double> &degreeSequence);

    PowerlawDegreeSequence(const Graph &g);

    void setMinimumFromAverageDegree(double avgDeg);

    void setGammaFromAverageDegree(double avgDeg, double minGamma = -1, double maxGamma = -6);

    void setMinimumDegree(count minDeg);

    count getMinimumDegree() const;

    count getMaximumDegree() const { return maxDeg; };

    void setGamma(double gamma);

    double getGamma() const { return gamma; };

    void run() override;

    double getExpectedAverageDegree() const;

    std::vector<count> getDegreeSequence(count numNodes) const;

    count getDegree() const;

private:
    count minDeg, maxDeg;
    double gamma;
    std::vector<double> cumulativeProbability;
};

} // namespace NetworKit

#endif // NETWORKIT_GENERATORS_POWERLAW_DEGREE_SEQUENCE_HPP_