@Override
  public <Node> void collectOutsRecursively(@NotNull Graph<Node> graph, Node start, Set<? super Node> set) {
    if (!set.add(start)) {
      return;
    }

    List<Node> stack = new ArrayList<>();
    stack.add(start);
    while (!stack.isEmpty()) {
      Node currentNode = stack.remove(stack.size() - 1);
      Iterator<Node> successorIterator = graph.getOut(currentNode);
      while (successorIterator.hasNext()) {
        Node successor = successorIterator.next();
        if (set.add(successor)) {
          stack.add(successor);
        }
      }
    }
  }
@Override
  public <Node> void collectOutsRecursively(@NotNull Graph<Node> graph, Node start, Set<? super Node> set)