Question: // ProLog Programming 7. Write a Prolog program to save the facts of that Alice and Bob know each other; Bob and Chris know each

// ProLog Programming // ProLog Programming 7. Write a Prolog program to save the

7. Write a Prolog program to save the facts of that Alice and Bob know each other; Bob and Chris know each other; Chris and Dan know each other; Dan and Elaine know each other; Elaine and Frank know each other; Dan and Gang know each other; Gang and Henry know each other; Henry and Alice know each other. Add three logics 1st-degree connection People directly connected. For example, in the picture below, Alice and Bob are 1st-degree connection. 2nd-degree connection - People connected to their 1st-degree connections. For example, in the picture below, Bob and Dan are 2nd-degree connection. 3rd-degree connection - People connected to their 2nd-degree connections. For example, in the picture below, Alice and Dan are 3rd-degree connection. Then query (1) whether Alice and Elaine are 1st-degree connection or 2nd-degree connection. (2) whether Alice and Dan are 1st-degree connection or 2nd-degree connection or 3rd-degree connection. 7. Write a Prolog program to save the facts of that Alice and Bob know each other; Bob and Chris know each other; Chris and Dan know each other; Dan and Elaine know each other; Elaine and Frank know each other; Dan and Gang know each other; Gang and Henry know each other; Henry and Alice know each other. Add three logics 1st-degree connection People directly connected. For example, in the picture below, Alice and Bob are 1st-degree connection. 2nd-degree connection - People connected to their 1st-degree connections. For example, in the picture below, Bob and Dan are 2nd-degree connection. 3rd-degree connection - People connected to their 2nd-degree connections. For example, in the picture below, Alice and Dan are 3rd-degree connection. Then query (1) whether Alice and Elaine are 1st-degree connection or 2nd-degree connection. (2) whether Alice and Dan are 1st-degree connection or 2nd-degree connection or 3rd-degree connection

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!