Assortativity.h
Go to the documentation of this file.
1 /*
2  * Assortativity.h
3  *
4  * Created on: Jun 13, 2015
5  * Author: Christian Staudt
6  */
7
8 #ifndef ASSORTATIVITY_H_
9 #define ASSORTATIVITY_H_
10
11 #include "../base/Algorithm.h"
12 #include "../graph/Graph.h"
13 #include "../structures/Partition.h"
14
15
16 namespace NetworKit {
17
24 class Assortativity : public Algorithm {
25
26 public:
27
35  Assortativity(const Graph& G, const std::vector<double>& attribute);
36
37
44  Assortativity(const Graph& G, const Partition& partition);
45
49  void run() override;
50
51
55  double getCoefficient() const;
56
61  std::string toString() const override;
62
63  bool isParallel() const override;
64
65
66 private:
67  const Graph& G;
68  const std::vector<double> emptyVector;
69  const Partition emptyPartition;
70  const std::vector<double>& attribute;
71  const Partition& partition;
72  bool nominal; // whether we calculate assortativity for a nominal or ordinal attribute
73  double coefficient;
74 };
75
76 } /* namespace NetworKit */
77 #endif /* ASSORTATIVITY_H_ */
Assortativity(const Graph &G, const std::vector< double > &attribute)
Initialize Assortativity with a graph G and an array of numerical node values.
Definition: Assortativity.cpp:13
Assortativity computes a coefficient that expresses the correlation of a node attribute among connect...
Definition: Assortativity.h:24
std::string toString() const override
Returns a string with the algorithm's name and its parameters, if there are any.
Definition: Assortativity.cpp:98
Implements a partition of a set, i.e.
Definition: Partition.h:31
bool isParallel() const override
Definition: Assortativity.cpp:102
Definition: Algorithm.h:9
A graph (with optional weights) and parallel iterator methods.
Definition: Graph.h:79
double getCoefficient() const
Return the assortativity coefficient.
Definition: Assortativity.cpp:94
void run() override
The generic run method which calls runImpl() and takes care of setting to the appropriate value...
Definition: Assortativity.cpp:26