# Chemical Graph Generators

This is a PLOS Topic Page draft

Public peer review comments will be posted here

Authors

Mehmet Aziz Yirik
AFFILIATION: Analytical Chemistry, University of Jena , Lessingstrasse 8, 07743, Jena, Germany
https://orcid.org/0000-0001-7520-7215

Christoph Steinbeck
AFFILIATION: Analytical Chemistry, University of Jena , Lessingstrasse 8, 07743, Jena, Germany
https://orcid.org/0000-0001-6966-0814

## Abstract

Chemical Graph Generators are software packages to generate computer representations of chemical structures adhering to certain boundary conditions. Their development is a research topic of cheminformatics. Chemical Graph Generators are used in areas such as virtual library generation in drug design, for organic synthesis design or in systems for computer-assisted structure elucidation (CASE). CASE systems again have regained interest for the structure elucidation of unknowns in computational metabolomics, a current area of computational biology. Here we describe the theoretical basis of chemical graph generators and provide a historical overview of their development.

## History

Molecular structure generation is a branch of graph generation problems. Molecular structures are graphs with chemical constraints such as valences, bond multiplicity and fragments. The first structure generators were graph generators modified versions for chemical purposes. CONGEN was the first structure generator developed for the DENDRAL project, the first artificial intelligence project in organic chemistry [1]. CONGEN dealt well with overlaps in substructures. The overlaps among substructures other than atoms were used as the building blocks. For the case of stereoisomers, symmetry group calculations were performed for duplicate detection. Another early attempt was made by Abe in 1975 using a pattern recognition-based structure generator [2]. The algorithm had two steps: first, the prediction of the substructure from low-resolution spectral data; second, the assembly of these substructures based on a set of construction rules. A year later, a mathematical method, MASS [3], a tool for mathematical synthesis and analysis of molecular structures, was reported. Mathematically speaking, the algorithm worked as an adjacency matrix generator. Following MASS, Abe and his collaborators published the first paper on CHEMICS [4], which is a computer-assisted structure elucidation (CASE) tool comprising structure generation methods. The program relies on a predefined non-overlapping fragment library. For the input spectral data, the matching component sets are used as building blocks. These component sets were ranked from primary to tertiary substructures. Substantial contributions were made by Shelley and Munk, who published a large number of CASE papers in this field. The first paper reported a structure generator, ASSEMBLE [5]. The algorithm is considered one of the earliest assembly methods in the field. As the name indicates, the algorithm assembles substructures with overlaps to construct structures. ASSEMBLE overcomes overlapping by including a “neighbouring atom tag”. Later, the algorithm became part of a CASE system called CASE. The second version of ASSEMBLE was released in 2000. Between the releases of these two versions, the same team also reported a different approach, the first structure reduction method, COCOA [6]. The method is an exhaustive, recursive bond-removal procedure. Unlike the assembly approaches, a hypergraph is constructed with all the spectral information. During generation, the size of this hypergraph is decreased by removing irrelevant bonds from the graph. The efficiency and exhaustivity of generators are also related to the data structures. Unlike previous methods, AEGIS was a list-processing generator [7]. Compared to adjacency matrices, list data requires less memory. As no spectral data was interpreted in this system, the user needed to provide substructures as inputs. LSD (Logic for Structure Determination) is an important contribution from French scientists [8]. The tool uses spectral data information such as HMBC and COSY data to generate all possible structures. LSD is still used as an open source structure generator with GPL (General Public License). As successors of these generators, a series of stochastic generators were reported by Faulon. His software, SIGNATURE [9], was integrated into this stochastic generator for canonical labelling and duplicate checks [10]. In 1994, the same year that Faulon released the stochastic structure generator, Chinese scientists reported an integer partitioning-based structure generator [11]. The decomposition of the molecular formula into fragments, components and segments was performed as an application of integer partitioning. These fragments were then used as building blocks in the structure generator. This structure generator was part of a CASE system, ESESOC [12]. After Munk’s assembly and reduction methods, Bohanec published a method combining these two methods [13]. The aim of this assembly and reduction process was to combine the benefits of the two methods to develop an efficient structure generator. First, the useless connections were eliminated, and then, the substructures were assembled. Eliminating these connections at the beginning accelerated the assembly approach relative to previous methods. Structure generators can also vary based on the type of data used, such as HMBC, HSQC and NMR data. LUCY is an open-source structure elucidation method based on the HMBC data of unknown molecules [14], and involves an exhaustive 2-step structure generation process where first all combinations of interpretations of HBMC signals are implemented in a connection matrix, which is then completed by a deterministic generator filling in missing bond information. This platform could generate structures with any arbitrary size of molecules; however, molecular formulas with more than 30 heavy atoms took are too time consuming for practical applications. This limitation highlighted the need for a new CASE system. SENECA was developed to eliminate the shortcomings of LUCY [15]. To overcome the limitations of the exhaustive method, SENECA was developed as a stochastic method to find optimal solutions. The systems comprise two stochastic methods: simulated annealing and genetic algorithms. First, a random structure is generated; then, its energy is calculated to evaluate the structure and its spectral properties. By transforming this structure into another structure, the process continues until the optimum energy is reached. In the generation, this transformation relies on equations based on Faulon’s rules. Approximately 30 years after the first DENDRAL paper, Molchanova published a mathematical structure generator, SMOG, as a descendant of CONGEN [16]. Many mathematical generators are descendants of efficient branch-and-bound methods from Faradjev [17] and Read [18]. Although their report is from the 1970s, this study is still the fundamental reference for structure generators. One of the earliest structure generators, SMOG, was a modification of the Faradjev method. In this algorithm, canonicity criteria and isomorphism checks are based on automorphic groups from mathematics. Many other algorithms, such as MASS, MOLGEN and Bangov’s studies [19], were developed as descendants of this method. These generators were purely mathematical and applied automorphism groups in the generation of adjacency matrices. An automorphism group of a graph consists of all its symmetries, and thus an awareness of symmetry types accelerates the construction process. To date, MOLGEN is the only maintained efficient generic structure generator. The tool was developed a closed-source platform by a group of mathematicians as an application of computational group theory. Another well-known commercial structure generator is from ACD Labs, and notably, one of the developers of MASS, Elyashberg. The structure generator was part of a known CASE system called StrucEluc [20]. In 2012, Peironcely introduced the first open-source structure generator called Open Molecule Generator (OMG) [21]. The algorithm relies on two methods: canonical path augmentation and McKay’s NAUTY package [22]. NAUTY is a program for computing automorphism groups as well as the canonical labelling of graphs. Automorphism of a graph is a mapping of the graph to itself by preserving the edge-vertex connectivity. Compared to MOLGEN, OMG generates large molecules almost 2000 times slower than can be achieved with MOLGEN.

