
# 带一般过滤条件环路检测（filtered_circle_detection）(2.2.15)
#### 请求参数
表1parameters参数说明 
| 参数            | 是否必选 | 说明                               | 类型                                            | 取值范围                       | 默认值                                 |
|:---|:---|:---|:---|:---|:---|
| sources       | 否    | 查询的起始节点ID集合                      | String                                        | -                          | 标准csv格式，ID之间以英文逗号分隔，例如："Alice,Nana" |
| n             | 否    | 枚举的满足过滤条件的圈的个数的上限                | Integer                                       | \[1,100000\]               | 100                                 |
| statistics    | 否    | 是否输出所有满足过滤条件的圈的个数                | Boolean                                       | true或false                 | false                               |
| batch_number  | 否    | 批量处理的起始节点的个数                     | Integer                                       | \[1,1000\]                 | 10                                  |
| output_format | 否    | 输出结果的格式                          | String                                        | vertexId,edgeId或edgeObject | edgeObject                          |
| filters       | 是    | 过滤条件列表，数组的每个元素分别对应每一层要做的查询和过滤条件。 | Object  | -                          | -                                   |
   
 表2filters元素格式 
| 参数            | 是否必选 | 说明                                                                                                                                                         | 类型      | 取值范围         | 默认值 |
|:---|:---|:---|:---|:---|:---|
| operator      | 否    | 表示当前层要做的查询的方向                                                                                                                                              | String  | out,in 或both | out |
| edge_filter   | 否    | 表示当前层查询时边的过滤条件。具体格式请见 Filtered-query API中的[property_filter元素格式](https://support.huaweicloud.com/api-ges/ges_03_0175.html#ges_03_0175__table1138175053111)。 | Object  | -            | -   |
| vertex_filter | 否    | 表示当前层查询时点的过滤条件。具体格式请见 Filtered-query API中的[property_filter元素格式](https://support.huaweicloud.com/api-ges/ges_03_0175.html#ges_03_0175__table1138175053111)。 | Object  | -            | -   |
| times         | 否    | 以相同的过滤条件查询的层数                                                                                                                                              | Integer | \[1,10\]     | 1   |
   
![](https://support.huaweicloud.com/api-ges/public_sys-resources/note_3.0-zh-cn.png)
- 第一层的过滤条件是对初始节点的过滤，因此仅vertex_filter参数有效。
- 最后一层的点过滤条件也是对初始节点的过滤。
- 环路的长度范围是 3-10，因此过滤层数是 4-11 层。
 
表3response_data 参数说明 
| 参数            | 类型      | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|
| circles       | List    | 找到的圈集合。格式： \[\[circle1\],\[circle2\],...\]， 其中circle的格式： - 若output_format=edgeObject，则为 \[{"source": sourceId,"target"：targetId, "index"：edgeIndex},...\]，其中，sourceId、targetId和edgeIndex均为string类型。  - 若output_format=edgeId，则为 \[sourceId-targetId-edgeIndex,...\]，其中sourceId-targetId-edgeIndex为string类型。  - 若output_format=vertexId，则为\[vertexId,...\]，其中vertexId为string类型。   |
| runtime       | Double  | 算法运行时间。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| n             | Integer | 枚举圈的个数的上限。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| circle_number | Integer | 当statistics=true时，输出所有满足条件的圈的个数。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
   
#### 请求示例
```
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=execute-algorithm
{
    "algorithmName": "filtered_circle_detection",
    "parameters": {
        "n": 10,
        "statistics": true,
        "output_format":"edgeId"
    },
    "filters": [
        {
        },
        {
            "operator": "out",
            "edge_filter": {
                "property_filter": {
                    "leftvalue": {
                        "label_name": "labelName"
                    },
                    "predicate": "=",
                    "rightvalue": {
                        "value": "transfer"
                    }
                }
            },
            "times":5
        }
    ]
}
```
