Time complexity of finding the shortest path in DAG [closed]

I apologize for seemingly basic question:

I saw numerous times that the time complexity of finding the shortest path in directed acyclic graph is O(|V| + |E|).

Why there is this |V|? Isn't it always the case that for a connected graph |E|+2 > |V|, hiding the |V| under |E|? I mean:

O(|V| + |E|) =
O(|E| + |E| + 2) =
O(|E| * 2) =
O(|E|)?


I also think the algorithm for solving the SP only follow the edges, no?

closed as off-topic by Hsien-Chih Chang 張顯之, Marzio De Biasi, András Salamon, Jeffε, KavehFeb 4 '14 at 23:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Your question does not appear to be a research-level question in theoretical computer science. For more information about the scope, please see help center. Your question might be suitable for Computer Science which has a broader scope." – Hsien-Chih Chang 張顯之, Marzio De Biasi, András Salamon, Jeffε, Kaveh
If this question can be reworded to fit the rules in the help center, please edit the question.

DAG (Directed acyclic graph) doesn't have to be a connected graph, so the assumption $|E|+2 > |V|$ doesn't hold for some inputs.
• If you knew that all inputs are connected graphs, the complexity would be indeed $O(|E|)$. – zvisofer Feb 1 '14 at 19:46
• For each node $v$ that is not reachable from the source node, the cost of $v$ will remain infinity until the end (all costs were initialized to infinity at the beginning of the algorithm). – zvisofer Feb 1 '14 at 19:53