## Mathematical Basis

### Chemical Graphs

In a graph representing a chemical structure, the vertices and edges represent atoms and bonds, respectively. The bond order corresponds to the edge multiplicity, and as a result, chemical graphs Molecular graph are generally multigraphs. A multigraph ${\displaystyle G=(V,E)}$ is described as a chemical graph where ${\displaystyle V}$ is the set of vertices, i.e., atoms, and ${\displaystyle E}$ is the set of edges, which represents the bonds. In graph theory, the degree of a vertex is its number of connections. In a chemical graph, the maximum degree of an atom is its valence, and the maximum number of bonds a chemical element can make. For example, carbon’s valence is 4. In a chemical graph, an atom is saturated if it reaches its valence. A graph is connected if there is at least one path between each pair of vertices. A connectivity check is one of the mandatory intermediate steps in structure generation because the aim is to generate fully saturated molecules. A molecule is saturated if all its atoms are saturated.

### Symmetry Groups for Molecular Graphs

For a set of elements, a permutation is a rearrangement of these elements [23]. An example is given below:

 ${\displaystyle x}$ 1 2 3 4 5 6 7 8 9 10 11 ${\displaystyle f(x)}$ 4 2 11 6 1 5 8 9 7 10 3

The second line of Table 1 shows a permutation of the first line. The multiplication of permutations, ${\displaystyle a}$ and ${\displaystyle b}$, is defined as a function composition, as shown below.

