I am trying to represent a graph using the adjacency list representation of graphs in C++. So I tried converting this C(language) code which I found in this youtube video https://www.youtube.com/watch?v=mQEv1QxaIuM&t=7s. But when I tried writing this code in C++, I'm getting an error. VSStudio Compiler showing "expression must have pointer type". (Please note that this video is in Hindi language.)
Here is my code in C++ (It's not yet completed because of the error.)
// Adjacency List Representation of Graph
#include <iostream>
struct listNode // defining linked list
{
    int vertexNumber;
    listNode *next;
};
struct graph // defining graph
{
    int vertex;
    int edge;
    listNode *adj;
};
graph *adjacencyListOfGraph()
{
    int x, y;
    listNode *temp;
    graph *G = new graph;
    std::cout << "Enter the number of vertex and edges.\n";
    std::cin >> G->vertex >> G->edge;
    G->adj = new listNode[G->vertex];
    for (int i = 0; i < G->vertex; ++i)
    {
        G->adj[i]->vertexNumber = i;// this is where I'm getting an error
    }
}
 
    