Package org.openscience.cdk.graph
Class SpanningTree
- java.lang.Object
-
- org.openscience.cdk.graph.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 Summary
Fields Modifier and Type Field Description protected boolean[]
bondsInTree
-
Constructor Summary
Constructors Constructor Description SpanningTree(IAtomContainer atomContainer)
Create a new spanning tree for the provided molecule.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IRingSet
getAllRings()
All basic rings and the all pairs of basic rings share at least one edge combined.IRingSet
getBasicRings()
The basic rings of the spanning tree.int
getBondsAcyclicCount()
Number of acyclic bonds.int
getBondsCyclicCount()
Number of cyclic bonds.IAtomContainer
getCyclicFragmentsContainer()
Returns an IAtomContainer which contains all the atoms and bonds which are involved in ring systems.IAtomContainer
getPath(IAtomContainer spt, IAtom atom1, IAtom atom2)
Find a path connected a1 and a2 in the tree.IAtomContainer
getSpanningTree()
Access the computed spanning tree of the input molecule.int
getSpanningTreeSize()
Size of the spanning tree specified as the number of edges in the tree.boolean
isDisconnected()
Is the molecule disconnected and has more then one component.
-
-
-
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 treeatom1
- 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()
-
getAllRings
public IRingSet getAllRings() throws NoSuchAtomException
All basic rings and the all pairs of basic rings share at least one edge combined.- Returns:
- subset of all rings
- Throws:
NoSuchAtomException
- atom was not found in the molecule- See Also:
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.
-
-