C++ Graph Implementation My data set is a list of Edges which are passed as a pair of integers. Based on that, I have the following graph implementation for BFS. Could someone please review my code and comment on errors/omissions/efficiency and other points. 

#include &lt;queue&gt;
#include &lt;iostream&gt;
#include &lt;vector&gt;

class Graph {

private:
    int num_of_vertices;
    std::vector&lt;int&gt;* Adj;

public:
    Graph(int V){

        this-&gt;num_of_vertices = V;
        Adj = new std::vector&lt;int&gt;[V];
    }

    void addEdge(std::vector&lt;std::pair&lt;int, int&gt;* &gt; edge_list)
    {
        for(auto it = edge_list.begin(); it != edge_list.end(); it++) {
            std::pair&lt;int, int&gt;* p = *it;
            Adj[p-&gt;first].push_back(p-&gt;second);
        }
    }
    void BFS(int start)
    {
        bool* visited = new bool[this-&gt;num_of_vertices]();

        for(int i=0;i&lt;num_of_vertices;i++)
            visited[i]=false;

        std::queue&lt;int&gt; queue;
        queue.push(start);
        std::vector&lt;int&gt;::iterator i;

        while(!queue.empty())
        {
            start = queue.front();

            visited[start] = true;
            queue.pop();
            for (i = Adj[start].begin(); i != Adj[start].end(); i++)
            {
                if (!visited[*i])
                    queue.push(*i);
            }
        }

    }

};
Pointer to vector?

You have two members: a pointer to a vector (which you new, but never delete, which leads to several other problems) and its size. But you're already using a vector, so just do it twice:

std::vector&lt;std::vector&lt;int&gt;&gt; adjacency_vector;

Graph(int num_vertices)
: adjacency_vector(num_vertices)
{ }


Pointer to pair?

Similarly, for addEdge, take a vector of pairs - not a vector of pointers to pairs - and by reference to const:

void addEdge(std::vector&lt;std::pair&lt;int, int&gt;&gt; const&amp; edge_list)


And then just use a range-based for expression to add them all:

for (auto const&amp; edge : edge_list) {
    adjacency_vector[edge.first].push_back(edge.second);
}


Pointer to bool?

You see a trend here, hopefully. In your BFS, you start with:

bool* visited = new bool[this-&gt;num_of_vertices]();


But you never delete it, so you're leaking that memory. Prefer:

std::vector&lt;bool&gt; visited(adjacency_vector.size());


Also, this already sets everything to false, so you don't have to manually. Though your original implementation did as well. 

What does BFS do?

This is a void function, that does something with local variables queue and visited - and then what? What as the outside observer do I get? This function needs to return... something of value to the caller. Otherwise, it's just spending time doing nothing. 

Also, again, prefer range-based-for for the push:

for (auto child : adjacency_vector[start]) {
    if (!visited[child]) {
        queue.push(child);
    }
}


It's just much shorter.