Example #1
0
 def dfs(at1: Atom, m_append: Callable[[int], None]):
     at1._visited = True  # type: ignore[attr-defined]
     m_append(at1.id)
     for bond in at1.bonds:
         at2 = bond.other_end(at1)
         if not at2._visited:  # type: ignore[attr-defined]
             dfs(at2, m_append)
Example #2
0
    def dfs(at1: Atom, atom_set: Set[Atom]):
        at1._visited = True
        atom_set.add(at1)
        for at2 in at1.neighbors():

            if at2._visited:
                continue
            dfs(at2, atom_set)