group_degree

Contents

group_degree#

graph_tool.centrality.group_degree(g, group, mode='out')[git][source]#

Calculate the degree centrality of a group of vertices.

Parameters:
gGraph

Graph to be used.

grouplist or numpy.ndarray

Vertices of the group.

modestr (optional, default: "out")

For directed graphs, the neighbors that are counted: "out", "in", or "total" (both). It is ignored for undirected graphs.

Returns:
GDfloat

The group degree centrality.

See also

group_betweenness

Group betweenness centrality

group_closeness

Group closeness centrality

Notes

The group degree [everett-centrality-1999] of a group \(C\) is the fraction of the vertices outside the group that are neighbors of at least one vertex of the group,

\[C_D(C) = \frac{|N(C)\setminus C|}{n - |C|},\]

where \(N(C)\) is the set of the out-neighbors of the vertices of \(C\) (their in-neighbors, or both, according to mode, for directed graphs), and the value is zero if the group contains all vertices. It takes time \(O(V + E)\).

References

[everett-centrality-1999]

M. G. Everett and S. P. Borgatti, “The centrality of groups and classes”, The Journal of Mathematical Sociology 23, 181-201 (1999), DOI: 10.1080/0022250X.1999.9990219 [sci-hub, @tor]

Examples

>>> g = gt.collection.data["karate"]
>>> print(gt.group_degree(g, [0, 33]))
0.90625