schultz_index

Contents

schultz_index#

graph_tool.structure.schultz_index(g, weights=None)[git][source]#

Return the Schultz index of the graph.

Parameters:
gGraph

Graph to be used. Edge directions are ignored.

weightsEdgePropertyMap (optional, default: None)

Edge weights (lengths).

Returns:
Sfloat

The Schultz index \(\sum_{u<v}(k_u + k_v) d_{uv}\) [schultz-topological-1989], where \(k_u\) is the degree, or \(\infty\) if the graph is not connected.

See also

gutman_index

Variant with products of degrees

wiener_index

Sum of the distances between all pairs

hyper_wiener_index

Wiener index that also includes squared distances

Notes

The Schultz index [schultz-topological-1989] is

\[S = \sum_{u<v}(k_u + k_v)\,d(u, v),\]

where the sum runs over the unordered pairs of distinct vertices, \(k_u\) is the total degree of \(u\) (the sum of its in- and out-degrees, for directed graphs), and \(d(u, v)\) is the length of a shortest path between \(u\) and \(v\), ignoring the edge directions (the number of its edges, or the sum of their weights). In the degrees, parallel edges are counted with their multiplicity and a self-loop contributes two, as in the handshake lemma; neither affects the distances. If the graph is not connected, \(S = \infty\). The distances are computed as in hyper_wiener_index().

Parallel implementation.

If enabled during compilation, this algorithm will run in parallel using OpenMP. See the parallel algorithms section for information about how to control several aspects of parallelization.

References

[schultz-topological-1989] (1,2)

Harry P. Schultz, “Topological organic chemistry. 1. Graph theory and topological indices of alkanes”, Journal of Chemical Information and Computer Sciences 29, 227-228 (1989), DOI: 10.1021/ci00063a012 [sci-hub, @tor]

Examples

>>> g = gt.collection.data["karate"]
>>> print(gt.schultz_index(g))
11221.0