Class SpanningTree


  • public class SpanningTree
    extends Object
    Spanning tree of a molecule. Used to discover the number of cyclic bonds in order to prevent the inefficient AllRingsFinder to run for too long.
    Author:
    Nina Jeliazkova
    Dictionary pointer(s):
    graphSpanningTree in the Blue Obelisk Chemoinformatics Dictionary [blue-obelisk:graphSpanningTree]
    Source code:
    main
    Belongs to CDK module:
    core
    Keywords:
    spanning tree, ring finding
    • Field Detail

      • bondsInTree

        protected boolean[] bondsInTree
    • Constructor Detail

      • SpanningTree

        public SpanningTree​(IAtomContainer atomContainer)
        Create a new spanning tree for the provided molecule.
        Parameters:
        atomContainer - molecule to make a spanning tree for.
    • Method Detail

      • isDisconnected

        public boolean isDisconnected()
        Is the molecule disconnected and has more then one component.
        Returns:
        the molecule is disconnected
      • getSpanningTree

        public IAtomContainer getSpanningTree()
        Access the computed spanning tree of the input molecule.
        Returns:
        acyclic tree of the input molecule
      • getPath

        public IAtomContainer getPath​(IAtomContainer spt,
                                      IAtom atom1,
                                      IAtom atom2)
                               throws NoSuchAtomException
        Find a path connected a1 and a2 in the tree. If there was an edge between a1 and a2 this path is a cycle.
        Parameters:
        spt - spanning tree
        atom1 - start of path (source)
        atom2 - end of path (target)
        Returns:
        a path through the spanning tree from the source to the target
        Throws:
        NoSuchAtomException - thrown if the atom is not in the spanning tree
      • getBasicRings

        public IRingSet getBasicRings()
                               throws NoSuchAtomException
        The basic rings of the spanning tree. Using the pruned edges, return any path which connects the end points of the pruned edge in the tree. These paths form cycles.
        Returns:
        basic rings
        Throws:
        NoSuchAtomException - atoms not found in the molecule
      • getCyclicFragmentsContainer

        public IAtomContainer getCyclicFragmentsContainer()
        Returns an IAtomContainer which contains all the atoms and bonds which are involved in ring systems.
        Returns:
        the IAtomContainer as described above
        See Also:
        getAllRings(), getBasicRings()
      • getSpanningTreeSize

        public int getSpanningTreeSize()
        Size of the spanning tree specified as the number of edges in the tree.
        Returns:
        number of edges in the spanning tree
      • getBondsAcyclicCount

        public int getBondsAcyclicCount()
        Number of acyclic bonds.
        Returns:
        Returns the bondsAcyclicCount.
      • getBondsCyclicCount

        public int getBondsCyclicCount()
        Number of cyclic bonds.
        Returns:
        Returns the bondsCyclicCount.