[英]AQL traversal using path filtering
我正在AQL(arangodb 3.1.22)中编写图形遍历查询,其中对于返回的某些路径,我在路径对象中获得了一个顶点,该顶点未连接到该路径对象中返回的任何边(即边缘的_from / _to属性与顶点_id不匹配。
我在假设路径对象仅返回该路径上的顶点和边的假设下进行工作。 这是一个错误的假设吗?
如果将起点作为字符串传递,则遍历根本不需要存在任何顶点:
FOR v, e IN 1..10 OUTBOUND "nodes/non-existing-start" edges
RETURN { vertex: v, _from: e._from, _to: e._to }
数据(集合nodes
顶点和边缘中的edges
):
non-existing-start
|
v
non-existing-1
|
v
non-existing-2
|
v
non-existing-3
它所做的是使用边缘索引沿确实存在的边缘( _from
和_to
属性)遍历。 集合nodes
必须存在,但是未测试_from
和_to
引用的顶点在该集合中_to
实际存在。 查询结果为:
[
{
"vertex": null,
"_from": "nodes/non-existing-start",
"_to": "nodes/non-existing-1"
},
{
"vertex": null,
"_from": "nodes/non-existing-1",
"_to": "nodes/non-existing-2"
},
{
"vertex": null,
"_from": "nodes/non-existing-2",
"_to": "nodes/non-existing-3"
}
]
如您所见,顶点为null
,因此它们不存在。
删除顶点时,也可以使用托管图和常规图模块来删除连接到顶点的边,以确保一致性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.