Class Closeness

Inheritance Relationships

Base Type

Class Documentation

class Closeness : public NetworKit::Centrality

Public Functions

Closeness(const Graph &G, bool normalized, ClosenessVariant variant = ClosenessVariant::STANDARD)

Constructs the Closeness class for the given Graph G. If the closeness scores should be normalized, then set normalized to true. The run() method takes O(nm) time, where n is the number of nodes and m is the number of edges of the graph. NOTICE: the graph has to be connected.

Parameters:
  • G – The graph.

  • normalized – Set this parameter to false if scores should not be normalized into an interval of [0, 1]. Normalization only for unweighted graphs.

Closeness(const Graph &G, bool normalized = true, bool checkConnectedness = true)

Old constructor, we keep it for backward compatibility. It computes the standard variant of the closenes.

Parameters:
  • G – The graph.

  • normalized – Set this parameter to false if scores should not be normalized into an interval of [0, 1]. Normalization only for unweighted graphs.

  • checkConnectedness – turn this off if you know the graph is connected.

virtual void run() override

Computes closeness cetrality on the graph passed in constructor.

inline virtual double maximum() override

Get the theoretical maximum of centrality score in the given graph.

Returns:

The maximum centrality score.