Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for parameters in SHORTEST #1081

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,35 @@ New features are added to the language continuously, and occasionally, some feat
This section lists all of the features that have been removed, deprecated, added, or extended in different Cypher versions.
Replacement syntax for deprecated and removed features are also indicated.

[[cypher-deprecations-additions-removals-5.26]]
== Neo4j 5.26

[cols="2", options="header"]
|===
| Feature
| Details

a|
label:functionality[]
label:updated[]
[source, cypher, role=noheader]
----
MATCH SHORTEST $param (:A)-[:R]->{0,10}(:B)
----

[source, cypher, role=noheader]
----
MATCH p = ANY $param (:A)-[:R]->{0,10}(:B)
----

[source, cypher, role=noheader]
----
MATCH SHORTEST $param GROUPS (:A)-[:R]->{0,10}(:B)
----

a| Introduced the allowance of parameters to the xref:patterns/shortest-paths.adoc[SHORTEST and ANY path patterns].
|===

[[cypher-deprecations-additions-removals-5.25]]
== Neo4j 5.25

Expand Down
4 changes: 2 additions & 2 deletions modules/ROOT/pages/patterns/reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1165,10 +1165,10 @@ anyPathSearch ::= "ANY" [ numberOfPaths ] [ pathOrPaths ]
pathOrPaths ::= { "PATH" | "PATHS" }


numberOfPaths ::= unsignedDecimalInteger
numberOfPaths ::= unsignedDecimalInteger | parameter


numberOfGroups ::= unsignedDecimalInteger
numberOfGroups ::= unsignedDecimalInteger | parameter
----

[NOTE]
Expand Down
4 changes: 2 additions & 2 deletions modules/ROOT/pages/patterns/shortest-paths.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Use Cypher if:

* You need to specify complex graph navigation via xref:patterns/variable-length-patterns.adoc#quantified-path-patterns[quantified path patterns].
* Creating a link:https://neo4j.com/docs/graph-data-science/current/management-ops/graph-creation/graph-project/[graph projection] takes too long.
* GDS is not available in your instance, or the size of the GDS projection is too large for your instance.
* GDS is not available in your instance, or the size of the GDS projection is too large for your instance.

Use GDS if:

Expand Down Expand Up @@ -65,7 +65,7 @@ CREATE (asc)-[:LINK {distance: 7.25}]->(cnm),
(wof)-[:LINK {distance: 0.65}]->(wos)
----

The paths matched by a xref:patterns/fixed-length-patterns.adoc#path-patterns[path pattern] can be restricted to only the shortest (by number of hops) by including the keyword `SHORTEST k`, where `k` is the number of paths to match.
The paths matched by a xref:patterns/fixed-length-patterns.adoc#path-patterns[path pattern] can be restricted to only the shortest (by number of hops) by including the keyword `SHORTEST k`, where `k` is the number of paths to match, and can be either an `INTEGER` literal or a parameter which resolves to an `INTEGER`.
For example, the following example uses `SHORTEST 1` to return the length of the shortest path between `Worcester Shrub Hill` and `Bromsgrove`:

.Query
Expand Down