Skip to content

Conversation

@WilcoNeo
Copy link
Contributor

No description provided.

Comment on lines 565 to 566
An alternative is to use the information that we want to find paths with a total distance less than `6.05`.
From the `ALL SHORTEST` query, we know that there exists a path with a total distance of `6.04`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid mentioning SHORTEST here, it muddies the water. We don't want to suggest the association of SHORTEST with allReduce().
Like in the previous example we say "This works fine where the solution is known to lie within some range of hops.", here I would say that I pick a known upper bound of 6.05 or maybe even 7 or 10 for the total distance. I wouldn't specify how I know it to be a reasonable upper bound.

* Nodes or relationships must have properties satisfying some condition.
For example, all relationships must have the property `distance > 10`.

* For every iteration of the QPP, an aggregated value over the constructed path so far should satisfy a predicate.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* For every iteration of the QPP, an aggregated value over the constructed path so far should satisfy a predicate.
* For every iteration of the quantified path pattern, an aggregated value over the constructed path so far should satisfy a predicate.

| *Syntax* 3+| `allReduce(accumulator = initial, stepVariable IN list \| reductionFunction, predicate)`
| *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.
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.
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make it a bit longer and as a follow-up sentence, not between prentheses.

@neo4j-docops-agent
Copy link
Collaborator

This PR includes documentation updates
View the updated docs at https://neo4j-docs-cypher-1407.surge.sh

Updated pages:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants