NetworkX implementation (for comparison)

def recognize_nx(mol):
    """ NetworkX implementation (for comparison)"""
    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]