All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PowerlawDegreeSequence.h
Go to the documentation of this file.
1 #ifndef POWERLAWDEGREESEQUENCE_H
2 #define POWERLAWDEGREESEQUENCE_H
3 
4 #include "../Globals.h"
5 #include <vector>
6 #include "../graph/Graph.h"
7 
8 namespace NetworKit {
9 
11 public:
19  PowerlawDegreeSequence(count minDeg, count maxDeg, double gamma);
20 
26  PowerlawDegreeSequence(const std::vector<double>& degreeSequence);
27 
33  PowerlawDegreeSequence(const Graph& g);
34 
41  void setMinimumFromAverageDegree(double avgDeg);
42 
50  void setGammaFromAverageDegree(double avgDeg, double minGamma = -1, double maxGamma = -6);
51 
57  void setMinimumDegree(count minDeg);
58 
64  count getMinimumDegree() const;
65 
71  count getMaximumDegree() const { return maxDeg; };
72 
78  void setGamma(double gamma);
79 
85  double getGamma() const { return gamma; };
86 
90  void run();
91 
97  double getExpectedAverageDegree() const;
98 
105  std::vector<count> getDegreeSequence(count numNodes) const;
106 
112  count getDegree() const;
113 private:
114  count minDeg, maxDeg;
115  double gamma;
116  bool hasRun;
117  std::vector<double> cumulativeProbability;
118 };
119 
120 } // namespace NetworKit
121 
122 #endif // POWERLAWDEGREESEQUENCE_H
void setGammaFromAverageDegree(double avgDeg, double minGamma=-1, double maxGamma=-6)
Tries to set the powerlaw exponent gamma such that the specified average degree is expected...
Definition: PowerlawDegreeSequence.cpp:96
void run()
Execute the generation process.
Definition: PowerlawDegreeSequence.cpp:141
count getMinimumDegree() const
Gets the minimum degree.
Definition: PowerlawDegreeSequence.cpp:137
count getMaximumDegree() const
Gets the maximum degree.
Definition: PowerlawDegreeSequence.h:71
double getGamma() const
Gets the exponent gamma.
Definition: PowerlawDegreeSequence.h:85
double getExpectedAverageDegree() const
Returns the expected average degree.
Definition: PowerlawDegreeSequence.cpp:161
void setMinimumDegree(count minDeg)
Sets the minimum degree.
Definition: PowerlawDegreeSequence.cpp:47
uint64_t count
Definition: Globals.h:21
void setGamma(double gamma)
Sets the exponent gamma.
Definition: PowerlawDegreeSequence.cpp:52
count getDegree() const
Returns a degree drawn at random with a power law distribution.
Definition: PowerlawDegreeSequence.cpp:192
PowerlawDegreeSequence(count minDeg, count maxDeg, double gamma)
Generates a powerlaw degree sequence with the given minimum and maximum degree, the powerlaw exponent...
Definition: PowerlawDegreeSequence.cpp:12
A graph (with optional weights) and parallel iterator methods.
Definition: Graph.h:79
Definition: PowerlawDegreeSequence.h:10
std::vector< count > getDegreeSequence(count numNodes) const
Returns a degree sequence of numNodes degrees with even degree sum.
Definition: PowerlawDegreeSequence.cpp:172
void setMinimumFromAverageDegree(double avgDeg)
Tries to set the minimum degree such that the specified average degree is expected.
Definition: PowerlawDegreeSequence.cpp:57