All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Centrality.h
Go to the documentation of this file.
1 /*
2  * Centrality.h
3  *
4  * Created on: 19.02.2014
5  * Author: Christian Staudt
6  */
7 
8 #ifndef CENTRALITY_H_
9 #define CENTRALITY_H_
10 
11 #include "../graph/Graph.h"
12 #include "../base/Algorithm.h"
13 
14 namespace NetworKit {
15 
20 class Centrality : public Algorithm {
21 public:
30  Centrality(const Graph& G, bool normalized=false, bool computeEdgeCentrality=false);
31 
33  virtual ~Centrality() = default;
34 
38  virtual void run() = 0;
39 
45  virtual std::vector<double> scores(bool moveOut = false);
46 
51  virtual std::vector<double> edgeScores();
52 
58  virtual std::vector<std::pair<node, double> > ranking();
59 
66  virtual double score(node v);
67 
73  virtual double maximum();
74 
87  virtual double centralization();
88 
89 protected:
90 
91  const Graph& G;
92  std::vector<double> scoreData;
93  std::vector<double> edgeScoreData;
94  bool normalized; // true if scores should be normalized in the interval [0,1]
96 
97 };
98 
99 } /* namespace NetworKit */
100 
101 #endif /* CENTRALITY_H_ */
virtual std::vector< double > scores(bool moveOut=false)
Get a vector containing the centrality score for each node in the graph.
Definition: Centrality.cpp:35
virtual double score(node v)
Get the centrality score of node v calculated by run().
Definition: Centrality.cpp:20
std::vector< double > edgeScoreData
Definition: Centrality.h:93
virtual double centralization()
Compute the centralization of a network with respect to some centrality measure.
Definition: Centrality.cpp:50
bool normalized
Definition: Centrality.h:94
Centrality(const Graph &G, bool normalized=false, bool computeEdgeCentrality=false)
Constructs the Centrality class for the given Graph G.
Definition: Centrality.cpp:14
virtual ~Centrality()=default
Default destructor.
std::vector< double > scoreData
Definition: Centrality.h:92
virtual std::vector< std::pair< node, double > > ranking()
Get a vector of pairs sorted into descending order.
Definition: Centrality.cpp:25
const Graph & G
Definition: Centrality.h:91
bool computeEdgeCentrality
Definition: Centrality.h:95
virtual void run()=0
Computes centrality scores on the graph passed in constructor.
virtual double maximum()
Get the theoretical maximum of centrality score in the given graph.
Definition: Centrality.cpp:46
Abstract base class for centrality measures.
Definition: Centrality.h:20
index node
Definition: Globals.h:23
virtual std::vector< double > edgeScores()
Get a vector containing the edge centrality score for each edge in the graph (where applicable)...
Definition: Centrality.cpp:41
Definition: Algorithm.h:9
A graph (with optional weights) and parallel iterator methods.
Definition: Graph.h:79