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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started