Updated on 2022-02-22 GMT+08:00

Common Algorithm Parameters

Algorithm request

  • Request body example
    {
     "algorithmName":"XXX",
     "parameters":{
             ...
     }
    }
  • Request body parameter description
    Table 1 Request body parameter description

    Parameter

    Mandatory

    Type

    Description

    algorithmName

    Yes

    String

    Algorithm name.

    Possible values:

    • pagerank
    • personalrank
    • kcore
    • k_hop
    • shortest_path
    • all_shortest_paths
    • filtered_shortest_path
    • sssp
    • shortest_path_of_vertex_sets
    • n_paths
    • closeness
    • label_propagation
    • louvain
    • link_prediction
    • node2vec
    • realtime_recommendation
    • common_neighbors
    • connected_component
    • degree_correlation
    • triangle_count
    • cluster_coefficient
    • filtered_circle_detection

    parameters

    Yes

    Json

    Algorithm parameters. For details, see the parameter description of each algorithm.

    Table 2 New Body parameters of version 2.1.7

    Parameter

    Mandatory

    Type

    Description

    executionMode

    No

    String

    • sync: synchronous
    • async: asynchronous

    The default value is async.

    Supported algorithms:

    • k_hop
    • shortest_path
    • all_shortest_paths
    • filtered_shortest_path
    • shortest_path_of_vertex_sets
    • n_paths
    • realtime_recommendation

    offset

    No

    Integer

    Synchronization result offset. The default value is 0.

    NOTE:

    This parameter is valid when executionMode is sync.

    Supported algorithms:

    • k_hop
    • shortest_path
    • all_shortest_paths
    • shortest_path_of_vertex_sets
    • n_paths
    • realtime_recommendation

    limit

    No

    Integer

    Maximum number of returned synchronization results. The maximum value is 100000. The default value is 100000.

    NOTE:

    This parameter is valid when executionMode is sync.

    Supported algorithms:

    • k_hop
    • shortest_path
    • all_shortest_paths
    • shortest_path_of_vertex_sets
    • n_paths
    • realtime_recommendation
    Table 3 New Body parameters of version 2.2.4

    Parameter

    Mandatory

    Type

    Description

    vertex_filter

    No

    Json

    Filter criteria for the vertices on a path.

    Supported algorithms:

    • filtered_shortest_path

    For details about the format, see Table 6 in "Filtered-query API".

    edge_filter

    No

    Json

    Filter criteria for the edges (relationships) on a path.

    Supported algorithms:

    • filtered_shortest_path

    For details about the format, see Table 6 in "Filtered-query API".

    filters

    No

    Json

    Filter criteria. Each element in the array corresponds to a filter. This parameter applies only to filtered circle detection. For details about the format, see filters element formats.

Result

Execute specified algorithms based on the input parameters and query the algorithm results.

  • Response when an algorithm is successfully executed:
    {
        "data": {
    
       "outputs": {
               $response_data //Result of each algorithm. The results vary with the algorithm.
               "runtime": 1.365867,
               "data_return_size": 3,
               "data_offset": 0,
               "data_total_size": 100
        }
      },
      "status": "complete"
    }

    response_data indicates the result of each algorithm. The results vary with algorithms.

  • Response when an algorithm fails to be executed:
    Http Status Code: 400
    {
    "errorMessage":"Running algorithm [XXXX] error: YYYYYYYYY!",
    "errorCode":"GES.8301"
    }
  • Parameter description
    Table 4 Parameter description

    Parameter

    Mandatory

    Type

    Description

    errorMessage

    No

    String

    System prompt. If execution succeeds, this parameter may be left blank. If execution fails, this parameter is used to display the error message.

    errorCode

    No

    String

    System prompt. If execution succeeds, this parameter may be left blank. If execution fails, this parameter is used to display the error code.

    status

    No

    String

    Returned job status for a successful query. Possible values are waiting, running, and complete. This parameter is left blank when the query fails.

    data

    No

    Json

    Algorithm execution result. This parameter is left blank when the query fails.

  • Parameter description
    Table 5 outputs parameter description

    Parameter

    Type

    Description

    response_data

    Json

    Result returned after an algorithm is executed

    NOTE:

    The results vary with algorithms. For details, see parameter descriptions of each algorithm.

    runtime

    Double

    Algorithm execution time. The unit is second.

    data_return_size

    Integer

    Number of records returned from a query

    data_offset

    Integer

    Result offset of a query

    data_total_size

    Integer

    Total amount of result data generated by asynchronous jobs.

    Parameters data_return_size, data_offset, and data_total_size are used for pagination queries. After each of some algorithms (Shortest Path, Closeness Centrality, Link Prediction, Degree Correlation, Triangle Count, and Cluster Coefficient) is executed, only one value is returned and the result does not contain the parameter.