Updated on 2024-01-04 GMT+08:00

Filtered Shortest Path

Request

  • Parameter description
Table 1 parameters parameter description

Parameter

Mandatory

Type

Description

source

Yes

String

Source vertex ID of a path

target

Yes

String

Target vertex ID of a path

directed

No

Boolean

Whether to consider the edge direction. The default value is false.

num_thread

No

Integer

Number of concurrent threads. The value ranges from 1 to 40. If the value is less than 1, it is automatically set to 1. If the value is greater than 40, it is automatically set to 40. The default value is 4.

  • Request example
    • Synchronization
      {
          "executionMode": "sync",
          "algorithmName": "filtered_shortest_path",
          "edge_filter": {
              "property_filter": {
                  "leftvalue": {
                      "label_name": "labelName"
                  },
                  "predicate": "IN",
                  "rightvalue": {
                      "value": [
                          "xxx",
                          "rate"
                      ]
                  }
              }
          },
          "vertex_filter": {
              "property_filter": {
                  "leftvalue": {
                      "property_name": "title"
                  },
                  "predicate": "PREFIX",
                  "rightvalue": {
                      "value": "tr_"
                  }
              }
          },
          "parameters": {
              "source": "tr_1",
              "target": "tr_117",
              "directed": true
          }
      }
    • Asynchronization
      {
          "executionMode": "async",
          "algorithmName": "filtered_shortest_path",
          "edge_filter": {
              "property_filter": {
                  "leftvalue": {
                      "label_name": "labelName"
                  },
                  "predicate": "IN",
                  "rightvalue": {
                      "value": [
                          "xxx",
                          "rate"
                      ]
                  }
              }
          },
          "vertex_filter": {
              "property_filter": {
                  "leftvalue": {
                      "property_name": "title"
                  },
                  "predicate": "PREFIX",
                  "rightvalue": {
                      "value": "tr_"
                  }
              }
          },
          "parameters": {
              "source": "tr_1",
              "target": "tr_117",
              "directed": true
          }
      }

Response

  • Synchronous data parameter description
    Table 2 response_data parameter description

    Parameter

    Mandatory

    Type

    Description

    path

    Yes

    List

    Vertex result set. If the last layer of filters is vertex filtering, the data contains vertices.

    source

    Yes

    String

    Source vertex ID

    target

    Yes

    String

    Target vertex ID

    runtime

    Yes

    Double

    Algorithm running time

  • Response example
    • Synchronous response example (successful request)
      {
          "data": {
              "outputs": {
                  "path": [
                      "tr_1",
                      "tr_5",
                      "tr_26",
                      "tr_117"
                  ],
                  "runtime": 0.735766,
                  "source": "tr_1",
                  "target": "tr_117"
              }
          }
      }
    • Synchronous response example (failed request)
      {
      "errorMessage": "graph [tesdt_117] is not found",
      "errorCode": "GES.8402"
      }
  • Asynchronous response parameters
    Table 3 response_data 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.

    jobId

    No

    String

    ID of the algorithm execution job. This parameter is left blank when the request fails.

    jobType

    No

    Integer

    Job type. This parameter is left blank when the request fails.

  • Example response
    • Asynchronous response example (successful request)
      {
      "jobId": "500dea8f-9651-41fe-8299-c20f13a032ea",
      "jobType": 2
      }

    • Asynchronous response example (failed request)
      {
      "errorMessage": "graph [test_117d] is not found",
      "errorCode": "GES.8402"
      }