Adaptive evolution of bacterial metabolic networks by horizontal gene transfer