- All Superinterfaces:
Iterable<Path.Segment>
A Path is a directed sequence of relationships between two nodes. This generally
represents a traversal or walk through a graph and maintains a direction separate
from that of any relationships traversed.
It is allowed to be of size 0, meaning there are no relationships in it. In this case, it contains only a single node which is both the start and the end of the path.
Path routeToStockholm = ..;
// Work with each segment of the path
for( Segment segment : routeToStockholm )
{
}
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA segment combines a relationship in a path with a start and end node that describe the traversal direction for that relationship. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif the specified node is contained in this path.booleancontains(Relationship relationship) Returnstrueif the specified relationship is contained in this path.end()Returns the end node of this path.intlength()Returns the number of segments in this path, which will be the same as the number of relationships.nodes()Create an iterable over the nodes in this path, nodes will appear in the same order as they appear in the path.Create an iterable over the relationships in this path.start()Returns the start node of this path.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
start
Node start()Returns the start node of this path.- Returns:
- the start node of this path
-
end
Node end()Returns the end node of this path.- Returns:
- the end node of this path
-
length
int length()Returns the number of segments in this path, which will be the same as the number of relationships.- Returns:
- the number of segments in this path, which will be the same as the number of relationships
-
contains
Returnstrueif the specified node is contained in this path.- Parameters:
node- the node to check for- Returns:
trueif the specified node is contained in this path
-
contains
Returnstrueif the specified relationship is contained in this path.- Parameters:
relationship- the relationship to check for- Returns:
trueif the specified relationship is contained in this path
-
nodes
Create an iterable over the nodes in this path, nodes will appear in the same order as they appear in the path.- Returns:
- an
Iterableof all nodes in this path
-
relationships
Iterable<Relationship> relationships()Create an iterable over the relationships in this path. The relationships will appear in the same order as they appear in the path.- Returns:
- an
Iterableof all relationships in this path
-