Generates social networks based on distance.