laplacian_centrality

laplacian_centrality#

graph_tool.centrality.laplacian_centrality(g, weight=None, vprop=None, norm=True)[git][source]#

Calculate the Laplacian centrality of each vertex.

Parameters:
gGraph

Graph to be used.

weightEdgePropertyMap (optional, default: None)

Edge weights. If not supplied, every edge has unit weight.

vpropVertexPropertyMap (optional, default: None)

Vertex property map to store the centrality values.

normbool (optional, default: True)

If True, the values are divided by the Laplacian energy of the graph.

Returns:
laplacianVertexPropertyMap

A vertex property map with the Laplacian centrality values.

See also

closeness_vitality

Closeness vitality

graph_tool.spectral.laplacian

Laplacian matrix

Notes

The Laplacian centrality [qi-laplacian-2012] of a vertex \(v\) is the drop of the Laplacian energy of the graph,

\[E(G) = \sum_{ij} L_{ij}^2,\]

when \(v\) is removed, i.e. \(E(G) - E(G\setminus v)\), where \(\boldsymbol L = \boldsymbol D - \boldsymbol A\) is the weighted Laplacian matrix. For undirected graphs without self-loops it is

\[E(G) - E(G\setminus v) = d_v^2 + \sum_u A_{vu}^2 + 2\sum_u A_{vu}d_u,\]

where \(A_{vu}\) is the total weight of the edges between \(v\) and \(u\), and \(d_v = \sum_{u\ne v}A_{vu}\) is the weighted degree of \(v\); self-loops are ignored. For directed graphs, the out-degree Laplacian \(L_{ij} = \delta_{ij}d^+_i - A_{ij}\) is used, with \(A_{ij}\) the total weight of the edges \(i\to j\) and \(d^+_i = \sum_{j\ne i}A_{ij}\), which gives

\[E(G) - E(G\setminus v) = (d^+_v)^2 + \sum_u A_{vu}^2 + 2\sum_u A_{uv}d^+_u.\]

If norm == True, the values are divided by \(E(G)\) (if it is nonzero). The computation takes time \(O(V + E)\).

References

[qi-laplacian-2012]

Xingqin Qi, Eddie Fuller, Qin Wu, Yezhou Wu, and Cun-Quan Zhang, “Laplacian centrality: A new centrality measure for weighted networks”, Information Sciences 194, 240-253 (2012), DOI: 10.1016/j.ins.2011.12.027 [sci-hub, @tor]

Examples

>>> g = gt.collection.data["karate"]
>>> lc = gt.laplacian_centrality(g)
>>> print(lc.a.argmax(), lc.a.max())
33 0.318713450...

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=lc, vcmap=cmap,
...               vertex_size=gt.prop_to_size(lc, mi=5, ma=15),
...               output="laplacian_centrality-karate.pdf")
<...>
../_images/laplacian_centrality-karate.png

Laplacian centrality of the vertices of Zachary’s karate club network. The vertex colors, from gray to blue, and the vertex sizes increase with the value.#