Dynamics of social networks