Darii Petru Asked: 2023-07-10 14:59:42 +0800 CST2023-07-10 14:59:42 +0800 CST 2023-07-10 14:59:42 +0800 CST neo4j 面包屑导航查询 772 我想编写一个查询来接收来自任何子节点的所有父节点直到根节点,顺序为: 这是图表: 我找到了一些解决方案,但结果有一些重复或节点未排序。提前致谢。 neo4j 1 个回答 Voted Best Answer Darii Petru 2023-07-11T19:39:56+08:002023-07-11T19:39:56+08:00 我来的解决方案: MATCH p=((s:storage)-[*]->(n:item {id: 1003})) WITH nodes(p) AS nodes, length(p) AS distance UNWIND nodes[0..size(nodes)] AS node RETURN DISTINCT node.id, head(labels(node)) AS mainLabel
我来的解决方案: