Condensation and topological phase transitions in a dynamical network model with rewiring of the links