.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OEGetSmallestSubtree

.. oe:function:: OEGetSmallestSubtree

   .. oe:language:: c++ java csharp

      .. oe:api::

         OESystem::OEIterBase<OEAtomBase>* OEGetSmallestSubtree(const OEBondBase * bond,
                                                                unsigned int maxdepth = 0)
         OESystem::OEIterBase<OEAtomBase>* OEGetSmallestSubtree(const OEBondBase* bond,
                                                                const OESystem::OEUnaryPredicate<OEAtomBase>& excludeAtoms,
                                                                unsigned int maxdepth = 0)

   .. oe:language:: python

      .. oe:api:: python

         OEGetSmallestSubtree(arg1: OEBondBase, maxDepth: int = 0) -> OEAtomIter
         OEGetSmallestSubtree(bond: OEBondBase, excludeAtoms: OEUnaryAtomPred,
                              maxDepth: int = 0) -> OEAtomIter

   This function traverses the subgraph of all connected atoms on one end
   of a bond passed as the argument without crossing the bond itself.  If
   the number of contiguous atoms connected to the beginning atom of the
   bond exceeds half of the atoms in the molecule, that subtree is
   discarded and a new traversal begins starting with the end atom of the
   bond.  The bond itself may not be crossed in the second traversal.  An
   iterator over the atoms that are members of the smallest subgraph is
   returned.  The root atom of the bond from which the smallest subtree
   originates is included in the atom iterator returned.

   *maxdepth*
     This parameter enables partial tree traversal in ring structures, default
     is zero which means full depth search.

   .. seealso::

      * :oe:func:`OEChem::OEGetSubtree` function
