Transitive closure of graph