private void applyToChildren(final Set<String> keepLabels, final List<Traversal.Admin<Object, Object>> children) {
        // if there are no labels to keep, then there no need to iterate all the children because we won't be
        // adding anything PathProcessor keepLabels - avoids the added recursion
        if (keepLabels.isEmpty()) return;

        for (final Traversal.Admin<Object, Object> child : children) {
            TraversalHelper.applyTraversalRecursively(trav -> addLabels(trav, keepLabels), child);
        }
    }
Determines if the strategy should be applied or not. It returns {@code true} and is "not applicable" when the
following conditions are met:
<ul>
    <li>If there are lambdas as you can't introspect to know what path information the lambdas are using</li>
    <li>If a PATH requirement step is being used (in the future, we can do PATH requirement lookhead to be more intelligent about its usage)</li>
    <li>If a VertexProgramStep is present with LABELED_PATH requirements</li>
</ul>
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java