${\displaystyle (ab)(x)=a(b(x))}$

The combination of two permutations is also a permutation. A group Group theory, ${\displaystyle G}$, is a set of elements together with an associative binary operation ${\displaystyle *}$ defined on ${\displaystyle G}$ such that the following are true:

• There is an element ${\displaystyle I}$ in ${\displaystyle G}$ satisfying ${\displaystyle g*I=g}$, for all elements ${\displaystyle g}$ of ${\displaystyle G}$.
• For each element of G, there is an element ${\displaystyle g^{-1}}$ such that ${\displaystyle g*g^{-1}}$ is equal to the identity element.

The order of a group is the number of elements in the group. Let us assume ${\displaystyle X}$ is a set of permutations over a set of numbers. Under the function composition operation, ${\displaystyle Sym(X)}$ is a symmetry group Permutation group. If the size of ${\displaystyle X}$ is ${\displaystyle n}$, then the order of ${\displaystyle Sym(X)}$ is ${\displaystyle n!}$. Set systems consist of a finite set ${\displaystyle X}$ and its subsets, called blocks of the set. The set of permutations preserving the set system is used to build the automorphisms of the graph Graph automorphism. An automorphism permutes the vertices of a graph; in other words, mapping a graph onto itself. This action is edge-vertex preserving. If ${\displaystyle (u,v)}$ is an edge of the graph, ${\displaystyle G=(E,V)}$, and ${\displaystyle a}$ is a permutation of ${\displaystyle V}$, then

${\displaystyle a({u,v})=(a(u),a(v))}$

A permutation ${\displaystyle a}$ of ${\displaystyle V}$ is an automorphism of the graph ${\displaystyle G=(E,V)}$ if

${\displaystyle a((u,v))}$ is an element of ${\displaystyle E}$, if ${\displaystyle {u,v}}$ is an element of ${\displaystyle E}$.

The automorphism group of a graph ${\displaystyle G}$, denoted ${\displaystyle Aut(G)}$, is the set of all automorphisms on ${\displaystyle V}$. In molecular graphs, canonical labelling and molecular symmetry detection are implementations of automorphism groups. NAUTY is an efficient software package for automorphism group calculations and canonical labelling. OMG is an implementation of NAUTY.

## Methods

Generation methods are the core of CASE systems. These generators relied on combinatorial methods. In a generator, the molecular formula is the basic input. If fragments are obtained from the experimental data, they can also be used as inputs to accelerate generation. The literature classifies generators into two major types: structure assembly and structure reduction. The algorithmic complexity and the run time are the criteria used for comparison.

### Structure Assembly

