You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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 ?
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.
The text was updated successfully, but these errors were encountered: