Transitive closure using Directed DFS