The generation process starts with a set of atoms from the molecular formula. In structure assembly, atoms are combinatorically connected to consider all possible extensions. If substructures are obtained from the experimental data, the generation starts with these substructures. These substructures provide known bonds in the molecule. One of the earliest assembly methods was Shelley and Munk’s CASE [24] system, which included the ASSEMBLE generator [25]. The generator is purely mathematical and does not involve the interpretation of any spectral data. Spectral data are used for structure scoring and substructure information. Based on the molecular formula, the generator forms bonds between pairs of atoms, and all the extensions are checked against the given constraints. If the process is considered as a tree Tree (graph theory), the first node of the tree is an atom set with substructures if any are provided by the spectral data. By extending the molecule with a bond, an intermediate structure is built. Each intermediate structure can be represented by a node in the generation tree. ASSEMBLE was developed with a user-friendly interface to facilitate use. The tree approach is the skeleton of many generators. For example, Peironcely’s structure generator, OMG, takes atoms and substructures as inputs and extends the structures using a breadth-first search method. This tree extension terminates when all the branches reach saturated structures. Another assembly method is GENOA. Compared to ASSEMBLE and many other generators, GENOA is a constructive substructure search-based algorithm, and it assembles different substructures by also considering the overlaps. CHEMICS is also a well-known CASE system that provides a novel structure generator algorithm. The earliest CHEMICS paper, based on the vector representation of components, was published in 1977. It generates different types of component sets ranked from primary to tertiary based on component complexity. The primary set contains atoms, i.e., C, N, O and S, with their hybridization. The secondary and tertiary component sets are built layer-by-layer starting with these primary components. These component sets are represented as vectors and are used as inputs in the process. In the generation trees, considering all possible extensions leads to a combinatorial explosion. Orderly generation is performed to cope with this exhaustivity. Many assembly algorithms, such as OMG, MOLGEN and Faulon’s structure generator [26], are orderly generation methods. Faulon’s structure generator relies on equivalence classes over atoms. Atoms with the same interaction type and element are grouped in the same equivalence class. Rather than extending all atoms in a molecule, one atom from each class is extended. OMG generates structures based on the canonical augmentation method from McKay’s NAUTY package. This method is an early attempt at orderly graph generation. The algorithm calculates canonical labelling and then extends structures by adding one bond. To keep the extension canonical, canonical bonds are added [27]. Despite NAUTY an efficient tool for graph canonical labelling, OMG is 2000 times slower than MOLGEN. The problem is the storage of all the intermediate structures. OMG has since been parallelized, and the developers released PMG (Parallel Molecule Generator) [28]. MOLGEN outperforms PMG using only 1 core; however, PMG outperforms MOLGEN by increasing the number of cores to 10. Constructive search algorithms are branch-and-bound methods Branch and bound, which are a solution to memory problems. These methods are matrix generation algorithms. In contrast to previous methods, these methods build all the connectivity matrices without building intermediate structures. The generation process is simplified by solving matrix generation as a numerical problem. MASS, SMOG and MOLGEN are good examples of matrix generators used in the literature. These are all descendants of the Faradjev algorithm, which was the first graph generator. Many structure generators refer to this study. MASS is a method of mathematical synthesis. First, it builds all incidence matrices for a given molecular formula. The atom valences are used as the input for matrix generation. The matrices are generated by considering all the possible interactions among atoms with respect to the constraints and valences. The benefit of constructive search algorithms is their low memory usage. SMOG is a successor of MASS and relies on a similar approach. This algorithm can be considered the chemical version of the Faradjev algorithm. Unlike previous methods, MOLGEN is an algebraic combinatorics method that relies on group theorems. Applied group theory is performed in the orderly generation of the matrices. Many different versions of MOLGEN have been developed, and they provide various functions. Based on the users’ needs, different types of inputs can be used. For example, MOLGEN-MS [29] allows users to input MS data of an unknown molecule. Compared to many other generators, MOLGEN approaches the problem from different angles. The key feature of MOLGEN is generating structures without building all the intermediate structures and without generating duplicates. It first generates all the combinatorically possible connectivity matrices and determines if a matrix represents a saturated molecule that satisfies the constraints.

### Structure Reduction

Unlike these assembly methods, reduction methods make all the bonds between atom pairs, generating a hypergraph. Then, the size of the graph is reduced with respect to the constraints. First, the existence of substructures in the hypergraph is checked. Unlike assembly methods, the generation tree starts with the hypergraph, and the structures decrease in size at each step. Bonds are deleted based on the substructures. If a substructure is no longer in the hypergraph, the substructure is removed from the constraints. Overlaps in the substructures were also considered due to the hypergraphs. The earliest reduction-based structure generator is COCOA. Generated fragments are described as atom-centred fragments to optimize storage, comparable to circular fingerprints and atom signatures. Rather than storing structures, only the list of first neighbours of each atom is stored. The main disadvantage of reduction methods is the massive size of the hypergraphs. Indeed, for molecules with unknown structures, the size of the hyper structure becomes extremely large, resulting in a proportional increase in the run time. Bohanec’s structure generator, GEN [30], combines two tasks: structure assembly and structure reduction. Like COCOA, the initial state of the problem is a hyper structure. Both assembly and reduction methods have advantages and disadvantages, and the GEN tool avoids these disadvantages in the generation step. In other words, structure reduction is efficient when structural constraints are provides, and structure assembly is faster without constraints. First, the useless connections were eliminated, and then the substructures were assembled to build structures. Thus, GEN copes with the constraints in a more efficient way by combining these methods. GEN removes the connections creating the forbidden structures, and then the connection matrices are filled based on substructure information. The method does not accept overlaps among substructures. Once the structure is built in the matrix representation, the saturated molecule is stored in the output list. Munk and his team improved the COCOA method and built a new generator, HOUDINI [31] HOUDINI relies on two data structures: a square matrix of compounds representing all bonds in a hyper structure is constructed, and second, substructure representation is used to list atom-centred fragments. In the structure generation, HOUDINI maps all the atom-centred fragments onto the hyper structure.

