Different algorithms to get the transitive closure.