Updated on 2024-05-23 GMT+08:00

Temporal Paths

Function

This API is used to execute the temporal paths algorithm based on input parameters.

Note: Only one temporal path that meets the conditions is returned between two vertices.

URI

POST /ges/v1.0/{project_id}/graphs/{graph_name}/dynamicgraphs/action?action_id=execute-analysis

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

graph_name

Yes

String

Graph name

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

algorithmName

Yes

String

Algorithm name

parameters

Yes

parameters Object

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

dynamicRange

Yes

dynamicRange Object

Temporal parameters

Table 3 parameters

Parameter

Mandatory

Type

Description

source

Yes

String

Source vertex ID

targets

Yes

String

Target vertex ID set. The value is in CSV format. IDs are separated by commas (,), for example, Alice,Nana. The quantity cannot be greater than 100000. The default value is 1000.

directed

No

Boolean

Whether to consider the edge direction. The value can be true or false. The default value is false.

k

No

Integer

Maximum depth. The value ranges from 1 to 100. The default value is 3.

strategy

No

String

Algorithm policy. The value can be shortest, foremost, or fastest.

(Note: fastest is not supported currently.)

The default value is shortest.

  • shortest: Runs the shortest temporal paths algorithm to return the temporal path with the shortest distance.
  • foremost: Runs the foremost temporal paths algorithm to return the temporal path that reaches the target node as early as possible.
  • fastest: Runs the fastest temporal paths algorithm to return the temporal path that takes the shortest time.
Table 4 dynamicRange

Parameter

Mandatory

Type

Description

start

Yes

Date/ Integer

Start time for temporal analysis

end

Yes

Date/ Integer

End time for temporal analysis

time_props

Yes

time_props Object

Time properties for temporal analysis

Table 5 time_props

Parameter

Mandatory

Type

Description

stime

Yes

String

Name of the start time property

etime

Yes

String

Name of the end time property

Response Parameters

Table 6 Response parameters

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.

NOTE:

You can view the job execution status and obtain the return result by querying the job ID. For details, see Job Management APIs.

jobType

No

Integer

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

Example Request

Specify a source vertex ID to search for associated vertices. The algorithm name is temporal_paths, the start time of dynamic analysis is 1646092800, the end time is 1646170716, and the source vertex ID is Person00014.
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/dynamicgraphs/action?action_id=execute-analysis 
 {
  "algorithmName":"temporal_paths",
  "dynamicRange":{
    "start":1646092800,
    "end":1646170716,
    "time_props":
        {"stime":"startTime","etime":"endtime"}
    },
  "parameters":{
        "source":" Person00014",
        "targets":"Person00055,Person00058,Person00052,Person00061,Person00060,Place00032,Place00016,Place00026,Place00015,Place00043",
        "strategy":"shortest",
        "directed":true
  }
}

Example Response

Status code: 200

Example response for a successful request

 {  
 "jobId": "4448c9fb-0b16-4a78-8d89-2a137c53454a001679122", 
 "jobType": 1 
 }

Status code: 400

Example response for a failed request

 { 
 "errorMessage":"graph [demo] is not found", 
 "errorCode":"GES.8402" 
 }

Status Codes

Return Value

Description

400 Bad Request

Request error.

401 Unauthorized

Authorization failed.

403 Forbidden

No operation permissions.

404 Not Found

No resources found.

500 Internal Server Error

Internal server error.

503 Service Unavailable

Service unavailable.