## Conclusion

The structural identification of unknown molecules is an interdisciplinary field involving mathematicians, chemists and computer scientists; moreover, it has led to the creation of the field of mathematical chemistry and cheminformatics. The state-of-art methods comprise a variety of algorithms that can be classified into two groups; moreover, structure assembly has been the dominant approach in the field. Both assembly and reduction methods are incremental processes: all the intermediate structures are constructed based on previously generated structures, and duplicates are then excluded. The algorithms are generally breadth-first searches and terminate once all the structures are saturated. The generation of too many intermediate structures and their storage make these algorithms inefficient. In the field, matrix generators have been attracting increasing interest from many scientists. According to the literature, there is still a lack of mathematical algorithms; more precisely, there is a lack of efficient open-source structure generators.

## References

1. ^ G. Sutherland, ‘DENDRAL - A computer program for generating and filtering chemical structures’, Stanf. Artifical Intell., vol. 49, p. 34.
2. ^ H. Abe and P. C. Jurs, ‘Automated chemical structure analysis of organic molecules with a molecular structure generator and pattern recognition techniques’, Anal. Chem., vol. 47, no. 11, pp. 1829–1835, 1975.
3. ^ V. V. Serov, M. E. Elyashberg, and L. A. Gribov, ‘Mathematical synthesis and analysis of molecular structures’, J. Mol. Struct., vol. 31, no. 2, pp. 381–397, 1976.
4. ^ S. I. Sasaki et al., ‘CHEMICS-F: A Computer Program System for Structure Elucidation of Organic Compounds’, J. Chem. Inf. Comput. Sci., vol. 18, no. 4, pp. 211–222, 1978
5. ^ C. A. Shelley and M. E. Munk, ‘Case, a computer model of the structure elucidation process’, Anal. Chim. Acta, vol. 133, no. 4, pp. 507–516, 1981.
6. ^ B. D. Christie and M. E. Munk, ‘Structure Generation by Reduction: A New Strategy for Computer-Assisted Structure Elucidation’, J. Chem. Inf. Comput. Sci., vol. 28, no. 2, pp. 87–93, 1988.
7. ^ H. J. Luinge and J. H. Van Der Maas, ‘AEGIS, an algorithm for the exhaustive generation of irredundant structures’, Chemom. Intell. Lab. Syst., vol. 8, no. 2, pp. 157–165, Jun. 1990.
8. ^ J.-M. Nuzillard and M. Georges, ‘Logic for structure determination’, Tetrahedron, vol. 47, no. 22, pp. 3655–3664, 1991.
9. ^ J.-L. Faulon, D. P. Visco, and R. S. Pophale, ‘The signature molecular descriptor. 1. Using extended valence sequences in QSAR and QSPR studies’, J. Chem. Inf. Comput. Sci., vol. 43, no. 3, pp. 707–720, 2003.
10. ^ J.-L. Faulon, ‘Stochastic Generator of Chemical Structure. 1. Application to the Structure Elucidation of Large Molecules’, J. Chem. Inf. Model., vol. 34, no. 5, pp. 1204–1218, Sep. 1994.
11. ^ C.-Y. Hu and L. Xu, ‘Principles for structure generation of organic isomers from molecular formula’, Anal. Chim. Acta, vol. 298, no. 1, pp. 75–85, Nov. 1994.
12. ^ J. Hao, L. Xu, and C. Hu, ‘Expert system for elucidation of structures of organic compounds (ESESOC): —Algorithm on stereoisomer generation’, Sci. China Ser. B Chem., vol. 43, no. 5, pp. 503–515, Oct. 2000.
13. ^ S. Bohanec, ‘Structure Generation by the Combination of Structure Reduction and Structure Assembly’, J. Chem. Inf. Comput. Sci., vol. 35, no. 3, pp. 494–503, 1995.
14. ^ C. Steinbeck, ‘LUCY - A program for structure elucidation from NMR correlation experiments’, Angew. Chem. Int. Ed. Engl., vol. 35, no. 17, pp. 1984–1986, 1996.
15. ^ C. Steinbeck, ‘SENECA: A Platform-Independent, Distributed, and Parallel System for Computer-Assisted Structure Elucidation in Organic Chemistry’, J. Chem. Inf. Comput. Sci., vol. 41, no. 6, pp. 1500–1507, 2001.
16. ^ M. S. Molchanova, V. V. Shcherbukhin, and N. S. Zefirov, ‘Computer generation of molecular structures by the SMOG program’, J. Chem. Inf. Comput. Sci., vol. 36, no. 4, pp. 888–899, 1996.
17. ^ I. Faradzev, ‘Constructive enumeration of combinatorial objects’, in Colloq. Internat. CNRS, 1978, vol. 260, pp. 131–135.
18. ^ R. C. Read, ‘Every one a winner or how to avoid isomorphism search when cataloguing combinatorial configurations’, in Annals of Discrete Mathematics, vol. 2, Elsevier, 1978, pp. 107–120.
19. ^ I. Bangov and K. Kanev, ‘Computer-assisted structure generation from a gross formula: II. Multiple bond unsaturated and cyclic compounds. Employment of fragments’, J. Math. Chem., vol. 2, no. 1, pp. 31–48, 1988.
20. ^ K. Blinov, M. Elyashberg, S. Molodtsov, A. Williams, and E. Martirosian, ‘An expert system for automated structure elucidation utilizing 1H-1H, 13C-1H and 15N-1H 2D NMR correlations’, Fresenius J. Anal. Chem., vol. 369, no. 7–8, pp. 709–714, 2001.
21. ^ J. E. Peironcely et al., ‘OMG: Open molecule generator’, J. Cheminformatics, vol. 4, no. 9, pp. 1–13, 2012.
22. ^ B. D. McKay and A. Piperno, ‘Practical graph isomorphism, II’, J. Symb. Comput., vol. 60, pp. 94–112, 2014.
23. ^ D. L. Kreher and D. R. Stinson, Combinatorial Algorithms: Generation, Enumeration, and Search. CRC Press, 1998.
24. ^ C. A. Shelley and M. E. Munk, ‘Case, a computer model of the structure elucidation process’, Anal. Chim. Acta, vol. 133, no. 4, pp. 507–516, 1981.
25. ^ M. Badertscher et al., ‘Assemble 2.0: A structure generator’, Chemom. Intell. Lab. Syst., vol. 51, no. 1, pp. 73–79, 2000.
26. ^ J. L. Faulon, ‘On Using Graph-Equivalent Classes for the Structure Elucidation of Large Molecules’, J. Chem. Inf. Comput. Sci., vol. 32, no. 4, pp. 338–348, 1992.
27. ^ B. D. McKay and A. Piperno, ‘Practical graph isomorphism, II’, J. Symb. Comput., vol. 60, pp. 94–112, 2014.
28. ^ M. M. Jaghoori et al., ‘PMG: Multi-core metabolite identification’, Electron. Notes Theor. Comput. Sci., vol. 299, pp. 53–60, 2013.
29. ^ A. Kerber and R. Laue, ‘MOLGEN-MS: Evaluation of low resolution electron impact mass spectra with MS classification and exhaustive structure generation’, Adv. Mass Spectrom., vol. 15, no. 2, pp. 939–940, 2001.
30. ^ S. Bohanec, ‘Structure Generation by the Combination of Structure Reduction and Structure Assembly’, J. Chem. Inf. Comput. Sci., vol. 35, no. 3, pp. 494–503, 1995.
31. ^ A. Korytko, K.-P. Schulz, M. S. Madison, and M. E. Munk, ‘HOUDINI: A New Approach to Computer-Based Structure Generation’, J. Chem. Inf. Comput. Sci., vol. 43, no. 5, pp. 1434–1446, Sep. 2003.