我正在使用Neo4j 2.1.3并尝试在两个节点之间获得最短路径。我使用这个密码:
start a=node(10118), b=node(10141)
match p=a-[r*2..5]->b
with p, relationships(p) as rcoll
return p, reduce(totalTime=0, x in rcoll: totalTime + x.time) as totalTime
order by totalTime
但我得到“Neo.ClientError.Statement.InvalidSyntax”指向单词'reduce'。知道什么是错的吗?
谢谢!
答案 0 :(得分:2)
尝试用|
替换: 像这样:start a=node(10118), b=node(10141)
match p=a-[r*2..5]->b
with p, relationships(p) as rcoll
return p, reduce(totalTime=0, x in rcoll | totalTime + x.time) as totalTime
order by totalTime