communicability_betweenness#
- graph_tool.centrality.communicability_betweenness(g, vprop=None, norm=True)[git][source]#
Calculate the communicability betweenness of each vertex.
- Parameters:
- g
Graph Graph to be used.
- vprop
VertexPropertyMap(optional, default:None) Vertex property map to store the centrality values.
- norm
bool(optional, default:True) Whether or not the values should be normalized.
- g
- Returns:
- betweenness
VertexPropertyMap A vertex property map with the communicability betweenness values.
- betweenness
See also
communicabilityCommunicability between vertices
betweennessShortest-path betweenness centrality
current_flow_betweennessRandom-walk betweenness centrality
Notes
The communicability betweenness [estrada-communicability-2009] of a vertex \(r\) is
\[\omega_r = \sum_{p\ne q,\, p\ne r,\, q\ne r}\frac{G_{prq}}{G_{pq}},\]where \(G_{pq} = [e^{\boldsymbol A}]_{pq}\) is the communicability between \(p\) and \(q\) (see
communicability()), and \(G_{prq} = G_{pq} - [e^{\boldsymbol A - \boldsymbol E(r)}]_{pq}\) is the part of it due to the walks that visit \(r\), with \(\boldsymbol E(r)\) the matrix with the nonzero entries of the row and column of \(r\) in \(\boldsymbol A\), so that \(\boldsymbol A - \boldsymbol E(r)\) is the adjacency matrix with \(r\) removed. It is the analogue of the betweenness centrality (seebetweenness()) in which all walks are counted. For undirected graphs the sum is over the unordered pairs. Ifnorm == True, the values are divided by the number of pairs \((n-1)(n-2)\) (or half of it for undirected graphs). The pairs with no walks between them are omitted, and parallel edges are counted in \(\boldsymbol A\).The matrix exponential is computed for each vertex, from the eigendecomposition of the adjacency matrix (or with
scipy.linalg.expm(), for directed graphs), in time \(O(V^4)\) and memory \(O(V^2)\).References
[estrada-communicability-2009]Ernesto Estrada, Desmond J. Higham, and Naomichi Hatano, “Communicability betweenness in complex networks”, Physica A 388, 764-774 (2009), DOI: 10.1016/j.physa.2008.11.011 [sci-hub, @tor], arXiv: 0905.4102
Examples
>>> g = gt.collection.data["karate"] >>> cb = gt.communicability_betweenness(g) >>> print(cb.a.argmax(), cb.a.max()) 0 0.603031106...
The values can be visualized by drawing the network with vertex colors and sizes given by them:
>>> cmap = matplotlib.colors.LinearSegmentedColormap.from_list( ... "gray-blue", ["#d9d9d9", "#7dabd1"]) >>> gt.graph_draw(g, g.vp.pos, vertex_fill_color=cb, vcmap=cmap, ... vertex_size=gt.prop_to_size(cb, mi=5, ma=15), ... output="communicability_betweenness-karate.pdf") <...>
Communicability betweenness of the vertices of Zachary’s karate club network. The vertex colors, from gray to blue, and the vertex sizes increase with the value.#