mol_to_graph#

mol_to_graph(mol)[source]#

Convert an RDKit molecule to a NetworkX graph with atom features.

Parameters:

mol (rdkit.Chem.rdchem.Mol) – RDKit molecule object.

Returns:

G – NetworkX graph where nodes correspond to atom indices and edges correspond to bonds. Each node contains the following attributes:

  • symbol (str): Atomic symbol (e.g., ‘C’, ‘O’, ‘N’).

  • degree (int): Number of bonds (degree) for the atom.

Return type:

networkx.Graph