Input to surge consists of a molecular formula such as C 7 H 12 O 2 S. Based on the element counts, in this case C=7, O=2, S=1, H=12, the atom valencies are used to calculate the plausible range of the number of edges of a connected simple graph representing the topology of a molecule with this formula, with hydrogen atoms omitted. Then geng is called to generate all the connected simple graphs with those parameters, subject also to a maximum degree condition depending on the molecular formula . Geng generates one graph from each isomorphism class and these are passed to the second stage as they are produced, without any need to store them . In this example, there are 10 non-hydrogen atoms and the number of edges is in the range 9-11.