**Warshall’s algorithm:**

The transitive closure of a directed graph with n vertices can be defined as the n-by-n boolean matrix T={tij}, in which the element in the ith row(1<=i<=n) and jth column(1<=j<=n) is 1 if there exists a non trivial directed path from ith vertex to jth vertex, otherwise, tij is 0. Warshall‟s algorithm constructs the transitive closure of a given digraph with n vertices through a series of n-by-n boolean matrices: R(0) ,….,R(k-1) , R(k) ,….,R(n) where, R(0) is the adjacency matrix of digraph and R(1) contains the information about paths that use the first vertex as intermediate. In general, each subsequent matrix in series has one more vertex to use as intermediate for its path than its predecessor. The last matrix in the series R(n) reflects paths that can use all n vertices of the digraph as intermediate and finally transitive closure is obtained. The central point of the algorithm is that we compute all the elements of each matrix R(k) from its immediate predecessor R (k-1) in series

**Complexity:** The time efficiency of Warshall‟s algorithm is in Θ (n3).

` ````
```# include
# include
int n,a[10][10],p[10][10];
void path()
{
int i,j,k;
for(i=0;i