org.apache.tinkerpop.gremlin.structure

## Interface Edge

- All Superinterfaces:
    Element
  All Known Implementing Classes:
    ComputerGraph.ComputerEdge, DetachedEdge, HadoopEdge, Neo4jEdge, ReferenceEdge, StarGraph.StarEdge, StarGraph.StarInEdge, StarGraph.StarOutEdge, TinkerEdge

      public interface Edge
      extends Element

  An `Edge` links two `Vertex` objects. Along with its `Property` objects, an `Edge` has both a `Direction` and a `label`. The `Direction` determines which `Vertex` is the tail `Vertex` (out `Vertex`) and which `Vertex` is the head `Vertex` (in `Vertex`). The `Edge` `label` determines the type of relationship that exists between the two vertices.

  Diagrammatically:

       outVertex ---label---> inVertex.

  Author:
    Marko A. Rodriguez (http://markorodriguez.com), Stephen Mallette (http://stephen.genoprime.com)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `Edge.Exceptions` Common exceptions to use with an edge.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_LABEL` The default label to use for an edge.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default Iterator<Vertex>` | `bothVertices()` Get both the outgoing and incoming vertices of this edge.
    `default Vertex` | `inVertex()` Get the incoming/head vertex of this edge.
    `default Vertex` | `outVertex()` Get the outgoing/tail vertex of this edge.
    `<V> Iterator<Property<V>>` | `properties(String... propertyKeys)` Get an `Iterator` of properties.
    `Iterator<Vertex>` | `vertices(Direction direction)` Retrieve the vertex (or vertices) associated with this edge as defined by the direction.

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.structure.Element

      `graph, id, keys, label, property, property, remove, value, values`

- - ### Field Detail

    - #### DEFAULT_LABEL

          static final String DEFAULT_LABEL

      The default label to use for an edge. This is typically never used as when an edge is created, an edge label is required to be specified.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### vertices

          Iterator<Vertex> vertices(Direction direction)

      Retrieve the vertex (or vertices) associated with this edge as defined by the direction. If the direction is `Direction.BOTH` then the iterator order is: `Direction.OUT` then `Direction.IN`.
      Parameters:
        `direction` - Get the incoming vertex, outgoing vertex, or both vertices
      Returns:
        An iterator with 1 or 2 vertices

    - #### outVertex

          default Vertex outVertex()

      Get the outgoing/tail vertex of this edge.
      Returns:
        the outgoing vertex of the edge

    - #### inVertex

          default Vertex inVertex()

      Get the incoming/head vertex of this edge.
      Returns:
        the incoming vertex of the edge

    - #### bothVertices

          default Iterator<Vertex> bothVertices()

      Get both the outgoing and incoming vertices of this edge. The first vertex in the iterator is the outgoing vertex. The second vertex in the iterator is the incoming vertex.
      Returns:
        an iterator of the two vertices of this edge

    - #### properties

          <V> Iterator<Property<V>> properties(String... propertyKeys)

      Get an `Iterator` of properties.
      Specified by:
        `properties` in interface `Element`

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