Algorithms for computing transitive closure