Depth first search algorithm and some unit tests for it