MyFriendsSpace Social Network Java Homework

Verified

Added on  2019/09/13

|3
|741
|311
Homework Assignment
AI Summary
This document outlines a Java homework assignment focused on implementing a social network application called MyFriendsSpace. The application requires the use of a graph data structure to represent users and their friendships, along with a binary search tree for efficient user searching. The assignment details specific operations such as adding/updating users, searching for users, adding/removing friends, and finding the shortest path between users. The document also provides guidelines for class design, data structures, and grading criteria, emphasizing the importance of a complete README file and correct implementation of the required functionalities.
Document Page
Java homework
Problem: MyFriendsSpace social network. Write a program that implements a social
network application called MyFriendsSpace. A social network, in the simplest sense, is a
means of keeping track of a set of people (each of whom have a ”profile” in the social
network) and the relationships (usually involving friendship) between them. A common
way to represent this network is using a graph. Each node in the graph represents a user
profile, and an edge connects two users if they are friends. Here is an example of a social
network:
In this social network, Alice, Bob and Tom are friends with each other. Mary and Tom are
also friends with each other.
Please see details on requirements below: The project must support/implement the
following operations:
1. Add/update a User: Adds/updates a user profile with a given name to the network.
All user profiles should be uniquely identified by their names (Strings that must start with
a letter). Your program should not allow a user profile to be added if the given name
already exists in the network.
2. Search for a User: Retrieves the user profile with a given name and displays all its
information including the name, a list of its friends, and other optional information (such
as current status and profile picture). You need to build a binary search tree to support
efficient search of a user.
3. Add a Friend for a User: Adds a profile with a given name to the list of friends of the
given user. We assume all the friendships are reciprocal. In other words, if Bob adds Alice
into his list of friends, Bob will also be added into Alice’s list of friends. Moreover, only
users present in the network can be added as friends.
4. Remove a Friend for a User: Removes a profile with a given name from the list of
friends of the given user. This should also be reciprocal.
5. Find Shortest Path between two users (degree of separation): Computes the
shortest path (the minimum number of hops) between two given users. Note that the
graph is unweighted so the shortest path is simply the path with minimum number of
edges between the two nodes and can be computed using a breadth-first search
algorithm.Your program (Hmwk6_yourID.java) must continue prompting the user to select
an operation (from above) till user selects 0 (zero). You can use the following code to
implement this menu in a continuous loop:
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Class Design and Data Structures
You may consider implementing your program using the following suggested classes and
data structures. Please feel free to design your own (in which case please justify it in your
README_yourID.pdf file).
1. A class that represents a user profile (UserProfile_yourID.java). It stores all the
information about a profile including name (the key of the profile) and other optional
information such as status, location, etc. Each user profile also contains a list of friends
(you can use an ArrayList of String to store the list of the names of the friends, or a
LinkedList). In other words, the social network is represented as an adjacency list where
each user profile has an adjacency list of friends (adjacent nodes).
2. You must implement a Hashtable using Binary Search Tree with user name as keys to
organize user profiles so you can easily search or insert a user profile
(DataTable_yourID.java).
Grading Criteria
 Program that does not compile: 0
 Complete README file: 100 points (30 pts for list of files, 70 pts for complete example
run)
 Correct class of UserProfile: 100 points (50 pts user info, 50 pts list of friends)
Document Page
 Correct implementation of a Hashtable using Binary Search Tree for DataTable class:
400 pts
 Correct loop for user manipulation of the social network: 100 points
 Functionally correct program: 200 pts
chevron_up_icon
1 out of 3
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]