Enumerating Stereoisomers of Tree Structured Molecules Using Dynamic Programming

Exhaustive enumeration of stereoisomers is one of the most fundamental and important problems in chemoinformatics. In this paper we deal with chemical compounds composed of carbon, hydrogen, oxygen and nitrogen atoms whose graphical structures are tree-like graphs, and consider stereoisomers caused only by asymmetry around carbon atoms. We introduce a mathematical representation for stereoisomers, and propose a dynamic programming algorithm of generating all stereoisomers without duplication. The algorithm first computes the number of stereoisomers of a given tree with n vertices in O(n) time and space. Then the algorithm constructs each stereoisomer by backtracking the process of computing the numbers of stereoisomers in O(n) space and in O(n) time per stereoisomer. The latter result is achieved by a fast bijection algorithm for combinations of distinct integers.