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

using Dijkstra with calculated properties #162

Open
neo-technology-build-agent opened this issue Sep 1, 2022 · 3 comments
Open

using Dijkstra with calculated properties #162

neo-technology-build-agent opened this issue Sep 1, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@neo-technology-build-agent
Copy link
Collaborator

Issue by rvanbruggen
Tuesday Aug 23, 2016 at 10:15 GMT
Originally opened as neo4j-contrib/neo4j-apoc-procedures#119


I would like to run the apoc.algo.dijkstra with a cost function that is calculated based on 2 properties of the relationships. I have
(a)-[r:RELTYPE {prop1:x, prop2:y})->(b)
and would like to do
call apoc.algo.dijkstra(a,b,'RELTYPE',prop1/prop2) yield path, weight
or something like that. I can of course persist the calculated property and do dijkstra over that new property, but it would be nice if you did not have to do that.

@neo-technology-build-agent neo-technology-build-agent added the enhancement New feature or request label Sep 1, 2022
@neo-technology-build-agent
Copy link
Collaborator Author

Comment by jexp
Wednesday Aug 24, 2016 at 20:29 GMT


We can provide an arbitrary Cypher expression that is then executed with the following things passed in: start-, end-node of relationship, relationship, path

call apoc.algo.dijkstra(a,b,'RELTYPE','rel.prop1/r.prop2`) yield path, weight

is turned into something like this:
WITH {relationship} as r, {startNode} as s,{endNode} as e, {path} as p RETURN rel.prop1/r.prop2 as weight

I wonder if shorter variable names are better like r or more descriptive ones like rel, relationship, lastRelationship.

Oh and where available we can use the compiled Cypher runtime to make this really fast :)

For simple operations though this all might be overkill and we "could" implement a basic expression handler for addition, multiplication, division, subtraction ?

@neo-technology-build-agent
Copy link
Collaborator Author

Comment by fbiville
Thursday Apr 29, 2021 at 16:01 GMT


@rvanbruggen it seems GDS has the same limitation. Should we transfer the issue to GDS? What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants