Skip to content

Centrality Algorithms: Degree Centrality & Closeness Centrality & Betweenness Centrality

About 743 wordsAbout 2 min

DistributedBig Data

2024-12-18

Centrality algorithms are used to understand the influence of specific nodes in a graph and their impact on the network, which can help us identify the most important nodes.

This article will introduce the following algorithms:

Degree Centrality

Used to measure the number of relationships a node has. The larger the value, the higher its centrality.

  • Input: G = (V, E).
  • Output: Each node and its degree centrality value.

Implementation Principle

CD(Ni)=Ndegreen1 C'_D(N_i) = \frac{N_{degree}}{n - 1}

Where:

  • NdegreeN_{degree} represents the degree of the node.
  • nn represents the number of nodes.

This formula has been standardized.

Adaptation For Heterogeneous Graphs

  • This indicator calculation does not involve attributes, only the degree of the graph structure.
  • Only the degree under the same label is calculated.

Closeness Centrality

Used to discover nodes that can efficiently propagate information through subgraphs, The higher the value, the shorter the distance between it and other nodes. This algorithm can be used when you need to know which node has the fastest propagation speed.

  • Input: G = (V, E).
  • Output: Each node and its closeness centrality.

Implementation Principle

The indicator for measuring the centrality of a node is its average distance to other nodes. The closeness centrality algorithm calculates the sum of its distances to other nodes on the basis of calculating the shortest path between all node pairs, and then calculates the inverse of the result.

C(u)=1v=1n1d(u,v) C(u) = \frac{1}{\sum_{v=1}^{n-1}d(u,v)}

Where:

  • uu represents a node.
  • nn represents the number of nodes in the graph.
  • d(u,v)d(u,v) represents the shortest distance between another node vv and node uu.

It is more common to normalize the calculation result to represent the average length of the shortest path, rather than the sum of the shortest paths. The normalization formula is as follows:

Cnorm(u)=n1v=1n1d(u,v) C_{norm}(u) = \frac{n-1}{\sum_{v=1}^{n-1}d(u,v)}

Adaptation For Heterogeneous Graphs

  • Only calculate nodes with the same label.
  • Actually only calculate the close centrality in each connected subgraph.

Wasserman & Faust algorithm

This algorithm is a variant for non-connected graphs.

CWF(u)=n1N1(n1v=1n1d(u,v)) C_{WF}(u) = \frac{n-1}{N-1}\left(\frac{n-1}{\sum_{v=1}^{n-1}d(u,v)} \right)

Where:

  • uu represents a node.
  • NN represents the total number of nodes.
  • nn represents the number of nodes in the same component as uu.
  • d(u,v)d(u, v) represents another node The shortest distance from vv to uu.

Betweenness Centrality

Used to detect the degree of influence of a node on the information flow or resources in the graph, usually used to find nodes that bridge one part of the graph with another.

  • Input: G = (V, E).
  • Output: Each node and its betweenness centrality value.

Implementation Principle

B(u)=sutp(u)p B(u) = \sum_{s \neq u \neq t} \frac{p(u)}{p}

Where:

  • uu represents a node.
  • pp represents the sum of the shortest paths between nodes ss and tt.
  • p(u)p(u) represents the number of shortest paths between ss and tt through node uu.

The following figure shows the steps to calculate the betweenness score.

Betweenness centrality calculation example
Betweenness centrality calculation example

The calculation process for node D is as follows:

Shortest path node pairs through DTotal number of shortest paths between node pairs ppPercentage of the number of shortest paths through D p(u)p\frac{p(u)}{p}
(A, E)11
(B, E)11
(C, E)11
(B, C)2 (B->A->C and B->D->C respectively)0.5

So according to the formula, the betweenness score of node D is: 1 + 1 + 1 + 0.3 = 3.5.

Adaptation For Heterogeneous Graphs

  • The calculation of this indicator does not involve attributes, but only focuses on the degree of the graph structure.
  • Only the degree under the same label is calculated.




Changelog

Last Updated: View All Changelog
  • fix(docs): optimize articles

    On 12/27/24
  • feat(docs): add new english articles

    On 12/18/24

Keep It Simple