Question: 2 4 . 1 Applied Lab 5 : Friend Recommendations In this Lab we use our Graph class to create an application that makes friend
Applied Lab : Friend Recommendations
In this Lab we use our Graph class to create an application that makes friend recommendations based on connections to a wider friend network in other words, friends of friends or friends of their friends, or friends of friends of friends, etc
Step : Setup
Copy your completed Graph class from Lab into the Graph java file below.
Copy your updated LinkedList class from Applied Lab into the LinkedList.java file below. Recall that the LinkedList is used to store adjacent vertices at each vertex in the Graph.
Inspect the FriendGraph, which allows you to test each method of Graph in Develop Mode as you write your code. Automatic testing in Submit mode requires completion of most of the FriendGraph code.
Step : Inspect the example friends.txt file
The first line of the input file specifies the number of vertices in the Graph.
Following this line, subsequent lines come in groups of all of the information about one user:
the user id
the name of the user
a comma separated list of friends of that user listed by id
For example:
Step : Implement the FriendGraph class
Using the starter code in FriendGraph java, complete the code to match the Example Outputs below.
The FriendGraph class must read all the contents of a user selected file in the correct format files see below
While I have named the files friends.txt and friendstxt in the examples below, the user must be allowed to enter a file of any name.
You will need an array or ArrayList to store the associated user ids and user names, and a Graph to track the friend network and make friend recommendations. Hint: Call BFS
Since the Graph can only store integers, the array or ArrayList will allow you to associate names with user ids.
You can assume that the graph is undirected.
The only input validation required is to check that the file name exists in the folder of the project.
Friend recommendations must be made based on connections to the wider friend network in other words, friends of friends or friends of their friends, or friends of friends of friends, etc Not included should be current friends or a node with no connection to the wider friend network. Hint: Call BFS
You must use your Graph class, and no other structures, to store the Friend relationship information.
You may add as many additional methods and variables as you like to the below starter code.
You may not make any additional import statements at the top of this file. Example Output :
Please read through these example outputs carefully
Your program must work identically to the sample output below, given the same input file.
If no error checking is shown for a particular menu option, then it is not necessary to include it for this assignment.
Welcome to the Friend Recommender!
Enter the name of a file: friends.txt
Enter your user number below:
Jiming Wu
James Brown
Leanna Perez
Xing Li
Stacey Cahill
Mohammed Abbas
Kumari Chakrabarti
Shakil Smith
Jung Ahrin
Pedro Martinez
Enter your choice:
Here are your current friends:
Mohammed Abbas
Shakil Smith
Jung Ahrin
Pedro Martinez Enter your choice:
Here are your current friends:
Mohammed Abbas
Shakil Smith
Jung Ahrin
Pedro Martinez
Here are your recommended friends:
Jiming Wu
James Brown
Xing Li
Stacey Cahill
Kumari Chakrabarti
Enter the number of a friend to add or to quit:
Enter your choice:
Here are your current friends:
Mohammed Abbas
Shakil Smith
Jung Ahrin
Pedro Martinez
James Brown
Here are your recommended friends:
Jiming Wu
Xing Li
Stacey Cahill
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
