
# 算法公共参数
#### 算法请求示例
```
{
 "algorithmName":"XXX",
 "parameters":{
         ...
 }
}
```
#### 请求参数
 表1Body参数说明 
| 参数            | 是否必选 | 类型     | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
|:---|:---|:---|:---|
| algorithmName | 是    | String | **参数解释：** 算法名字。 **约束限制：** 不涉及。 **取值范围：** 以下显示的均为算法实际调用时的名称： - pagerank  - personalrank  - kcore  - k_hop  - shortest_path  - all_shortest_paths  - filtered_shortest_path  - sssp  - shortest_path_of_vertex_sets  - n_paths  - closeness  - subgraph_matching  - topicrank  - label_propagation  - louvain  - link_prediction  - node2vec  - realtime_recommendation  - common_neighbors  - connected_component  - degree_correlation  - triangle_count  - cluster_coefficient  - common_neighbors_of_vertex_sets  - all_shortest_paths_of_vertex_sets  - filtered_circle_detection  - filtered_all_pairs_shortest_paths  - filtered_all_shortest_paths  - filtered_n_paths   **默认取值：** 不涉及。 |
| parameters    | 是    | Object | **参数解释：** 算法参数。详情请参考各算法参数描述。 **约束限制：** 不涉及。 **取值范围：** 不涉及。 **默认取值：** 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
   
表22.1.7版本新增Body参数说明 
| 参数            | 是否必选 | 类型      | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
|:---|:---|:---|:---|
| executionMode | 否    | String  | **参数解释：** 算法参数。详情请参考各算法参数描述。 **约束限制：** 支持的算法（以下显示的均为算法实际调用时的名称）： - k_hop  - shortest_path  - all_shortest_paths  - filtered_shortest_path  - shortest_path_of_vertex_sets  - n_paths  - realtime_recommendation  - filtered_all_pairs_shortest_paths  - filtered_all_shortest_paths   **取值范围：** - sync：同步  - async：异步   **默认取值：** "async"。 |
| offset        | 否    | Integer | **参数解释：** 同步结果的偏移量。 **约束限制：** executionMode=sync时有效。 支持的算法（以下显示的均为算法实际调用时的名称）： - k_hop  - shortest_path  - all_shortest_paths  - shortest_path_of_vertex_sets  - n_paths  - realtime_recommendation  - filtered_all_pairs_shortest_paths  - filtered_all_shortest_paths   **取值范围：** 不涉及。 **默认取值：** "0"。                                                                                                                                                                                         |
| limit         | 否    | Integer | **参数解释：** 算法参数。详情请参考各算法参数描述。 **约束限制：** executionMode=sync时有效。 支持的算法（以下显示的均为算法实际调用时的名称）： - k_hop  - shortest_path  - all_shortest_paths  - shortest_path_of_vertex_sets  - n_paths  - realtime_recommendation  - filtered_all_pairs_shortest_paths  - filtered_all_shortest_paths   **取值范围：** 同步结果返回的最大数量，最大值为100000。 **默认取值：** "100000"。                                                                                                                                                         |
   
表32.2.4版本新增Body参数说明 
| 参数            | 是否必选 | 类型     | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
|:---|:---|:---|:---|
| vertex_filter | 否    | Object | **参数解释：** 路径中对节点的过滤条件。 **约束限制：** 支持的算法（以下显示的均为算法实际调用时的名称）： - filtered_shortest_path  - filtered_all_pairs_shortest_paths  - filtered_all_shortest_paths   具体格式请见 Filtered-query API中的[property_filter元素格式](https://support.huaweicloud.com/api-ges/ges_03_0175.html#ges_03_0175__table1138175053111)。 **取值范围：** 不涉及。 **默认取值：** 不涉及。 |
| edge_filter   | 否    | Object | **参数解释：** 路径中对边（关系）的过滤条件。 **约束限制：** 支持的算法（以下显示的均为算法实际调用时的名称）： - filtered_shortest_path  - filtered_all_pairs_shortest_paths  - filtered_all_shortest_paths   具体格式请见 Filtered-query API中的[property_filter元素格式](https://support.huaweicloud.com/api-ges/ges_03_0175.html#ges_03_0175__table1138175053111)。 **取值范围：** 不涉及。 **默认取值：** 不涉及。 |
| filters       | 否    | Object | **参数解释：** 过滤条件列表，数组的每个元素分别对应每一层要做的查询和过滤条件。 **约束限制：** 支持的算法： - filtered_n_paths  - filtered_circle_detection  - topicrank   具体格式请见[filters元素格式](https://support.huaweicloud.com/api-ges/ges_03_0217.html#ges_03_0217__table1729539161413)。 **取值范围：** 不涉及。 **默认取值：** 不涉及。                                                                       |
   
#### 响应参数
表4响应Body参数说明 
| 参数           | 类型     | 说明                                                                                                                                                                                                                                                                                                                          |
|:---|:---|:---|
| errorMessage | String | **参数解释**： 系统提示信息。 - 执行成功时，字段可能为空。  - 执行失败时，用于显示错误信息。   **取值范围**： 不涉及。     |
| errorCode    | String | **参数解释**： 系统提示信息。 - 执行成功时，字段可能为空。  - 执行失败时，用于显示错误码。   **取值范围**： 不涉及。 |
| status       | String | **参数解释**： 查询成功时返回任务状态。 **取值范围**： 可选值为pending，running，success。查询失败时字段为空。                                                                                                                                                        |
| data         | Object | **参数解释**： 算法运行的结果。查询失败时字段为空。 **取值范围**： 不涉及。                                                                                                                                                                                      |
   
#### 响应示例
根据输入参数，执行指定算法，查询算法结果（根据算法请求返回的job_id，调用[查询job_id接口](https://support.huaweicloud.com/api-ges/ges_03_0037.html)获取算法结果）。
**状态码： 200**
成功响应示例
```
{
    "data": {
   "outputs": {
           $response_data //各算法的具体返回结果，不同算法返回结果不同
           "runtime": 1.365867,
           "data_return_size": 3,
           "data_offset": 0,
           "data_total_size": 100
    }
  },
  "status": "success"
}
```
![](https://support.huaweicloud.com/api-ges/public_sys-resources/note_3.0-zh-cn.png)
**response_data** 表示各算法的具体返回结果，不同算法返回结果不同。
**状态码： 400**
失败响应示例
```
Http Status Code: 400
{
"errorMessage":"Running algorithm [XXXX] error: YYYYYYYYY!",
"errorCode":"GES.8301"
}
```
