Skip to content

Commit fef8398

Browse files
committed
Apply PR feedback
1 parent f81eaaf commit fef8398

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

modules/ROOT/pages/functions/predicate.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ RETURN all(i in emptyList WHERE true) as allTrue, all(i in emptyList WHERE false
110110
|===
111111
| *Syntax* 3+| `allReduce(accumulator = initial, stepVariable IN list \| reductionFunction, predicate)`
112112
| *Description* 3+| Returns true if, during the stepwise evaluation of a value across the elements in a given `LIST<ANY>`, the accumulated result satisfies a specified predicate at every step.
113-
Where that list is a xref:patterns/variable-length-patterns.adoc#group-variables[group variable] defined in a xref:patterns/variable-length-patterns.adoc#quantified-path-patterns[quantified path pattern] (not within a xref:patterns/shortest-paths.adoc[shortest path pattern]), it allows for the early pruning of paths that do not satisfy the predicate.
113+
Where that list is a xref:patterns/variable-length-patterns.adoc#group-variables[group variable] defined in a xref:patterns/variable-length-patterns.adoc#quantified-path-patterns[quantified path pattern], it allows for the early pruning of paths that do not satisfy the predicate.
114+
115+
*Note*: AllReduce should not be used for a group variable within a xref:patterns/shortest-paths.adoc[shortest path pattern].
114116
.7+| *Arguments* | *Name* | *Type* | *Description*
115117
| `accumulator` | `ANY` | A variable that holds the result of the `reductionFunction` as the `list` is iterated.
116118
It is initialized with the value of `initial`.

modules/ROOT/pages/patterns/variable-length-patterns.adoc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ For example, all relationships in the path must be of type `EMPLOYED_BY`.
380380
* Nodes or relationships must have properties satisfying some condition.
381381
For example, all relationships must have the property `distance > 10`.
382382

383-
* For every iteration of the QPP, an aggregated value over the constructed path so far should satisfy a predicate.
383+
* For every iteration of the quantified path pattern, an aggregated value over the constructed path so far should satisfy a predicate.
384384
For example, the sum of the property `distance` of the relationships in the path must be less than 50 for every step in the construction of the path.
385385
See xref::functions/predicate.adoc#functions-allreduce[allReduce] for more information about this predicate.
386386

@@ -562,9 +562,8 @@ This query avoids having to find all possible paths and then imposing a `LIMIT 1
562562
It also shows that there is only one path to solving the query (a number that remains constant even if the data from the rest of the UK railway network was included).
563563
Using inline predicates or making quantified path patterns more specific where possible can thus greatly improve query performance.
564564

565-
An alternative is to use the information that we want to find paths with a total distance less than `6.05`.
566-
From the `ALL SHORTEST` query, we know that there exists a path with a total distance of `6.04`.
567-
Once the path exceeds this limit, we can prune it and continue searching other paths.
565+
An alternative is to use an upper bound for the total distance, for example `6.05`.
566+
Once a path exceeds this upper bound, we can prune it and continue searching other paths.
568567
The xref::functions/predicate.adoc#functions-allreduce[allReduce] predicate function expresses this as follows:
569568

570569
.Query

0 commit comments

Comments
 (0)