5.8 Using the SOURCE and DESTINATION Predicates

You can determine if a vertex is a source or destination using the IS [NOT] SOURCE OF or IS [NOT] DESTINATION OF predicate in a value expression inside a WHERE or COLUMNS clause.

These predicates are mainly useful for determining the direction of edges that are matched through any-directed edge patterns (<-[]-> or -[]-).

The IS [NOT] SOURCE OF predicate takes a vertex and an edge as input and returns TRUE or FALSE depending on whether the vertex is (or not) the source of the edge.

The IS [NOT] DESTINATION OF predicate also takes a vertex and an edge as input and returns TRUE or FALSE depending on whether the vertex is (or not) the destination of the edge.

If at least one of the referenced element variables is not bound to a graph element, then the source and destination predicates evaluate to the null value. Otherwise, they evaluate to TRUE or FALSE.

See Example 5-29 for more information.