rustworkx.group_closeness_centrality

group_closeness_centrality(graph, group)[source]

Compute the group closeness centrality of a set of nodes.

Group closeness centrality measures how close a group of nodes is to all non-group nodes. It is defined as:

\[C_{close}(S) = \frac{|V \setminus S|}{\sum_{v \in V \setminus S} d(S, v)}\]

where \(d(S, v) = \min_{u \in S} d(u, v)\) is the minimum distance from any group member to node \(v\).

Based on: Everett, M. G., & Borgatti, S. P. (1999). The centrality of groups and classes. Journal of Mathematical Sociology, 23(3), 181-201.

Parameters:
  • graph – The input graph. Can either be a PyGraph or PyDiGraph.

  • group (list) – A list of node indices representing the group.

Returns:

The group closeness centrality as a float.

Return type:

float