给定一个节点,s,与某个标签的> 1节点的集合C相邻。我想找到所有与C中每个元素相邻的节点。
更一般地说:
这在密码中是否可行?
答案 0 :(得分:1)
是的,绝对的,这在密码中是可行的。这是一个例子。
// start with finding the start node 's' and the adjacent nodes
match (s:Node {name: 's'} )-[:ADJ]->(C:Node)
// match only the adjacent nodes that have 'set C'
where C.set = 'C'
// pass C onto the remainder of the query
with s,C
// match the nodes that are adjacent to the nodes in 'set C'
match C-[:ADJ]->(adjacent)
// return all of the nodes in set C and a collection of the nodes
// adjacent to the set C nodes
return s.name, C.name, collect(adjacent.name)