function* bfs(start, clearVisited = true) {
  const queue = new Queue();

  queue.add(this.getNode(start));

  if(clearVisited) {
    this.clearVisitedNodes();
  }

  while(!queue.isEmpty()) {
    const node = queue.remove();
    node.metadata.visited = true;

    yield node;

    const adjacents = node.adjacents || [];
    adjacents.forEach(function (adjacent) {
      if(!adjacent.metadata.visited) {
        queue.add(adjacent);
      }
    });
  }
}
Breadth-first search

O(n)

@param start data or node reference