Graphs C++

How to you add edges in adjacency list graph c++

You can use like an array of vectors in c++ for maintaining the adjacency list.

For example:
//initialize the list
vector edges[1000];

Now if you want to make node i and node j to be connected you can do something like this:

//add neighbors to both the node
edges[i].push_back(j);
edges[j].push_back(i);

Similarly for all other edges you can do the same.
Refer to this article -
Graph Theory Part-1

//