dfs algorithm - being tested