# -*- coding: utf-8 -*- # Copyright (C) 2004-2019 by # Aric Hagberg # Dan Schult # Pieter Swart # All rights reserved. # BSD license. # # Authors: Nanda H Krishna """Group centrality measures.""" from itertools import combinations import networkx as nx from networkx.utils.decorators import not_implemented_for __all__ = ['group_betweenness_centrality', 'group_closeness_centrality', 'group_degree_centrality', 'group_in_degree_centrality', 'group_out_degree_centrality'] def group_betweenness_centrality(G, C, normalized=True, weight=None): r"""Compute the group betweenness centrality for a group of nodes. Group betweenness centrality of a group of nodes $C$ is the sum of the fraction of all-pairs shortest paths that pass through any vertex in $C$ .. math:: c_B(C) =\sum_{s,t \in V-C; s