title: Time complexity of adjacency list representation?
body: <p>I am going through this link for adjacency list representation.</p>
  
  <p><a href="http://www.geeksforgeeks.org/graph-and-its-representations/" rel="noreferrer">http://www.geeksforgeeks.org/graph-and-its-representations/</a></p>
  
  <p>I have a simple doubt in some part of a code as follows :</p>
  
  <pre><code>// A utility function to print the adjacenncy list representation of graph
  void printGraph(struct Graph* graph)
  {
      int v;
      for (v = 0; v &lt; graph-&gt;V; ++v)
      {
          struct AdjListNode* pCrawl = graph-&gt;array[v].head;
          printf("\n Adjacency list of vertex %d\n head ", v);
          while (pCrawl)
          {
              printf("-&gt; %d", pCrawl-&gt;dest);
              pCrawl = pCrawl-&gt;next;
          }
          printf("\n");
      }
  }
  </code></pre>
  
  <hr>
  
  <p>Since, here for every <code>V</code> while loop is executed say <code>d</code> times where d is the degree of each vertex.</p>
  
  <p>So, I think time complexity is like </p>
  
  <pre><code>d0 + d1 + d2 + d3 ....... +dV where di is the degree of each vertex.
  </code></pre>
  
  <p>All this sums up O(E), but the link says that time complexity is O(|V|+|E|)</p>
  
  <hr>
  
  <p>Not sure what is the problem with the understanding. Some help needed here </p>