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

Origin-Destination Betweenness Centrality

Function

This API is used to execute the Origin-Destination Betweenness Centrality algorithm based on input parameters.

The Origin-Destination Betweenness Centrality algorithm calculates shortest paths that pass through a vertex/edge, with the origin and destination (OD) specified.

URI

POST /ges/v1.0/{project_id}/hyg/{graph_name}/algorithm
Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For 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

Table 3 parameters

Parameter

Mandatory

Type

Description

directed

No

Boolean

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

weight

No

String

Weight of an edge. The value can be empty or a string.

  • Empty: The default weight and distance of edges are 1.
  • String: The property of the edge is the weight. If the edge does not have a property, the weight is 1 by default.

OD_pairs

No

String

Pairs of OD vertices

The value must be in the standard CSV format. The start vertex (origin) and end vertex (destination) are separated by commas (,), and the start and end vertex pairs are separated by newline characters (\\n), for example, Alice,Nana\\nLily,Amy.

seeds

No

String

ID of the node where a hot spot occurs. The number of IDs cannot exceed 30.

Data that will be imported when the data of OD vertex pairs is unknown. The value is in the standard CSV format. IDs are separated by commas (,), for example, Alice,Nana.

modes

No

String

Hot spot vertex type

  • IN: The hot spot vertex ID is used as the start vertex ID.
  • OUT: The hot spot vertex ID is used as the end vertex ID.

attendees

No

String

Number of participants in a hot spot corresponding to seeds. The value range is [1, 1000000].

The value is in the standard CSV format. Numbers are separated by commas (,), for example, 10,20.

Either OD_pairs or seeds must be specified. If they are both specified, the OD_pair value prevails.

Response Parameters

Parameter

Type

Description

errorMessage

String

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

errorCode

String

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

jobId

String

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

NOTE:

You can use the returned job ID to view the task execution status and obtain the algorithm return result. For details, see Querying Job Status on the Service Plane (1.0.0).

jobType

Integer

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

Example Request

POST http://{SERVER_URL}/ges/v1.0/{project_id}/hyg/{graph_name}/algorithm  
 { 
  "algorithmName":"edge_betweenness", 
  "parameters":{ 
         "OD_pairs":"1,2\\n3,4", 
         "directed":true
  } 
 }

SERVER_URL: Address for accessing a graph. For details about its value, see Using Service Plane APIs.

Example Response

Status code: 200

Example response for a successful request

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

Status code: 400

Example response for a failed request

Http Status Code: 400
{
"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.