Question: Write Map and Reduce functions in pseudocode for the following problem: Assume that you have the Twitter follower list for a large number of users.

Write Map and Reduce functions in pseudocode for the following problem:

Assume that you have the Twitter follower list for a large number of users. The follower list is provided in the following format: first user's twitter handle, second user's twitter handle to indicate that the second user is a follower of the first user. For example, alice01, bob02 would indicate that bob02 follows alice01.

(a) [15 points] Given input data containing many such user, follower pairs, write map and reduce functions to calculate the total number of followers for each user. The output file should contain the user names followed by a comma followed by a number indicating the number of followers of the user. For example, if alice01 has 7 followers, then the output should contain the line alice01, 7

[Hint: You can adapt the word count example to solve the above problem]

(b) [5 bonus points] Given input data containing many such user, follower pairs, write map and reduce functions to calculate the number of common followers for all pairs of users. For example, if alice01 and bob02 has 3 common followers, then the output should contain the line alice01, bob02, 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!