code: def mol2dgl_single(smiles):
      n_edges = 0
  
      atom_x = []
      bond_x = []
  
      mol = get_mol(smiles)
      n_atoms = mol.GetNumAtoms()
      n_bonds = mol.GetNumBonds()
      for i, atom in enumerate(mol.GetAtoms()):
          assert i == atom.GetIdx()
          atom_x.append(atom_features(atom))
  
      bond_src = []
      bond_dst = []
      for i, bond in enumerate(mol.GetBonds()):
          begin_idx = bond.GetBeginAtom().GetIdx()
          end_idx = bond.GetEndAtom().GetIdx()
          features = bond_features(bond)
          bond_src.append(begin_idx)
          bond_dst.append(end_idx)
          bond_x.append(features)
          # set up the reverse direction
          bond_src.append(end_idx)
          bond_dst.append(begin_idx)
          bond_x.append(features)
      graph = dgl.graph((bond_src, bond_dst), num_nodes=n_atoms)
      n_edges += n_bonds
      return (
          graph,
          torch.stack(atom_x),
          torch.stack(bond_x) if len(bond_x) > 0 else torch.zeros(0),
      )
  
imports: import dgl
  import dgl.function
  import rdkit.Chem
  import torch
  import torch.nn
  import torch.nn.functional
  from dgl import line_graph, mean_nodes
  from .chemutils import get_mol
label_desc: Use image node_id 4 for calling a global function with example usage: mol2dgl_single(smiles) and returns: graph,  torch,  unknown