我有以下路径
1->4
1->2->3->4
1->2->3->4->4
我想获得1-> 4
的最佳途径预期结果是
1->4
1->2->3->4
without the 1->2->3->4->4)
查询示例:
match path = ((p0 { PositionId : 1})-[r*]->( next {PositionId : 4}))
return extract(z IN nodes(path) | z.PositionId),count(*)
答案 0 :(得分:2)
match path = (p0 { PositionId : 1})-[r*]->( next {PositionId : 4})
WHERE NOT next in nodes(path)[1..-1]
return extract(z IN nodes(path) | z.PositionId),count(*)