Question: At the consturctor Node = new Node[numberOfNodes]; and Edge = new Edge[numberOfEdges]; gives identifier error? what's the wrong with it ?

```
typedef struct node
{
 int id;
 int x;
 int y;
} Node;

typedef struct edge
{
 int id;
 Node node1;
 Node node2;
} Edge;

class graph
{
private:
 int numberOfNodes;
 int numberOfEdges;
 int *Node;
 int *Edge;

public:
 graph(int nodes, int edges)
 {
  numberOfNodes = nodes;
  numberOfEdges = edges;
  Node = new Node[numberOfNodes];
  Edge = new Edge[numberOfEdges];
 }

```

Answer: 
You have various variable name conflicts, including a conflict between your variable declaration `int* Node`, and the typedef `Node`. Also, you declare your array of nodes as type `int*` when it should be type `Node*`. You do the same with `Edge`. Try the following instead:

```
class graph
{
    private:
    int numberOfNodes;
    int numberOfEdges;
    Node* nodes_;
    Edge* edges_;

    public:

    graph(int num_nodes, int num_edges)
    {
        numberOfNodes = num_nodes;
        numberOfEdges = num_edges;
        nodes_ = new Node[numberOfNodes];
        edges_ = new Edge[numberOfEdges];
    }
};

```

Also, just for the future, the `typedef struct { }` idiom is really unnecessary in C++. It's main purpose was so that C programmers wouldn't need to constantly have to prefix their struct variables with the word `struct`. But in C++ this isn't necessary, so there's generally no real reason to say `typedef struct node { ... } Node;` when you can just say `struct Node { ... };`. See [here](https://stackoverflow.com/questions/612328/difference-between-struct-and-typedef-struct-in-c) for more information.
In your constructor, `Node` and `Edge` refer to the `int*` members of the class, *not* the type names in the global scope. You will have to indicate that you're referring to the global types: 

```
Node = new ::Node[numberOfNodes];
Edge = new ::Edge[numberOfEdges];

```

**Edit:** of course, this would still confuse human readers. It's advised to keep type and variable names separate for the sake of your readers.