The dynamics of networks