.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OEDetermineComponents

..  _oechem_oedeterminecomponents:

.. oe:function:: OEDetermineComponents

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

      .. oe:api::

         unsigned int OEDetermineComponents(const OEMolBase& mol,
                                            unsigned int* parts)

   .. oe:language:: python

      .. oe:api:: python

         OEDetermineComponents(mol: Union[OEGraphMol,OEMol,OEQMol]) -> Tuple[int, List[int]]

   Determines the connected components of a molecule.  The
   return value is the number of connected components found in the
   molecule.  If the molecule contains a single discrete molecule, the
   return value is one.  The 'parts' array must contain at least
   :oe:meth:`OEChem::OEMolBase::GetMaxAtomIdx` elements, and upon return
   it contains a mapping indexed by :oe:meth:`OEChem::OEAtomBase::GetIdx`
   of which part or connected component each atom is in.  The parts are
   numbered from one, up to and including the return value of the
   function.

   .. seealso::

      .. oe:language:: c++

         * :ref:`section_ring_system_components` section
         * Example program :ref:`parts2mols.cpp<section_example_oechem_parts2mols>`

      .. oe:language:: python

         * :ref:`section_ring_system_components` section
         * Example program :ref:`parts2mols.py<section_example_oechem_parts2mols>`

      .. oe:language:: java

         * :ref:`section_ring_system_components` section
         * Example program :ref:`Parts2Mols.java<section_example_oechem_parts2mols>`

      .. oe:language:: csharp

         * :ref:`section_ring_system_components` section
         * Example program :ref:`Parts2Mols.cs<section_example_oechem_parts2mols>`
