zagreb_index_m2#

skfp.descriptors.zagreb_index_m2(mol: Mol) int#

Second Zagreb Index.

Calculates the second Zagreb index [1], defined as the sum of the product of degrees of all pairs of adjacent atoms in the molecule. It provides a measure related to molecular branching and the connectivity of bonds. The formula for calculating the second Zagreb index is given as:

\[M_2 = \sum_{(u,v) \in E} d_u \cdot d_v\]

where:

  • \(E\) is the set of bonds (edges) in the molecular graph

  • \(d_u\) and \(d_v\) are the degrees of the atoms \(u\) and \(v\) connected by a bond

Parameters:

mol (RDKit Mol object) – The molecule for which the second Zagreb index is to be calculated.

References

Examples

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