Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Let us go back to the network we have been studying in the previous class. Only, this time, it is a social network involving people
Let us go back to the network we have been studying in the previous class. Only, this time, it is a social network involving people who are connected by a friend relationship, 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. 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). a) 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, but it does preclude X from being a friend of a friend of itself, i.e., friendofafriend (X,X) should be false. b) Use this friendofafriend predicate to list all of the people who are a friend of a friend of cory
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