Class DegreeCentrality

Inheritance Relationships

Base Type

Class Documentation

class DegreeCentrality : public NetworKit::Centrality

Node centrality index which ranks nodes by their degree. Optional normalization by maximum degree.

Public Functions

DegreeCentrality(const Graph &G, bool normalized = false, bool outDeg = true, bool ignoreSelfLoops = true)

Constructs the DegreeCentrality class for the given Graph G. If the centrality scores should be normalized, then set normalized to true. run() runs in O(n) time if ignoreSelfLoops is false or the graph has no self-loops; otherwise it runs in O(m).

  • G – The graph.

  • normalized – Set this parameter to true if scores should be normalized in the interval [0,1].

  • outDeg – If set to true, computes the centrality based on the out-degrees, otherwise based on the in-degrees.

  • ignoreSelfLoops – If set to true, self loops will not be taken into account.

virtual void run() override

Computes degree centraity on the graph passed in constructor.

virtual double maximum() override

the theoretical maximum degree centrality, which is $n$ (including the possibility of a self-loop)