Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I will upvote as soon as I can Instructions: This will be coded in Python. Write a function whose input is a relation. Relations will

I will upvote as soon as I can

Instructions: This will be coded in Python. Write a function whose input is a relation. Relations will be represented as dictionaries in the following way. Suppose you have a relation R from the set A to the set B. The keys of the dictionary are the elements of A. For each key a A, the value of a will be a list of elements b B such that aRb (which also can be written (a, b) R). For instance, if R = {1 : [2, 3], 2 : [5, 10], 3 : [47]}, then the ordered pairs of R are {(1, 2),(1, 3),(2, 5),(2, 10),(3, 47)}. We can also write 1R2, 1R3, 2R5, 2R10, 3R47.

image text in transcribed

Do ONE of the following. Create a function called "symmetric". Its input is a relation (dictionary) R. Its output is a Boolean value. If R is a symmetric relation, then the output is "True". The output is "False" otherwise. Create a function called "transitive". Its input is a relation (dictionary) R. Its output is a Boolean value. If R is a transitive relation, then the output is "True". The output is "False" otherwise

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

Students also viewed these Databases questions