js: depth first search, working out kosaraju 2 pass