Let us go back to the network we have been studying in the previous few homework assignments. Only, this time, it is a social network involving people who are connected by a friend relation- ship, 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). Write the Prolog predicate friend of a friend(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., friend of a friend(X,X) should be false.

New Perspectives on HTML5, CSS3, and JavaScript
6th Edition
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Patrick M. Carey
Chapter3: Designing A Page Layout: Creating A Website For A Chocolatier
Section3.2: Visual Overview: Page Layout Grids
Problem 6QC
icon
Related questions
icon
Concept explainers
Question
Let us go back to the network we have been studying in the previous few homework assignments. Only, this time, it is a social network involving people who are connected by a friend relation- ship, 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). Write the Prolog predicate friend of a friend(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., friend of a friend(X,X) should be false.
abi
cory
bea
dina
eva
gil
fei
Transcribed Image Text:abi cory bea dina eva gil fei
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer