Question: 2 4 . 1 Applied Lab 5 : Friend Recommendations In this Lab we use our Graph class to create an application that makes friend

24.1 Applied Lab 5: 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 1: Setup
- Copy your completed Graph class from Lab 17 into the Graph . java file below.
- Copy your updated LinkedList class from Applied Lab 3.1 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 2: 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 3, 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 3: 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 friends2.txt 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 1:
- 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:
1. Jiming Wu
2. James Brown
3. Leanna Perez
4. Xing Li
5. Stacey Cahill
6. Mohammed Abbas
7. Kumari Chakrabarti
8. Shakil Smith
9. Jung Ahrin
10. Pedro Martinez
Enter your choice: 3
Here are your current friends:
6. Mohammed Abbas
8. Shakil Smith
9. Jung Ahrin
10. Pedro Martinez Enter your choice: 3
Here are your current friends:
6. Mohammed Abbas
8. Shakil Smith
9. Jung Ahrin
10. Pedro Martinez
Here are your recommended friends:
1. Jiming Wu
2. James Brown
4. Xing Li
5. Stacey Cahill
7. Kumari Chakrabarti
Enter the number of a friend to add or -1 to quit:
Enter your choice: 2
Here are your current friends:
6. Mohammed Abbas
8. Shakil Smith
9. Jung Ahrin
10. Pedro Martinez
2. James Brown
Here are your recommended friends:
1. Jiming Wu
4. Xing Li
5. Stacey Cahill
2 4 . 1 Applied Lab 5 : Friend Recommendations In

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 Programming Questions!