OEGetPathLength

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

Returns the shortest path length between two atoms i.e. the number of bonds between the two given atoms. For example, in thiazole (c1nccs1) the path length between the nitrogen and sulfur atom is 2.

src, dst

The two atoms for which the length of the shortest path returns. If the two atoms are the same OEAtomBase, have different parent molecule or are part of different disconnected molecular graphs, the OEGetPathLength function returns zero.

maxpath*

This 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