apoc.path.expandConfig的uniqueness参数如何详细解析?
发布于 6 年前 作者 wupuqu 3046 次浏览 来自 问答

1.能详细说说每个参数的用法吗? 2.比如我想要返回的单个path不产生回路,比如:D1到A1的路径不能出现D1-A1-B1-A1,即某个点只能路过一次,应该用哪个参数?NODE_LEVEL?NODE_PATH?

value description RELATIONSHIP_PATH

For each returned node there’s a (relationship wise) unique path from the start node to it. This is Cypher’s default expansion mode.

NODE_GLOBAL

A node cannot be traversed more than once. This is what the legacy traversal framework does.

NODE_LEVEL

Entities on the same level are guaranteed to be unique.

NODE_PATH

For each returned node there’s a unique path from the start node to it.

NODE_RECENT

This is like NODE_GLOBAL, but only guarantees uniqueness among the most recent visited nodes, with a configurable count. Traversing a huge graph is quite memory intensive in that it keeps track of all the nodes it has visited. For huge graphs a traverser can hog all the memory in the JVM, causing OutOfMemoryError. Together with this Uniqueness you can supply a count, which is the number of most recent visited nodes. This can cause a node to be visited more than once, but scales infinitely.

RELATIONSHIP_GLOBAL

A relationship cannot be traversed more than once, whereas nodes can.

RELATIONSHIP_LEVEL

Entities on the same level are guaranteed to be unique.

RELATIONSHIP_RECENT

Same as for NODE_RECENT, but for relationships.

NONE

No restriction (the user will have to manage it)

1 回复

不知道我的理解对不对,请指点: 1.NODE_GLOBAL是指返回的所有path中,节点只能出现一次?; 2.NODE_LEVEL是指返回的所有path中,开始节点和某个终结点之间的某个size(比如1跳)的路径中,节点只能出现一次? 即比如(A1)-[r]-(B1),其中r有多个,但是只能选择一个返回; 3.NODE_PATH是指返回的所有path中,节点和关系的有序序列唯一,不能出现重复的。但是这种会出现回路?

but,这3个参数好像还是没有解决回路问题

回到顶部