If we reach ∆ = ∅, then adding S to the products balances the reaction. In practice, this can be achieved by the basic DFS search outlined in Alg. 1. A call to DFS(∆, R, ∅) either returns all (multi)sets of compounds S that balances the reaction and leaves an empty dictionary ∆, or it terminates without output. By ∆ ⊖ r we denote the dictionary ∆ after being modified by the application of a rule r.