OEGetPathLengthΒΆ

unsigned int OEGetPathLength(const OEAtomBase *, const OEAtomBase *,
                             unsigned int maxpath=0)

Returns the shortest path length between the ‘src’ and ‘dst’ atoms, i.e. the number of bonds between the ‘src’ and ‘dst’ atoms. For example, in thiazole (c1nccs1) the path length between ‘n’ and ‘s’ is 2. If the ‘src’ and ‘dst’ atoms are the same OEAtomBase, or have different parent MolBases or are disconnected, this function returns the value zero.

The ‘maxpath’ parameter may be used to specify a maximum path length to consider before terminating the search. If this value is zero, the default, there is no upper bound on the returned path length. Otherwise, if the shortest path between the two atoms is greater than ‘maxpath’ bonds, this function returns the value zero.

See also