The basic algorithm for BFS:
set start vertex to visited load it into queue while queue not empty for each edge incident to vertex if its not visited load into queue mark vertex
So, I think the time complexity will be:
v1 + (incident edges) + v2 + (incident edges) + .... + vn + (incident edges)
where v is vertex 1 to n
First, is that what I said correctly? Secondly, itβs like O(N + E) , and intuition as to why it would be really nice. Thanks
algorithm time-complexity graph breadth-first-search
ordinary Jul 13. 2018-12-12T00: 00Z
source share