Grasshopper interview question

implement a depth first search algorithm