Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java hadoop question given Friends.java import java.io.IOException; import java.util.StringTokenizer; import java.util.Set; import java.util.HashSet; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper;
Java hadoop question
given Friends.java
import java.io.IOException; import java.util.StringTokenizer; import java.util.Set; import java.util.HashSet; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.util.GenericOptionsParser; public class FriendsOfFriends { public static class FriendMapper extends Mapper
Friend.txt
1 2 2 3 3 4 2 5
The input file contains a list of friendship between users. A small sample is shown below.
1 2
2 3
3 4
2 5
For example, the first row encodes User 2 is a friend of User 1.
The expected output file is shown below:
1 3
1 5
2 4
Please help me finish the Firends.java
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