Path (Neo4j Apoc 1.1 API)
Keywords: org.neo4j.graphdb.Path interface

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.neo4j.graphdb
Interface Path

All Superinterfaces:
  Iterable<PropertyContainer>

All Known Subinterfaces:
  WeightedPath

    public interface Path

extends Iterable<PropertyContainer>

Represents a path in the graph. A path starts with a node followed by pairs of `Relationship` and `Node` objects. The shortest path is of length 0. Such a path contains only one node and no relationships. During a traversal `Path` instances are emitted where the current position of the traverser is represented by each such path. The current node in such a traversal is reached via `endNode()`.

Method Summary
`Node` | `endNode()` Returns the end node of this path.
`Iterator<PropertyContainer>` | `iterator()` Iterates through both the `Node`s and `Relationship`s of this path in order.
`Relationship` | `lastRelationship()` Returns the last `Relationship` in this path.
`int` | `length()` Returns the length of this path.
`Iterable<Node>` | `nodes()` Returns all the nodes in this path.
`Iterable<Relationship>` | `relationships()` Returns all the relationships in between the nodes which this path consists of.
`Node` | `startNode()` Returns the start node of this path.
`String` | `toString()` Returns a natural string representation of this path.

Method Detail

### startNode

    Node startNode()

  Returns the start node of this path. It's also the first node returned from the `nodes()` iterable.

  Returns:
    the start node.

### endNode

    Node endNode()

  Returns the end node of this path. It's also the last node returned from `nodes()` iterable. If the `length()` of this path is 0 the end node returned by this method is the same as the start node. If a path is emitted from a traverser the end node is the current node where the traverser is at the moment.

  Returns:
    the end node.

### lastRelationship

    Relationship lastRelationship()

  Returns the last `Relationship` in this path.

  Returns:
    the last `Relationship` in this path, or `null` if this path contains no `Relationship`s.

### relationships

    Iterable<Relationship> relationships()

  Returns all the relationships in between the nodes which this path consists of.

  Returns:
    the relationships in this path.

### nodes

    Iterable<Node> nodes()

  Returns all the nodes in this path. The first node is the same as `startNode()` and the last node is the same as `endNode()`. In between those nodes there can be an arbitrary number of nodes. The shortest path possible is just one node, where also the the start node is the same as the end node.

  Returns:
    the nodes in this path.

### length

    int length()

  Returns the length of this path. That is the number of relationships (which is the same as the number of nodes minus one). The shortest path possible is of length 0.

  Returns:
    the length (i.e. the number of relationships) in the path.

### toString

    String toString()

  Returns a natural string representation of this path. The string representation shows the nodes with relationships (and their directions) in between them.

  Overrides:
    `toString` in class `Object`
  Returns:
    A string representation of the path.

### iterator

    Iterator<PropertyContainer> iterator()

  Iterates through both the `Node`s and `Relationship`s of this path in order. Interleaving `Node`s with `Relationship`s, starting and ending with a `Node` (the `startNode()` and `endNode()` respectively).

  Specified by:
    `iterator` in interface `Iterable<PropertyContainer>`
  See Also:
    `Iterable.iterator()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010 Neo4j. All Rights Reserved.