Add depth-first-search algorithm