If you intend for adjList to be in parallel with graph (ie. adjList[n] is the adjacency list for graph[n]), that's what I would do. There are multiple problems with the code as posted, but I assume that's because you've attempted to leave things out to simplify the issue.