adjacency list and dfs+bfs