Mutual Friends MapReduce Application
Contents
Motivation
Finding mutual friends is a compelling MapReduce App and has a nice write up on the web.
Background
Code To Investigate
Account
AccountId
AccountIdSetIntersection
Code To Implement
class: | MutualFriendsMapper.java | |
methods: | map | |
package: | mapreduce.apps.friends.studio | |
source folder: | student/src/main/java |
method: public void map(Account account, BiConsumer<OrderedPair<AccountId>, Set<AccountId>> keyValuePairConsumer)
(sequential implementation only)
The only method you will need to alter is the map method. In this method, you will need to map every combination of the account holder to his/her friends. In order to do this, create ordered pairs of the given account’s ID and the IDs of the account holder’s friends. You must then feed each individual ordered pair into the keyValuePairConsumer along with the full set of the account holder’s friends.
Hint: check out the methods in the Account class for help.
class: | MutualFriendsClassicReducer.java | |
methods: | finisher | |
package: | mapreduce.apps.friends.studio | |
source folder: | student/src/main/java |
method: public Function<List<Set<AccountId>>, MutualFriendIds> finisher()
(sequential implementation only)
Investigate MutualFriendIds
for clues on what you need to do.
Testing Your Solution
Correctness
class: | MutualFriendsStudioTestSuite.java | |
package: | mapreduce.apps.friends.studio | |
source folder: | testing/src/test/java |