1. Warshall's algorithm uses dynamic programming to compute the transitive closure of a directed graph.

The transitive closure of a directed graph of n vertices can be defined as the n-by-n boolean matrix , in which the element in the ith row is 1 if there exists a nontrival directed path (i.e., a directed path of a positive length) from the ith vertex to the jth vertex; otherwise is 0. (In English can you get there from here)

a) What would be the transitive closure?

b) How might you solve this from a smaller problem to a bigger problem?

2. Use the below Warshall's algorithm to compute R(0), R(1), ... , R(n)

ALGORITHM Warshall ( A[1..n, 1..n])

// Implements Warshall's algorithm for computing the transitive closure

// Input: The adjacency matrix A of a digraph with n vertices

// Output: The transitive closure of the digraph

for to n do

for to n do

for to n do

or ( and )

return R (n)