boolean depthFirstSearch(final int startOffset, @NotNull BitSet visitedOffsets) {
      // traverse the graph starting with the startOffset
      IntArrayList walkThroughStack = new IntArrayList(Math.max(size() / 2, 2));
      visitedOffsets.clear();
      walkThroughStack.push(startOffset);
      while (!walkThroughStack.isEmpty()) {
        int currentOffset = walkThroughStack.popInt();
        if (currentOffset < size() && !visitedOffsets.get(currentOffset)) {
          visitedOffsets.set(currentOffset);
          int[] nextOffsets = getNextOffsets(currentOffset);
          for (int nextOffset : nextOffsets) {
            if (nextOffset == -1) break;
            if (isComplete(currentOffset, nextOffset)) {
              return true;
            }
            walkThroughStack.push(nextOffset);
          }
        }
      }
      return false;
    }
boolean depthFirstSearch(final int startOffset, @NotNull BitSet visitedOffsets)