How do you implement a "list of lists" in C++? You use std::vector. You use an array of vectors.
vector<int> adj[N]
This creates an array of separate vectors. Each vector adj[i] stores the neighbors of node . Initially, all vectors are empty. As you read edges from input, you push neighbors into the appropriate vectors. This structure gives you access to any node's neighbor list and amortized time to add edges.