complexitydsagraphs
BFS counts edges, not weights
Anonymous
for an unweighted graph, BFS finds shortest paths by edge count from one start node. Mark a node visited when it enters the queue; marking it only when removed can enqueue it more than once. With adjacency lists, traversal is O(n + m), where n is the number of vertices and m is the number of edges.
0