schultz_index#

schultz_index(G, weight=None)[source]#

Returns the Schultz Index (of the first kind) of G

The Schultz Index [3] of a graph is the sum over all node pairs of distances times the sum of degrees. Consider an undirected graph G. For each node pair (u, v) compute dist(u, v) * (deg(u) + deg(v) where dist is the shortest path length between two nodes and deg is the degree of a node.

The Schultz Index is the sum of these quantities over all (unordered) pairs of nodes.

Parameters:
GNetworkX graph

The undirected graph of interest.

weightstring or None, optional (default: None)

If None, every edge has weight 1. If a string, use this edge attribute as the edge weight. Any edge attribute not present defaults to 1. The edge weights are used to computing shortest-path distances.

Returns:
number

The first kind of Schultz Index of the graph G.

References

[1]

I. Gutman, Selected properties of the Schultz molecular topological index, J. Chem. Inf. Comput. Sci. 34 (1994), 1087–1089. https://doi.org/10.1021/ci00021a009

[2]

M.V. Diudeaa and I. Gutman, Wiener-Type Topological Indices, Croatica Chemica Acta, 71 (1998), 21-51. https://hrcak.srce.hr/132323

[3]

H. P. Schultz, Topological organic chemistry. 1. Graph theory and topological indices of alkanes,i J. Chem. Inf. Comput. Sci. 29 (1989), 239–257.

Examples

The Schultz Index of the (unweighted) complete graph on n nodes equals the number of pairs of the n nodes times 2 * (n - 1), since each pair of nodes is at distance one and the sum of degree of two nodes is 2 * (n - 1).

>>> n = 10
>>> G = nx.complete_graph(n)
>>> nx.schultz_index(G) == (n * (n - 1) / 2) * (2 * (n - 1))
True

Graph that is disconnected

>>> nx.schultz_index(nx.empty_graph(2))
inf