Built out depth first search with corresponding tests.