Building SMARTS hierachies can be expensive for large datasets due to the cost of operations that scale with the number of chemical environments, specifically computing the union of all chemical environments Q 0 that matched the SMARTS S 0 (Eqn. 9) and all splits {S j } (Eqn. 12) for all SMARTS in the hierarchy. One way to overcome this is to divide the data in parts, e.g. each molecule, build a hierarchy for each part, then merge the results into a single hierarchy. Merging two SMARTS hierarchies is a useful operation, and we discuss an strategy below.