graph_distance_index#

skfp.descriptors.graph_distance_index(mol: Mol, distance_matrix: ndarray | None = None) int#

Graph Distance Index (GDI).

Calculates the Graph Distance Index [1], defined as the squared sum of all graph distance counts in the molecular graph’s distance matrix. The formula for calculating GDI is given as:

\[GDI = \sum_{k=1}^{D} \left(k \cdot f_k\right)^2\]

where:

  • \(D\) is the topological diameter of the graph (the largest graph distance)

  • \(f_k\) is the total number of distances in the graph equal to \(k\)

Parameters:
  • mol (RDKit Mol object) – The molecule for which the Graph Distance Index is to be calculated.

  • distance_matrix (np.ndarray, optional) – Precomputed distance matrix. If not provided, it will be calculated using RDKit.

References

Examples

>>> from rdkit.Chem import MolFromSmiles
>>> from skfp.descriptors import graph_distance_index
>>> mol = MolFromSmiles("C1=CC=CC=C1")  # Benzene
>>> graph_distance_index(mol)
261