MATCH (n:Node)
WITH n
OPTIONAL MATCH (n)--(m:Node)
WITH COLLECT(m.key) as arr, n.key AS key
WITH arr + key AS arr
WITH apoc.coll.sort(arr) AS arr
RETURN DISTINCT arr
MATCH (n:Node)
WITH n
OPTIONAL MATCH (n)--(m:Node)
WITH COLLECT(m.key) as arr, n.key AS key
WITH arr + key as arr
WITH apoc.coll.sort(arr) AS arr
WITH DISTINCT arr AS arr
RETURN COLLECT(arr) AS arr
1条答案
按热度按时间ifsvaxew1#
一种选择是使用apoc.科尔.排序:
其中:
返回:
如果需要,您还可以添加一个
COLLECT
:获得: