We discussed two algorithms for computing the transitive closure of a given relation. Use the pseudocode given below to complete the questions. Algorithm 0.1 (A Procedure for Computing the Transitive Closure). procedure transitive closure (MR : zeroone n × n matrix) A := MR B := A for i := 2 to n A := A ⊙ MR B := B ∨ A return B (the zero-one matrix for R∗ .) Algorithm 0.2 (Warshall Algorithm). procedure Warshall (MR : n × n zeroone matrix) W := MR for k := 1 to n for i := 1 to n for j := 1 to n wij := wij ∨ (wik ∧ wkj ) return W (W = [wij ] is the zero-one matrix for R∗ .) 1. In lecture, I mentioned that Warshall’s algorithm is more efficient, when compared to Algorithm 0.1, at computing the transitive closure. Verify this claim by doing the following. (a) (15 points) Write python scripts that will perform both algorithms. (b) (10 points) Once your scripts are working correctly, run a sequence of tests using random zero-one matrices with n = 10, 20, 30, ..., 100 where you record completion time and take a 10 run average for each. Plot your results on an appropriate graph. (c) (5 points) What conclusions can you claim based on your results from part (b)? 2. (20 points) Both algorithms given above can be adapted to find the reflexive closure of the transitive closure for a given relation. Adapt your scripts from 1.(a) so that you have the option to find either the transitive closure, or the reflexive transitive closure, for a given relation. Test your scripts, for each of the four cases, on a random 20 x 20 zero-one matrix and return the matrices resulting from given tests

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

We discussed two algorithms for computing the transitive closure of a given relation. Use the pseudocode given below to complete the questions. Algorithm 0.1 (A Procedure for Computing the Transitive Closure). procedure transitive closure (MR : zeroone n × n matrix) A := MR B := A for i := 2 to n A := A ⊙ MR B := B ∨ A return B (the zero-one matrix for R∗ .) Algorithm 0.2 (Warshall Algorithm). procedure Warshall (MR : n × n zeroone matrix) W := MR for k := 1 to n for i := 1 to n for j := 1 to n wij := wij ∨ (wik ∧ wkj ) return W (W = [wij ] is the zero-one matrix for R∗ .) 1. In lecture, I mentioned that Warshall’s algorithm is more efficient, when compared to Algorithm 0.1, at computing the transitive closure. Verify this claim by doing the following. (a) (15 points) Write python scripts that will perform both algorithms. (b) (10 points) Once your scripts are working correctly, run a sequence of tests using random zero-one matrices with n = 10, 20, 30, ..., 100 where you record completion time and take a 10 run average for each. Plot your results on an appropriate graph. (c) (5 points) What conclusions can you claim based on your results from part (b)? 2. (20 points) Both algorithms given above can be adapted to find the reflexive closure of the transitive closure for a given relation. Adapt your scripts from 1.(a) so that you have the option to find either the transitive closure, or the reflexive transitive closure, for a given relation. Test your scripts, for each of the four cases, on a random 20 x 20 zero-one matrix and return the matrices resulting from given tests 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Parallel Processing
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY