# OEGetSubtree¶

OESystem::OEIterBase<OEAtomBase> *
OEGetSubtree(const OEAtomBase *bgn,
const OEAtomBase *end, unsigned int maxdepth = 0))


Traverses the subgraph from the end atom and avoids crossing over the bond to the bgn atom.

maxdepth
This parameter enables partial tree traversal in ring structures, default is zero which means full depth search.
OESystem::OEIterBase<OEAtomBase> *
OEGetSubtree(const OEBondBase bond*,
const OESystem::OEUnaryPredicate<OEAtomBase> &excludeAtoms,
unsigned int maxdepth = 0))


Traverses the subgraph from the beginning atom of the bond passed as the first argument without crossing the bond itself.

If the subgraph traversal does not cross any atoms which return true when tested with the excludeAtoms predicate, then an iterator over the atoms contained in the subgraph is returned. If ‘excludeAtoms` are encountered in the subgraph traversal, the subgraph is discarded and a new traversal begins from the end atom of the bond. If the new traversal fails to encounter excluded atoms then an iterator over the atoms contained in the subgraph is returned. If both traversals fail then an iterator over an empty set of atoms is returned.

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