高效地获取节点的所有关系类型



我有一个节点,它有很多邻居(~1M(。我想得到这个节点上所有关系的所有关系类型的列表(应该是大约6种不同的类型(。目前我正在使用

match (n:Label {indexedProperty:"value"}) match (n)-[r]-() return distinct type(r)

但这需要相当长的时间(大约18秒(。

有没有一种方法可以在密码中更有效地做到这一点?

APOC程序可以在这里提供帮助,请尝试使用apoc.node.relationship.types():

match (n:Label {indexedProperty:"value"})
return apoc.node.relationship.types() as types

这将获得节点上不同类型的列表。

最新更新