code: def recognize_nx(mol):
      
      mol.rings = nx.cycle_basis(mol.graph)
      mol.isolated = sorted(nx.connected_components(mol.graph),
                            key=len, reverse=True)[1:]
      mol.scaffolds = [x for x in nx.biconnected_components(mol.graph)
                       if len(x) > 2]
docs: NetworkX implementation (for comparison)