dfs method now generates it's respective tree
updated test