We investigate the chemical dissolution of porous media using a network model in which the system is represented as a series of interconnected pipes with the diameter of each segment increasing in proportion to the local reactant consumption. Moreover, the topology of the network is allowed to change dynamically during the simulation: as the diameters of the eroding pores become comparable with the interpore distances, the pores are joined together thus changing the interconnections within the network. With this model, we investigate different growth regimes in an evolving porous medium, identifying the mechanisms responsible for the emergence of specific patterns. We consider both the random and regular network and study the effect of the network geometry on the patterns. Finally, we consider practically important problem of finding an optimum flow rate that gives a maximum increase in permeability for a given amount of reactant.