Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

8. Consider modeling Facebook friendships by an undirected graph G (V, E), where V- a set of n vertices, each of which represents a Facebook

image text in transcribed
8. Consider modeling Facebook friendships by an undirected graph G (V, E), where V- a set of n vertices, each of which represents a Facebook user; and E isa set of edges, such that (4, u) E if and only if users u and u are Facebook friends. Let n IVI and m El. We want to compute an n-by-n matrix S, such that for all 1 if users t and uj are within 2 hops from each other in G, S.1-U10 otherwise. (a) (3%) what data structure will you use to represent G? Explain your choice. (b) (13%) Based on the data structure you used in (a), give an algorithm that conputes the matrix S. What is the complexity of your algorithm? (c) (10%) we want to perform friend-recommendation on Facebook. Specifically given a user u and a positive integer k, we want to return a set Fe(ui), such that v e Fe(u4) if and only if u and v share at least k common friends. Give an algorithm FriendRec(i, k) that returns the set F(u) 8. Consider modeling Facebook friendships by an undirected graph G (V, E), where V- a set of n vertices, each of which represents a Facebook user; and E isa set of edges, such that (4, u) E if and only if users u and u are Facebook friends. Let n IVI and m El. We want to compute an n-by-n matrix S, such that for all 1 if users t and uj are within 2 hops from each other in G, S.1-U10 otherwise. (a) (3%) what data structure will you use to represent G? Explain your choice. (b) (13%) Based on the data structure you used in (a), give an algorithm that conputes the matrix S. What is the complexity of your algorithm? (c) (10%) we want to perform friend-recommendation on Facebook. Specifically given a user u and a positive integer k, we want to return a set Fe(ui), such that v e Fe(u4) if and only if u and v share at least k common friends. Give an algorithm FriendRec(i, k) that returns the set F(u)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

15. Argue that .

Answered: 1 week ago