title: What is an efficient way to create an adjacency list using STL in C++?
body: <p>I currently use a vector of vectors like following:</p>
  
  <pre><code>typedef pair&lt;int, int&gt; vertex;
  vector &lt; vector&lt;vertex&gt; &gt; adj_list(n); // n is number of vertices
  
  // Input graph
  for (int i = 0; i &lt; edges; i++ )
  {
     cin &gt;&gt; source &gt;&gt; target &gt;&gt; weight;
     vertex v(target, weight);
     adj_list[source].push_back(v);
  }
  </code></pre>
  
  <p>Is vector of list ie.</p>
  
  <pre><code>vector &lt; list&lt;vertex&gt; &gt; adj_list(n);
  </code></pre>
  
  <p>a better option? If yes, why? My primary concern is creating the adjacency list efficiently, and to be able to read all the vertices connected to a particular vertex fast, for implementing Dijkstra's algorithm.</p>