allShortestPaths

Generic Description

Path-pattern helper that asks for all shortest paths of minimum length.

Simple example:

MATCH p = allShortestPaths((a:Page)-[:LINK*]->(b:Page)) RETURN length(p) AS hop_count

Consumer-Level Explanation

Use allShortestPaths when the query must path-pattern helper that asks for all shortest paths of minimum length and the planner needs to see that operation as part of the Cypher row pipeline. Keep the clause explicit because it controls row grain, variable scope, and what later clauses are allowed to reference.

More Detailed Explanation

allShortestPaths differs from shortestPath by emphasizing ambiguity rather than collapsing it. It is for cases where multiple shortest alternatives are analytically or operationally important.

What this clause is really for:

Advanced Example

This example keeps allShortestPaths inside a complete query pipeline so the clause boundary, visible variables, and returned row shape are clear to planner tooling.

MATCH p = allShortestPaths((a:Page)-[:LINK*]->(b:Page))
RETURN length(p) AS hop_count, size(nodes(p)) AS node_count, size(relationships(p)) AS relationship_count

Real Use Cases

Real Limitations And Tradeoffs