在无Apoc的情况下访问neo4j路径中的节点

问题描述 投票:0回答:1

有人可以告诉我这是否可行吗?尝试使用

Unwind apoc.coll.pairsMin(nodes(p)) as pair

抛出

Neo.ClientError.Statement.SyntaxError: Unknown function 'apoc.coll.pairsMin' (line 3, column 8 (offset: 99))
"Unwind apoc.coll.pairsMin(nodes(p)) as pair"

[如果可能,我希望使用开箱即用的软件找到解决方案

neo4j neo4j-apoc
1个回答
0
投票

您喜欢这项工作吗?

// find the path you are interested in
MATCH p=(:Node {name: 'start'})-[*]->(:Node {name: 'end'})

// use reduce to iterate over the relationships
// accumulate the collections of the start and endNode for each relation
RETURN REDUCE (pairs = [], rel in relationships(p) | pairs + [[startNode(rel), endNode(rel)]] ) AS pairs
© www.soinside.com 2019 - 2024. All rights reserved.