dfs almost complete and partially optimal