title: Why is the complexity of BFS O(V+E) instead of O(V*E)?
body: <p>Some pseudocode here (disregard my style)</p>
  
  <p>Starting from v1(enqueued):</p>
  
  <pre><code>function BFS(queue Q)
    v2 = dequeue Q
    enqueue all unvisited connected nodes of v2 into Q
    BFS(Q)
  end // maybe minor problems here
  </code></pre>
  
  <p>Since there are V vertices in the graph, and these V vertices are connected to E edges, and visiting getting connected nodes (equivalent to visiting connected edges) is in the inner loop (the outer loop is the recursion itself), it seems to me that the complexity should be O(V*E) rather than O(V+E). Can anyone explain this for me?</p>