Ask a question to Desklib · AI bot

Ask NowBETA

MyFriendsSpace Social Network: Java Report

Added on -2019-09-13

| 3 pages
| 741 words
| 311 views

Trusted by 2+ million users,
1000+ happy students everyday

Java homeworkProblem: MyFriendsSpace social network. Write a program that implements a socialnetwork application called MyFriendsSpace. A social network, in the simplest sense, is ameans of keeping track of a set of people (each of whom have a ”profile” in the socialnetwork) and the relationships (usually involving friendship) between them. A commonway to represent this network is using a graph. Each node in the graph represents a userprofile, and an edge connects two users if they are friends. Here is an example of a socialnetwork:In this social network, Alice, Bob and Tom are friends with each other. Mary and Tom arealso friends with each other.Please see details on requirements below: The project must support/implement thefollowing 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 witha letter). Your program should not allow a user profile to be added if the given namealready exists in the network.2. Search for a User: Retrieves the user profile with a given name and displays all itsinformation including the name, a list of its friends, and other optional information (suchas current status and profile picture). You need to build a binary search tree to supportefficient search of a user.3. Add a Friend for a User: Adds a profile with a given name to the list of friends of thegiven user. We assume all the friendships are reciprocal. In other words, if Bob adds Aliceinto his list of friends, Bob will also be added into Alice’s list of friends. Moreover, onlyusers 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 offriends of the given user. This should also be reciprocal.5. Find Shortest Path between two users (degree of separation): Computes theshortest path (the minimum number of hops) between two given users. Note that thegraph is unweighted so the shortest path is simply the path with minimum number ofedges between the two nodes and can be computed using a breadth-first searchalgorithm.Your program (Hmwk6_yourID.java) must continue prompting the user to selectan operation (from above) till user selects 0 (zero). You can use the following code toimplement this menu in a continuous loop:

Found this document preview useful?

You are reading a preview
Upload your documents to download
or
Become a Desklib member to get accesss

Students who viewed this