更新时间:2025-03-13 GMT+08:00
分享

算法公共参数

请求参数

表1 Body参数说明

参数

是否必选

类型

说明

algorithmName

String

算法名字。

取值范围(以下显示的均为算法实际调用时的名称):

  • shortest_path
  • shortest_path_of_vertex_sets
  • common_neighbors_of_vertex_sets

parameters

Object

算法参数。详情请参考各算法参数描述。

表2 2.1.7版本新增Body参数说明

参数

是否必选

类型

说明

executionMode

String

  • sync:同步
  • async:异步

默认值为“sync”。

支持的算法(以下显示的均为算法实际调用时的名称):

  • shortest_path
  • shortest_path_of_vertex_sets

offset

Integer

同步结果的偏移量,默认值为“0”。

说明:

executionMode=sync时有效。

支持的算法(以下显示的均为算法实际调用时的名称):

  • shortest_path
  • shortest_path_of_vertex_sets
  • common_neighbors_of_vertex_sets

limit

Integer

同步结果返回的最大数量,最大值为100000。默认值为“100000”。

说明:

executionMode=sync时有效。

支持的算法(以下显示的均为算法实际调用时的名称):

  • shortest_path
  • shortest_path_of_vertex_sets
  • common_neighbors_of_vertex_sets
表3 2.2.4版本新增Body参数说明

参数

是否必选

类型

说明

vertex_filter

Object

路径中对节点的过滤条件。

支持的算法(以下显示的均为算法实际调用时的名称):

  • filtered_shortest_path
  • filtered_all_pairs_shortest_paths
  • filtered_all_shortest_paths

具体格式请见 Filtered-query API中的表6

edge_filter

Object

路径中对边(关系)的过滤条件。

支持的算法(以下显示的均为算法实际调用时的名称):

  • filtered_shortest_path
  • filtered_all_pairs_shortest_paths
  • filtered_all_shortest_paths

具体格式请见 Filtered-query API中的表6

filters

Object

过滤条件列表,数组的每个元素分别对应每一层要做的查询和过滤条件。该参数仅适用于带一般过滤条件环路检测(filtered circle detection),具体格式请见filters元素格式

支持的算法:

  • filtered_n_paths

响应参数

表4 响应Body参数说明

参数

类型

说明

errorMessage

String

系统提示信息,执行成功时,字段可能为空。执行失败时,用于显示错误信息。

errorCode

String

系统提示信息,执行成功时,字段可能为空。执行失败时,用于显示错误码。

status

String

查询成功时返回任务状态,可选值为pending,running,complete。查询失败时字段为空。

data

Object

算法运行的结果。查询失败时字段为空。

请求示例

{
 "algorithmName":"XXX",
 "parameters":{
         ...
 }
}

响应示例

根据输入参数,执行指定算法,查询算法结果(根据算法请求返回的job_id,调用查询job_id接口获取算法结果)。

状态码: 200

成功响应示例

{
    "data": {
        "outputs": {
            "path": [
                "46",
                "133",
                "138"
            ],
            "source": "46",
            "target": "138"
        }
    },
    "result": "success"
}

response_data 表示各算法的具体返回结果,不同算法返回结果不同。

状态码: 400

失败响应示例

Http Status Code: 400
{
"errorMessage":"Running algorithm [XXXX] error: YYYYYYYYY!",
"errorCode":"GES.8301"
}

相关文档