Implemented DFS functions via adjacency list