wiener_index#
- skfp.descriptors.wiener_index(mol: Mol, distance_matrix: ndarray | None = None) int #
Wiener Index (W).
Calculates the Wiener Index [1] [2], defined as the sum of all pairwise distances in the molecular graph distance matrix.
- Parameters:
mol (RDKit
Mol
object) – The molecule for which the Wiener 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 wiener_index >>> mol = MolFromSmiles("C1=CC=CC=C1") # Benzene >>> wiener_index(mol) 27