public static boolean isExitComponent(@NotNull List<? extends Statement> component) {
    Set<Statement> statements = new HashSet<>();
    for (Statement statement : component) {
      statements.addAll(statement.getNeighbours(EdgeType.REGULAR, EdgeDirection.FORWARD));
    }
    for (Statement statement : component) {
      statements.remove(statement);
    }
    return statements.size() == 0;
  }
public static boolean isExitComponent(@NotNull List<? extends Statement> component)