kirchhoff_index

kirchhoff_index#

graph_tool.centrality.kirchhoff_index(g, weight=None)[git][source]#

Return the Kirchhoff index of the graph.

Parameters:
gGraph

Graph to be used (the edge directions are ignored).

weightEdgePropertyMap (optional, default: None)

Edge conductances. If not given, every edge has unit conductance.

Returns:
Kffloat

The sum of the effective resistances between all unordered pairs of vertices, or \(\infty\) if the graph is disconnected.

See also

effective_resistance

Effective resistance between vertices

kemeny_constant

Kemeny’s constant

graph_tool.structure.wiener_index

Sum of the shortest-path distances

graph_tool.spectral.laplacian

Laplacian matrix

Notes

The Kirchhoff index [klein-resistance-1993] (also called the effective graph resistance) is

\[K_f = \sum_{i<j} R_{ij} = V\,\mathrm{tr}(C) - \mathbf{1}^\top C\mathbf{1},\]

where \(R_{ij}\) is the effective resistance (see effective_resistance()) and \(C\) the inverse of the weighted Laplacian with the row and column of one vertex removed (and zeros in their place). It is computed from a sparse LU factorization, with \(O(V^2)\) memory.

References

[klein-resistance-1993]

D. J. Klein and M. Randić, “Resistance distance”, Journal of Mathematical Chemistry 12, 81-95 (1993), DOI: 10.1007/BF01164627 [sci-hub, @tor]

Examples

>>> g = gt.collection.data["karate"]
>>> print(gt.kirchhoff_index(g))
470.2681849...