Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a social network involving people who are connected by a friend relationship, as represented below: as Prolog code on the left, and a graphical representation

a social network involving people who are connected by a friend relationship, as represented below: as Prolog code on the left, and a graphical representation on the right. Note that this friend relationship is symmetric, since, on the left, for each pair X, Y of people, if friend (X, Y), then friend (Y, X), and in the graphical representation on the right, the "edges" do not have direction

image text in transcribed

image text in transcribed

a. (10 points). Write the Prolog predicate friendofafriend (X, Y) which is true when X has a friend who is a friend of Y. Note: that this does not preclude X from also being a friend of Y.

b. (5 points). Use this friendofafriend predicate to list all of the people who are a friend of a friend of cory. Some people are listed twice, why is this?

c. (5 points). What problem do we encounter if we try to use the predicates connection or path from the previous homework assignments, and why?

friend(abi,bea).friend(abi,cory).friend(bea,cory).friend(bea,dina).friend(cory,dina).friend(dina,eva).friend(dina,fei).friend(eva,fei).friend(fei,gil).friend(bea,abi).friend(cory,abi).friend(cory,bea).friend(dina,bea).friend(dina,cory)friend(eva,dina).friend(fei,dina).friend(fei,eva).friend(gil,fei)

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

Write a program to check an input year is leap or not.

Answered: 1 week ago

Question

Write short notes on departmentation.

Answered: 1 week ago

Question

What are the factors affecting organisation structure?

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago

Question

=+ For what reasons can and do unions go on strike?

Answered: 1 week ago

Question

=+ Is secondary industrial action common and/or legal?

Answered: 1 week ago