All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
NetworKit::Centrality Class Referenceabstract

Abstract base class for centrality measures. More...

#include <Centrality.h>

Public Member Functions

 Centrality (const Graph &G, bool normalized=false, bool computeEdgeCentrality=false)
 Constructs the Centrality class for the given Graph G. More...
 
virtual ~Centrality ()=default
 Default destructor. More...
 
virtual void run ()=0
 Computes centrality scores on the graph passed in constructor. More...
 
virtual std::vector< double > scores (bool moveOut=false)
 Get a vector containing the centrality score for each node in the graph. More...
 
virtual std::vector< double > edgeScores ()
 Get a vector containing the edge centrality score for each edge in the graph (where applicable). More...
 
virtual std::vector< std::pair
< node, double > > 
ranking ()
 Get a vector of pairs sorted into descending order. More...
 
virtual double score (node v)
 Get the centrality score of node v calculated by run(). More...
 
virtual double maximum ()
 Get the theoretical maximum of centrality score in the given graph. More...
 
virtual double centralization ()
 Compute the centralization of a network with respect to some centrality measure. More...
 
- Public Member Functions inherited from NetworKit::Algorithm
 Algorithm ()
 Constructor to the algorithm base class. More...
 
virtual ~Algorithm ()=default
 Virtual default destructor. More...
 
bool hasFinished () const
 Indicates whether an algorithm has completed computation or not. More...
 
void assureFinished () const
 Assure that the algorithm has been run, throws a std::runtime_error otherwise. More...
 
virtual std::string toString () const
 Returns a string with the algorithm's name and its parameters, if there are any. More...
 
virtual bool isParallel () const
 

Protected Attributes

const GraphG
 
std::vector< double > scoreData
 
std::vector< double > edgeScoreData
 
bool normalized
 
bool computeEdgeCentrality
 
- Protected Attributes inherited from NetworKit::Algorithm
bool hasRun
 A boolean variable indicating whether an algorithm has finished its computation or not. More...
 

Detailed Description

Abstract base class for centrality measures.

Constructor & Destructor Documentation

NetworKit::Centrality::Centrality ( const Graph G,
bool  normalized = false,
bool  computeEdgeCentrality = false 
)

Constructs the Centrality class for the given Graph G.

If the centrality scores should be normalized, then set normalized to true.

Parameters
GThe graph.
normalizedIf set to true the scores are normalized in the interval [0,1].
computeEdgeCentralityIf true, compute also edge centralities (for algorithms where this is applicable)
virtual NetworKit::Centrality::~Centrality ( )
virtualdefault

Default destructor.

Member Function Documentation

double NetworKit::Centrality::centralization ( )
virtual

Compute the centralization of a network with respect to some centrality measure.

The centralization of any network is a measure of how central its most central node is in relation to how central all the other nodes are. Centralization measures then (a) calculate the sum in differences in centrality between the most central node in a network and all other nodes; and (b) divide this quantity by the theoretically largest such sum of differences in any network of the same size.

Returns
centrality index
std::vector< double > NetworKit::Centrality::edgeScores ( )
virtual

Get a vector containing the edge centrality score for each edge in the graph (where applicable).

Returns
The edge betweenness scores calculated by run().
double NetworKit::Centrality::maximum ( )
virtual
std::vector< std::pair< node, double > > NetworKit::Centrality::ranking ( )
virtual

Get a vector of pairs sorted into descending order.

Each pair contains a node and the corresponding score calculated by A vector of pairs.

virtual void NetworKit::Centrality::run ( )
pure virtual
double NetworKit::Centrality::score ( node  v)
virtual

Get the centrality score of node v calculated by run().

Parameters
vA node.
Returns
The betweenness score of node v.
std::vector< double > NetworKit::Centrality::scores ( bool  moveOut = false)
virtual

Get a vector containing the centrality score for each node in the graph.

Parameters
moveOutReturn the actual internal data instead of a copy. Resets the hasRun-state. Default: false.
Returns
The centrality scores calculated by run().

Member Data Documentation

bool NetworKit::Centrality::computeEdgeCentrality
protected
std::vector<double> NetworKit::Centrality::edgeScoreData
protected
const Graph& NetworKit::Centrality::G
protected
bool NetworKit::Centrality::normalized
protected
std::vector<double> NetworKit::Centrality::scoreData
protected

The documentation for this class was generated from the following files: