add depth first search algorithm