答案 0 :(得分:1)
此查询是否适合您?
它应该返回每个Blue
节点(具有到任何Red
节点的路径)及其“子节点”(沿着每个路径),忽略任何子节点的路径(第一个除外)有一个传入的ANALYTICALLY_COMPOSED
关系:
MATCH (a:Blue)-[:ANALYTICALLY_COMPOSED]->(b)
MATCH p=(b)-[rels*]-(:Red)
WITH a, NODES(p) AS subnodes
WHERE NONE(n IN subnodes[1..] WHERE ()-[:ANALYTICALLY_COMPOSED]->(n))
RETURN a, subnodes;