[SOLVED] CSE211 Homework 3-Applications for Hasse Diagram of Relation

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon HW3-uop4zi.zip (146.6 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (1 vote)

Applications for Hasse Diagram of Relations

Remember the Problem 3 in Homework 2.
Write an algorithm to draw Hasse diagram of the given relations in ”input.txt” which is given for HW2.
Your code should meet the following requirements, standards and accomplish the given tasks.

  • Read the relations from the text file ”input.txt”. You can use your code from HW2 if you implemented to read the file. If you didn’t implement it, please check HW2 to learn how to read the relations from the file.
  • Determine each relation in ”input.txt” whether it is reflexive, symmetric, anti-symmetric and transitive with your algorithm from HW2.
  • In order to draw Hasse diagram, each relation must be POSET. Hence, the relation obeys the following rules:– Reflexivity
    – Anti-symmetric – Transitivity

    If the relation is not a POSET, your algorithm is responsible to CONVERT it to POSET.

    • –  If the relation is not reflexive, add new pairs to make the relation reflexive.
    • –  If the relation is symmetric, remove some pairs which make the relation symmetric. For instance, if the relation has (a, b) and (b, a), remove one of them randomly.
    • –  If the relation is not transitive, add new pairs which would make the relation transitive.
  • After the relation becomes POSET, your algorithm should obtain Hasse diagram of the relation and writethe diagram with the following format.
    • –  An example of the output format is given in ”exampleoutput.txt”. The file has the result of the first relation in ”input.txt”.
    • –  In ”output.txt”, each new Hasse diagram starts with ”n”.
    • –  The relation is (a, a), (a, b), (a, e), (b, b), (b, e), (c, c), (c, d), (d, d), (e, e)
    • –  The relation is already a POSET so we don’t need to add or remove any pairs.
    • –  After ”n”, write the POSET in the next line as it is shown in ”exampleoutput.txt”.
    • –  Since the relation is POSET, it becomes (a, b), (b, e), (c, d) after removing reflexive and transitive pairs.
    • –  The following lines give each pair of Hasse diagram.
  • You can implement your algorithm in Python, Java, C or C++.
  • Important: Put comments almost for each line of your code to describe what the line is going to do.
  • You should put your source code file (file name is problem1.{.c, .java, .py, .cpp}) and output.txt into your homework zip file (check Course Policy).

1 file · 146.6 KB

  • HW3-uop4zi.zip 146.6 KB