code: func (b *BreadthFirst) Walk(g graph.Graph, from graph.Node, until func(n graph.Node, d int) bool) graph.Node {
  	if b.visited == nil {
  		b.visited = &intsets.Sparse{}
  	}
  	b.queue.Enqueue(from)
  	b.visited.Insert(from.ID())
  
  	var (
  		depth     int
  		children  int
  		untilNext = 1
  	)
  	for b.queue.Len() > 0 {
  		t := b.queue.Dequeue()
  		if until != nil && until(t, depth) {
  			return t
  		}
  		for _, n := range g.From(t) {
  			if b.EdgeFilter != nil && !b.EdgeFilter(g.Edge(t, n)) {
  				continue
  			}
  			if b.visited.Has(n.ID()) {
  				continue
  			}
  			if b.Visit != nil {
  				b.Visit(t, n)
  			}
  			b.visited.Insert(n.ID())
  			children++
  			b.queue.Enqueue(n)
  		}
  		if untilNext--; untilNext == 0 {
  			depth++
  			untilNext = children
  			children = 0
  		}
  	}
  
  	return nil
  }
docs: // Walk performs a breadth-first traversal of the graph g starting from the given node,
  // depending on the EdgeFilter field and the until parameter if they are non-nil. The
  // traversal follows edges for which EdgeFilter(edge) is true and returns the first node
  // for which until(node, depth) is true. During the traversal, if the Visit field is
  // non-nil, it is called with the nodes joined by each followed edge.