From 533a846c5775a7874b93ff126f2556faaa9f5980 Mon Sep 17 00:00:00 2001 From: Wilco Date: Wed, 8 Jan 2025 10:32:02 +0100 Subject: [PATCH 1/2] Document that the shortestPath() and allShortestPath() functions can only have a lower bound of 0 or 1 for its variable length pattern --- modules/ROOT/pages/patterns/reference.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ROOT/pages/patterns/reference.adoc b/modules/ROOT/pages/patterns/reference.adoc index f75ac88c9..1dc8da36c 100644 --- a/modules/ROOT/pages/patterns/reference.adoc +++ b/modules/ROOT/pages/patterns/reference.adoc @@ -1372,6 +1372,7 @@ They are similar to `SHORTEST 1` and `ALL SHORTEST`, but with several difference * The path pattern is passed as an argument to the functions. * The path pattern is limited to a single relationship pattern. * To return results where the first and last node in the path are the same requires a change to the configuration setting link:{neo4j-docs-base-uri}/operations-manual/{page-version}/configuration/configuration-settings/#config_dbms.cypher.forbid_shortestpath_common_nodes[`dbms.cypher.forbid_shortestpath_common_nodes`]. +* The minimum path length, also called the lower bound of the variable length relationship pattern, should be 0 or 1. Both functions will continue to be available, but they are not xref:appendix/gql-conformance/index.adoc[GQL conformant]. From 148ec59976e87c4f9401dd07f299eb6934b595d3 Mon Sep 17 00:00:00 2001 From: Wilco Date: Fri, 10 Jan 2025 09:35:00 +0100 Subject: [PATCH 2/2] Add lower bound restriction of shortestPath() and allShortestPath() to the rules section --- modules/ROOT/pages/patterns/reference.adoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/ROOT/pages/patterns/reference.adoc b/modules/ROOT/pages/patterns/reference.adoc index 1dc8da36c..af68fc22a 100644 --- a/modules/ROOT/pages/patterns/reference.adoc +++ b/modules/ROOT/pages/patterns/reference.adoc @@ -1415,7 +1415,7 @@ shortestPath((:A)-->+(:B)) [[shortest-functions-rules-path-pattern-length]] ==== Path pattern length -There must be exactly one relationship pattern in the path pattern. +There must be exactly one relationship pattern in the path pattern, and the lower bound should be 0 or 1. .Allowed [source] @@ -1428,6 +1428,8 @@ shortestPath((a)-[:R*1..5]-(b)) ---- shortestPath((a)-[:R*1..5]-(b)-->(:X)) +shortestPath((a)-[:R*2..5]-(b)) + shortestPath((:A)) allShortestPaths((a:A)-[:S*]->(:B), (a)-[:R*1..3]->(:C))