org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization

## Class AdjacentToIncidentStrategy

- java.lang.Object
- - org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy<TraversalStrategy.OptimizationStrategy>
  - - org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.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())

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy

      `TraversalStrategy.DecorationStrategy, TraversalStrategy.FinalizationStrategy, TraversalStrategy.OptimizationStrategy, TraversalStrategy.ProviderOptimizationStrategy, TraversalStrategy.VerificationStrategy`

  - ### Field Summary

    - ### Fields inherited from interface org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy

      `STRATEGY`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `apply(Traversal.Admin<?,?> traversal)`
    `Set<Class<? extends TraversalStrategy.OptimizationStrategy>>` | `applyPrior()` The set of strategies that must be executed before this strategy is executed.
    `static AdjacentToIncidentStrategy` | `instance()`

    - ### Methods inherited from class org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy

      `equals, hashCode, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy.OptimizationStrategy

      `compareTo, getTraversalCategory`

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy

      `applyPost, getConfiguration`

- - ### Method Detail

    - #### apply

          public void apply(Traversal.Admin<?,?> traversal)

      Specified by:
        `apply` in interface `TraversalStrategy<TraversalStrategy.OptimizationStrategy>`

    - #### applyPrior

          public Set<Class<? extends TraversalStrategy.OptimizationStrategy>> applyPrior()

      Description copied from interface: `TraversalStrategy`
      The set of strategies that must be executed before this strategy is executed. If there are no ordering requirements, the default implementation returns an empty set.
      Specified by:
        `applyPrior` in interface `TraversalStrategy<TraversalStrategy.OptimizationStrategy>`
      Returns:
        the set of strategies that must be executed prior to this one.

    - #### instance

          public static AdjacentToIncidentStrategy instance()

Copyright © 2013–2021 Apache Software Foundation. All rights reserved.