Use adjacency list to represent undirected graph.