cypher - Get all Routes between two nodes neo4j -
i'm working on project have deal graphs... i'm using graph routes bus , bike between 2 stops.
the fact is,all relationship contains time needed go start point of relationship , end.
in order shortest path between node, i'm using shortest path function of cypher. something, shortest path not fastest....
is there way paths between 2 nodes not linked relationship?
thanks
edit:
in fact alter graph, create easier. still have nodes. relationship type correspond time needed go node another.
the shortestpath function of cypher give path contains less relationship. returns path add-on of type (the time) smallest.. possible?
thanks
in cypher, paths between 2 nodes not linked relationship, , sort total in weight, can utilize cut down function introduced in 1.9:
start a=node(...), b=node(...) // start nodes match p=a-[r*2..5]->b // match paths (best provide maximum lengths prevent queries running away) not(a-->b) // not straight connected b p, relationships(p) rcoll // readability, alias rcoll homecoming p, reduce(totaltime=0, x in rcoll: totaltime + x.time) totaltime order totaltime you can throw limit 1 @ end, if need shortest.
neo4j cypher
No comments:
Post a Comment