finding set of nodes reachable from every other node is a directed graph