首页 > 解决方案 > 如何在 ArangoDB 中列出递归路径

问题描述

我正在尝试进行图遍历,我只想列出递归路径

我的遍历具有 1..10 的可变深度,它将找到以下路径:

1. start - decide - execute1 - end
2. start - decide - execute2 - decide - execute1 - end
3. start - execute3 - end

使用以下查询:

FOR v, e, p IN 1..10 OUTBOUND 'Node/start_0' Path
FILTER v.name == "end"
RETURN CONCAT_SEPARATOR(' - ', p.vertices[*].name)

现在我只想列出具有递归或循环的路径,在此示例中,我只想获取路径2. start - decide - execute2 - decide - execute1 - end,因为它通过了decide - execute2 - decide。我知道我们可以通过设置来避免这样的循环场景,uniqueVertices: 'path'但是如何只获取其中有循环的场景

标签: arangodbgraph-traversal

解决方案


推荐阅读