- ex. [(1, 2), (2, 3), (4, 3)] - these edges could be either directed or undirected - you can't immediately start traversal, **very slow** - i.e if you want to start DFS from node 0, you would need to iterate over entire input to find all neighbors of 0 - & following that, when moving to a neighbor node, you'd need to iterate through entire input again to find all of *its* neighbors - instead, it's better to build a hashmap of neighbors from this array of edges ``` from collections import defaultdict def build_graph(edges): graph = defaultdict(list) for x, y in edges: graph[x].append(y) # graph[y].append(x) # uncomment the above line if the graph is undirected return graph ```