Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Goal: Write an HTTP service which accepts a graph of people where edges represent friendship relationships. Return the suggested edges which would create direct friend

Goal:

Write an HTTP service which accepts a graph of people where edges represent friendship relationships. Return the suggested edges which would create direct friend relationships between two people who currently are at most one friend away two people who are friends of a friend (FOAFs).

Problem:

Receive as input an array of friend relationships.

Return a set of arrays each representing a new suggested friend relationship.

Example input:

{ inList : [

{ friends : [ Albert, Betty ] },

{ friends : [ Betty, Cathy ] },

{ friends : [ Cathy, Denis ] },

{ friends : [ Denis, Albert ] },

{ friends : [ Tony, Bruce ] }

] }

Example output:

{ outList : [ [ Albert, Cathy ] , [ Betty, Denis ] ] }

Do not duplicate the suggestions (in the example above, do not also suggest [ Cathy, Albert ]. If no new friend relationships can be suggested, return the empty array. { "outList" : [ ] }

Erroneous input (e.g. malformed JSON) should be handled gracefully.

In java Preferably.

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_2

Step: 3

blur-text-image_3

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

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions