Question
C++ help PLEASE calc_similarity_scores method creates a similarity matrix for all the users in the social network. Here the definition of similarity is the number
C++ help PLEASE
calc_similarity_scores method creates a similarity matrix for all the users in the social network. Here the definition of similarity is the number of friends that any pair of users have in common Use two nested for loops to iterate over all pairs of users in the network_data. For each pair of users you can obtain their vector of friends from the network_data, and then call the function num_in_common_between_vectors (vector1,vector2), which will return an integer, num_in_common, representing the number of friends those two users have in common. The int num_in_common will need to be stored in locations [user1][user2] and [user2][user1] of the similarity_matrix. Suggestion, to iterate over all pairs of users use the following: for i in range(n): for j in range(n): # call num_in_common_between_vectors using user is vector and user js vector as arguments
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started