relationships

Generic Description

Inspects a path value returned by a Cypher path pattern or path function. It is documented separately because path-valued results carry ordered topology that is different from a flat row of nodes or relationships.

Simple example:

MATCH p = (:Page)-[:LINK]->(:Page) RETURN relationships(p), nodes(p)

Consumer-Level Explanation

Use it when the path object needs to be decomposed into nodes, relationships, or structural quality checks. Prefer this function when the query needs to inspect path structure after matching, ranking, or filtering candidate traversals.

More Detailed Explanation

relationships should be understood by the value shape it expects and the row shape it returns. It composes with MATCH, WHERE, WITH, RETURN, and procedure output, so planner-facing documentation should describe both the immediate value transformation and why it belongs in the database query.

Advanced Example

This example uses relationships inside a named row pipeline so the value shape is clear to both the planner and reviewers.

MATCH p = (:Page)-[:LINK*1..2]->(:Page)
RETURN relationships(p) AS focused_value, size(relationships(p)) AS relationship_count
LIMIT 10

Real Use Cases

Real Limitations And Tradeoffs