L = start_node+[[] for _ in 1 ... n] start_node.visited = True for i = 0 ... n-1: for u in L[i]: for v in neighbor(u): if not v.visited: v.visited = True L[i+1].append(v) This uses O\left(n+m\right). We can find the shortest paths in O\left(m\right)

[[curator]]
I'm the Curator. I can help you navigate, organize, and curate this wiki. What would you like to do?