Class AdjacentToIncidentStrategy

  • All Implemented Interfaces:
    Serializable, Comparable<Class<? extends TraversalStrategy>>, TraversalStrategy<TraversalStrategy.OptimizationStrategy>, TraversalStrategy.OptimizationStrategy

    public final class AdjacentToIncidentStrategy
    extends AbstractTraversalStrategy<TraversalStrategy.OptimizationStrategy>
    implements TraversalStrategy.OptimizationStrategy
    This strategy looks for vertex- and value-emitting steps followed by a CountGlobalStep and replaces the pattern with an edge- or property-emitting step followed by a CountGlobalStep. Furthermore, if a vertex- or value-emitting step is the last step in a .has(traversal), .and(traversal, ...) or .or(traversal, ...) child traversal, it is replaced by an appropriate edge- or property-emitting step. Performing this replacement removes situations where the more expensive trip to an adjacent graph element (e.g. the vertex on the other side of an edge) can be satisfied by trips to incident graph elements (e.g. just the edge itself).
    Author:
    Daniel Kuppitz (http://gremlin.guru)
    See Also:
    Serialized Form
    Example:
     __.out().count()            // is replaced by __.outE().count()
     __.in().limit(3).count()    // is replaced by __.inE().limit(3).count()
     __.values("name").count()   // is replaced by __.properties("name").count()
     __.where(__.out())          // is replaced by __.where(__.outE())
     __.where(__.values())       // is replaced by __.where(__.properties())
     __.and(__.in(), __.out())   // is replaced by __.and(__.inE(), __.outE())