...

/

Analysis of breadth-first search

Analysis of breadth-first search

We'll cover the following...

How long does breadth-first search take for a graph with vertex set VV and edge set EE? The answer is O(V+E)O(V+E) time.

Let's see what O(V+E)O(V+E) time means. Assume for the moment that EV|E| \geq |V|, which is the case for most graphs, especially those for which we run breadth-first search. Then V+EE+E=2.E|V| + |E| \leq |E| + |E| = 2 . |E| ...