finished friends_of_friends function