Time Complexity of breadth first search with adjacency matrix representation?

Viewed 9668

In bfs we have to look up each node and for each node we have to look all elements of row.Doesn't this require O(V^2)(number of elements in adjacency matrix) time and hence for adjacency matrix shouldn't total time be O(V^2+E).

1 Answers
Related