Implement Warshall algorithm for graph reachability