Question: Suppose that you're working on an open-source social-networking project. Because social networks are predominantly built around people and the relationships between them, you reasonably suspect

Suppose that you're working on an open-source social-networking project. Because social networks are predominantly built around people and the relationships between them, you reasonably suspect that graph algorithms can help in your endeavors.

Now suppose that you're adding the ability for a person P in the network to see anyone who is within three "links" of them (i.e., either your friend, your friend's friend, or your friend's friend's friend), with the results sorted by how closely linked each person is (i.e., your friends come before your friend's friend's, and so on) and, secondarily, by their last name.

Assuming that you already had a directed graph in which people were represented as vertices and relationships between them were represented by edges (i.e., if you're my friend, there will be an edge from my vertex to yours). Propose how would you modify the breadth-first traversal algorithm we discussed in lecture to solve this problem. Note that we're not asking you to write code here or write complete pseudocode for your algorithm; we're just asking for an explanation of what you think would need to change and why.

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