我在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 中的边):
nodes
edges
non-existing-start | v non-existing-1 | v non-existing-2 | v non-existing-3
它的作用是使用边索引遍历边缘( _from 和 _to 属性) . 集合 nodes 必须存在,但不测试 _from 和 _to 中引用的顶点是否实际存在于该集合中 . 查询结果为:
_from
_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 ,因此它们不存在 .
null
删除顶点时,您可以使用托管图和general-graph模块以确保一致性 .
1 回答
如果将起点作为字符串传递,则遍历不需要存在任何顶点:
数据(集合
nodes
中的顶点和edges
中的边):它的作用是使用边索引遍历边缘(
_from
和_to
属性) . 集合nodes
必须存在,但不测试_from
和_to
中引用的顶点是否实际存在于该集合中 . 查询结果为:如您所见,顶点是
null
,因此它们不存在 .删除顶点时,您可以使用托管图和general-graph模块以确保一致性 .