Modified graph_search to contain DFS.