All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LFRGenerator.h
Go to the documentation of this file.
1 #ifndef LFRGENERATOR_H
2 #define LFRGENERATOR_H
3 
4 #include "../graph/Graph.h"
5 #include "../structures/Partition.h"
6 #include "../base/Algorithm.h"
7 #include "StaticGraphGenerator.h"
8 
9 namespace NetworKit {
10 
24 public:
33 
39  void setDegreeSequence(std::vector<count> degreeSequence);
40 
48  void generatePowerlawDegreeSequence(count avgDegree, count maxDegree, double nodeDegreeExp);
49 
55  void setCommunitySizeSequence(std::vector<count> communitySizeSequence);
56 
63 
71  void generatePowerlawCommunitySizeSequence(count minCommunitySize, count maxCommunitySize, double communitySizeExp);
72 
78  void setMu(double mu);
79 
85  void setMu(const std::vector<double> & mu);
86 
94  void setMuWithBinomialDistribution(double mu);
95 
99  virtual void run() override;
100 
106  virtual Graph generate() override;
107 
113  Graph getGraph() const;
114 
120  Graph&& getMoveGraph();
121 
127  Partition getPartition() const;
128 
135 
139  virtual std::string toString() const override;
140 
146  virtual bool isParallel() const override;
147 
148 protected:
149  /*
150  * These methods might be overridden by a sub-class which could use a different model or generator in order to generate the parts of the graph.
151  */
152  virtual std::vector<std::vector<node>> assignNodesToCommunities();
153  virtual Graph generateIntraClusterGraph(std::vector< NetworKit::count > intraDegreeSequence, const std::vector< NetworKit::node > &localToGlobalNode);
154  virtual Graph generateInterClusterGraph(const std::vector<count> &externalDegreeSequence);
155 
157 
159  std::vector<count> degreeSequence;
160 
162  std::vector<count> communitySizeSequence;
163 
165  std::vector<count> internalDegreeSequence;
166 
167  bool hasGraph;
169 
172 };
173 
174 } // namespace NetworKit
175 
176 #endif // LFRGENERATOR_H
void setDegreeSequence(std::vector< count > degreeSequence)
Set the given degree sequence.
Definition: LFRGenerator.cpp:18
virtual void run() override
Generates the graph and the community structure.
Definition: LFRGenerator.cpp:360
Partition getPartition() const
Returns (a copy of) the generated partition.
Definition: LFRGenerator.cpp:533
virtual Graph generateIntraClusterGraph(std::vector< NetworKit::count > intraDegreeSequence, const std::vector< NetworKit::node > &localToGlobalNode)
Definition: LFRGenerator.cpp:130
Partition && getMovePartition()
Returns the generated partition using move semantics.
Definition: LFRGenerator.cpp:539
bool hasPartition
Definition: LFRGenerator.h:170
void setMuWithBinomialDistribution(double mu)
Set the internal degree of each node using a binomial distribution such that the expected mixing para...
Definition: LFRGenerator.cpp:106
bool hasInternalDegreeSequence
Definition: LFRGenerator.h:164
virtual bool isParallel() const override
If the algorithm uses parallelism (no)
Definition: LFRGenerator.cpp:551
Graph && getMoveGraph()
Returns the generated graph using move semantics.
Definition: LFRGenerator.cpp:525
void generatePowerlawCommunitySizeSequence(count minCommunitySize, count maxCommunitySize, double communitySizeExp)
Generate a powerlaw community size sequence with the given minimum and maximum size and the given exp...
Definition: LFRGenerator.cpp:44
The LFR clustered graph generator as introduced by Andrea Lancichinetti, Santo Fortunato, and Filippo Radicchi.
Definition: LFRGenerator.h:23
Graph G
Definition: LFRGenerator.h:168
virtual Graph generate() override
Generates and returns the graph.
Definition: LFRGenerator.cpp:514
void setCommunitySizeSequence(std::vector< count > communitySizeSequence)
Set the given community size sequence.
Definition: LFRGenerator.cpp:38
void setPartition(Partition zeta)
Set the partition, this replaces the community size sequence and the random assignment of the nodes t...
Definition: LFRGenerator.cpp:124
virtual std::vector< std::vector< node > > assignNodesToCommunities()
Definition: LFRGenerator.cpp:259
virtual std::string toString() const override
The name and parameters of the generator.
Definition: LFRGenerator.cpp:545
Abstract base class for static graph generators.
Definition: StaticGraphGenerator.h:19
std::vector< count > communitySizeSequence
Definition: LFRGenerator.h:162
Graph getGraph() const
Returns (a copy of) the generated graph.
Definition: LFRGenerator.cpp:519
bool hasGraph
Definition: LFRGenerator.h:167
Implements a partition of a set, i.e.
Definition: Partition.h:31
std::vector< count > degreeSequence
Definition: LFRGenerator.h:159
void setMu(double mu)
Set the mixing parameter, this is the fraction of neighbors of each node that do not belong to the no...
Definition: LFRGenerator.cpp:67
bool hasCommunitySizeSequence
Definition: LFRGenerator.h:161
Partition zeta
Definition: LFRGenerator.h:171
uint64_t count
Definition: Globals.h:21
count n
Definition: LFRGenerator.h:156
void generatePowerlawDegreeSequence(count avgDegree, count maxDegree, double nodeDegreeExp)
Generate and set a power law degree sequence using the given average and maximum degree with the give...
Definition: LFRGenerator.cpp:26
bool hasDegreeSequence
Definition: LFRGenerator.h:158
LFRGenerator(count n)
Initialize the LFR generator for n nodes.
Definition: LFRGenerator.cpp:15
Definition: Algorithm.h:9
std::vector< count > internalDegreeSequence
Definition: LFRGenerator.h:165
A graph (with optional weights) and parallel iterator methods.
Definition: Graph.h:79
virtual Graph generateInterClusterGraph(const std::vector< count > &externalDegreeSequence)
Definition: LFRGenerator.cpp:164