kirchhoff_index#
- graph_tool.centrality.kirchhoff_index(g, weight=None)[git][source]#
Return the Kirchhoff index of the graph.
- Parameters:
- g
Graph Graph to be used (the edge directions are ignored).
- weight
EdgePropertyMap(optional, default:None) Edge conductances. If not given, every edge has unit conductance.
- g
- Returns:
- Kf
float The sum of the effective resistances between all unordered pairs of vertices, or \(\infty\) if the graph is disconnected.
- Kf
See also
effective_resistanceEffective resistance between vertices
kemeny_constantKemeny’s constant
graph_tool.structure.wiener_indexSum of the shortest-path distances
graph_tool.spectral.laplacianLaplacian 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...