added a depth first search algorithms that visits all the reachable nodes in a graph