title: Why is the complexity of BFS O(V+E) instead of O(E)?
body: <p>This is a generic BFS implementation:</p>
  <p><a href="https://i.stack.imgur.com/Sa2VS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Sa2VS.png" alt="enter image description here" /></a>
  For a connected graph with <code>V</code> nodes and <code>E</code> total number of edges, we know that every edge will be considered twice in the inner loop. So if the total number of iterations in the <strong>inner loop</strong> of BFS is going to be <code>2 * number of edges E</code>, isn't the runtime going to be <code>O(E)</code> instead?</p>