2014-08-27 151 views
0

我正在使用Neo4j 2.1.3并试图获得两个节点之间的最短路径。我用这个暗号代码:neo4j减少语法错误

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”指着单词“减少”。任何想法有什么不对?

谢谢!

回答

2

尝试替换:with a |

这样的:

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 
+0

固定的,谢谢:) – 2014-08-27 09:08:34