We propose a new formulation for the problem of ab initio metabolic pathway reconstruction. Given a set of biochemical reactions together with their substrates and products, we consider the reactions as transfers of atoms between the chemical compounds and we look for successions of reactions transferring a maximal (or preset) number of atoms between a given source and sink compound. We state this problem as the one of finding a composition of partial injections that maximizes the image size. First, we study the theoretical complexity of this problem, state some related problems and then give a practical algorithm to solve them. Finally, we present two applications of this approach to the reconstruction of the tryptophan biosynthesis pathway and to the glycolysis.