public default ElementRequirement getMaxRequirement() {
        ElementRequirement max = ElementRequirement.ID;
        if (this instanceof TraversalParent) {
            for (final Traversal.Admin<Object, Object> traversal : ((TraversalParent) this).getLocalChildren()) {
                if (traversal instanceof IdentityTraversal) {
                    if (max.compareTo(ElementRequirement.ID) < 0)
                        max = ElementRequirement.ID;
                } else if (traversal instanceof TokenTraversal && ((TokenTraversal) traversal).getToken().equals(T.id)) {
                    if (max.compareTo(ElementRequirement.ID) < 0)
                        max = ElementRequirement.ID;
                } else if (traversal instanceof TokenTraversal && ((TokenTraversal) traversal).getToken().equals(T.label)) {
                    if (max.compareTo(ElementRequirement.LABEL) < 0)
                        max = ElementRequirement.LABEL;
                } else if (traversal instanceof ValueTraversal) {
                    if (max.compareTo(ElementRequirement.PROPERTIES) < 0)
                        max = ElementRequirement.PROPERTIES;
                } else {
                    max = ElementRequirement.EDGES;
                }
            }
        }
        return max;
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/PathProcessor.java