Added a try/catch to create adjacency list