Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE DO IT IN PYTHON AND ACTUALLY WRITE THE CODE. THANK YOUUU Use the methods or functions inherent in the language and / or using

PLEASE DO IT IN PYTHON AND ACTUALLY WRITE THE CODE. THANK YOUUU
Use the methods or functions inherent in the language and/or using methods or
functions you create. Like previous assignments, dont hard code a solution you
did on paper as the output.
Create a program for the following:
1. Write code that determines if a relation (R) of ordered pairs is reflexive or not
& then if it is not, finds the reflexive closure of R (R*). The output should be:
a) R ={...}
b) R is or is not reflexive
c) R* if it is not reflexive
d) Show the code works for the relation {(1,1),(4,4),(2,2),(3,3)} on the
set {1,2,3,4}.
e) Show the code works for the relation {(a,a),(c,c)} on the set {a,b,c,d}.
2. Write code that determines if a relation (R) of ordered pairs is symmetric or
not & then if it is not, finds the symmetric closure of R (R*). The output
should be:
a) R ={...}
b) R is or is not symmetric
c) R* if it is not symmetric
d) Show the code works for the relation {(1,2),(4,4),(2,1),(3,3)} on the
set {1,2,3,4}.
e) Show the code works for the relation {(1,2),(3,3)} on the set
{1,2,3,4}.
3. Write code that determines if a relation (R) of ordered pairs is transitive or not
& then if it is not, finds the transitive closure of R (R*) using Warshalls
Algorithm. The output should be:
a) R ={...}
b) R is or is not transitive
c) R* if it is not transitive
d) Show the code works for the relation {(a,b),(d,d),(b,c),(a,c)} on the
set {a,b,c,d}.
e) Show the code works for the relation {(1,1),(1,3),(2,2),(3,1),(3,2)} on
the set {1,2,3}.
4. Write code that determines if a relation (R) of ordered pairs is an equivalence
relation or not and the reason why. The output should be:
a) R ={...}
b) R is or is not an equivalence relation
c) The reasons why, if it is not an equivalence relation (i.e., it is not
reflexive, and/or it is not symmetric, and/or it is not transitive).
d) Show the code works for the relation {(1,1),(2,2),(2,3)} on the set
{1,2,3}.
e) Show the code works for the relation {(a,a),(b,b),(c,c),(b,c),(c,b)} on
the set {a,b,c}.
5. Write code that determines if a relation (R) of ordered pairs is a poset of the
set (S) or not and the reason why. The output should be:
a) S ={...}
b) R ={...}
c)(S,R) is or is not a poset
d) The reason why, if it is not poset (i.e., it is not reflexive, and/or it is
not antisymmetric, and/or it is not transitive.
e) Show the code works for the relation {(1,1),(1,2),(2,2),(3,3),(4,1),
(4,2),(4,4)} on the set {1,2,3,4}.
f) Show the code works for the relation {(0,0),(0,1),(0,2),(0,3),(1,
0),(1,1),(1,2),(1,3),(2,0),(2,2),(3,3)} on the set {0,1,2,3}.

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

Step: 3

blur-text-image

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

Database And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 1 Lncs 8055

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013 Edition

3642402844, 978-3642402845

More Books

Students also viewed these Databases questions