graphs ay by to and to so to figure to and to so to steps in warshall' algorithm row has no at allso we go to row here we find an edge from to howevercolumn is emptyso there are no edges that end on row in row we see there' an edge from to looking in column we see the first entry is for the edge to eso with to and to we infer there' path from to howeverit' already been discoveredas indicated by the at that location there' another in column eat row this edge from to plus the one from to imply path from to cso we insert in that cell the result is shown in figure warshall' algorithm is now complete we've added two to the adjacency matrixwhich now shows which nodes are reachable from another node in any number of steps if we drew graph based on this new matrixit would be the transitive closure of the graph in figure implementation of warshall' algorithm one way to implement warshall' algorithm is with three nested loops (as suggested by sedgewicksee appendix "further reading"the outer loop looks at each rowlet' call its variable the loop inside that looks at each cell in the rowit uses variable if is found in cell (xy)there' an edge from to xand the third (innermostloop is activatedit uses variable the third loop examines the cells in column ylooking for an edge that ends at (note that is used for rows in the first loop but for the column in the third loop if there' in column at row zthen there' an edge from to with one edge from to and another from to xit follows that there' path from to xso you can put at (xzwe'll leave the details as an exercise