code: @Nonnull
      public Iterator<S> bfsIterator() {
          Set<S> visited = new HashSet<>();
          final Deque<S> bfsQueue = new ArrayDeque<>();
          bfsQueue.add(root);
          visited.add(root);
  
          return new AbstractIterator<S>() {
  
              @Override
              protected S computeNext() {
                  S next = bfsQueue.poll();
                  if (next == null) {
                      return endOfData();
                  }
                  for (int i = 0; i < alphabetSize; i++) {
                      S child = next.getSuccessor(i);
                      if (child != null && visited.add(child)) {
                          bfsQueue.offer(child);
                      }
                  }
                  return next;
              }
          };
      }
docs: Retrieves an iterator that can be used for iterating over all states in this PTA that are reachable from the root
  state in a breadth-first order.
  
  @return an iterator for iterating over all states in this PTA