Efficiency driven evolution of networks