Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.centrality.group_in_degree_centrality

group_in_degree_centrality(G, S)[source]

Compute the group in-degree centrality for a group of nodes.

Group in-degree centrality of a group of nodes \(S\) is the fraction of non-group members connected to group members by incoming edges.

Parameters
  • G (graph) – A NetworkX graph.

  • S (list or set) – S is a group of nodes which belong to G, for which group in-degree centrality is to be calculated.

Returns

centrality – Group in-degree centrality of the group S.

Return type

float

Raises

Notes

The number of nodes in the group must be a maximum of n - 1 where n is the total number of nodes in the graph.

G.neighbors(i) gives nodes with an outward edge from i, in a DiGraph, so for group in-degree centrality, the reverse graph is used.