Question: This is a C programming assignment. (and about discrete math) Write an algorithm to draw Hasse diagram of the given relations in relations.txt. . Read

 This is a C programming assignment. (and about discrete math) Write

an algorithm to draw Hasse diagram of the given relations in "relations.txt".

. Read the relations in the text file" relations.txt". Determine each relation

in relations.txt" whether it is reflexive, symmetric, anti-symmetric and transitive with your

This is a C programming assignment. (and about discrete math) Write an algorithm to draw Hasse diagram of the given relations in "relations.txt". . Read the relations in the text file" relations.txt". Determine each relation in relations.txt" whether it is reflexive, symmetric, anti-symmetric and transitive with your algorithm. In order to draw Hasse diagram, each relation must be POSET. Hence, the equation obeys the following rules: - Reflexivity, Antisymmetric, 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 write the diagram with the following format. After the relation becomes POSET, your algorithm should obtain Hasse diagram of the relation. relations.txt: Let R be a relation on a set A where a, b E A,(a, b) E R. Each relation R is represented with the lines in the file: 1. The first line says how many relations in R. 2. The second line gives the elements of the set A. 3. The following lines give each relation in R. 9 a,b,c,d,e a, a a,b a, b, b b, C, cd ded e, 8 a,b,c,d,e a, a a,b b, a bb C, c, dc d, d 5 a, b, c, d, e a, a b,b C, d, d 3 1.2.3.2 1.1 12 2.1 7 1.2.3. 1.1 1. 2.1 2.2 3. 6 1.2.3. , 3.1 3.2 4/1 4.2 43 | 16 1,2,3, 1. 1 13 13 1. 2. 2.3 , 3.3 3. 1,2,3,4 11 1 2 1. 2.1 2.2 3.3 1 , output.txt: The example has the result of the first relation in "relations.txt. 1. In "output.txt", each new Hasse diagram starts with "n". 2. The relation is (a, a),(a, b), (a, e), (b, b), (b, e), (C, c), (c,d), (d, d), (e, e) 3.The relation is already a POSET so we don't need to add or remove any pairs. 4. After "n, write the POSET in the next line as it is shown in "exampleoutput.txt". 5. Since the relation is POSET, it becomes (a, b), (b, e), (c,d) after removing reflexive and transitive pairs. 6. The following lines give each pair of Hasse diagram. n POSET: (a, a), (a, b), (a, e), (b, b), (b, e), (c, c), (c,d), (d, d), (e, e) ,b be c, a This is a C programming assignment. (and about discrete math) Write an algorithm to draw Hasse diagram of the given relations in "relations.txt". . Read the relations in the text file" relations.txt". Determine each relation in relations.txt" whether it is reflexive, symmetric, anti-symmetric and transitive with your algorithm. In order to draw Hasse diagram, each relation must be POSET. Hence, the equation obeys the following rules: - Reflexivity, Antisymmetric, 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 write the diagram with the following format. After the relation becomes POSET, your algorithm should obtain Hasse diagram of the relation. relations.txt: Let R be a relation on a set A where a, b E A,(a, b) E R. Each relation R is represented with the lines in the file: 1. The first line says how many relations in R. 2. The second line gives the elements of the set A. 3. The following lines give each relation in R. 9 a,b,c,d,e a, a a,b a, b, b b, C, cd ded e, 8 a,b,c,d,e a, a a,b b, a bb C, c, dc d, d 5 a, b, c, d, e a, a b,b C, d, d 3 1.2.3.2 1.1 12 2.1 7 1.2.3. 1.1 1. 2.1 2.2 3. 6 1.2.3. , 3.1 3.2 4/1 4.2 43 | 16 1,2,3, 1. 1 13 13 1. 2. 2.3 , 3.3 3. 1,2,3,4 11 1 2 1. 2.1 2.2 3.3 1 , output.txt: The example has the result of the first relation in "relations.txt. 1. In "output.txt", each new Hasse diagram starts with "n". 2. The relation is (a, a),(a, b), (a, e), (b, b), (b, e), (C, c), (c,d), (d, d), (e, e) 3.The relation is already a POSET so we don't need to add or remove any pairs. 4. After "n, write the POSET in the next line as it is shown in "exampleoutput.txt". 5. Since the relation is POSET, it becomes (a, b), (b, e), (c,d) after removing reflexive and transitive pairs. 6. The following lines give each pair of Hasse diagram. n POSET: (a, a), (a, b), (a, e), (b, b), (b, e), (c, c), (c,d), (d, d), (e, e) ,b be c, a

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!