Querying Tree Details
Function
After you input a vertex, a tree starting from the vertex is output, including nodes and edges in the tree, and information about reachable paths. Parameters can be the direction (out, in, and out and in), maximum number of hops, and edge properties to be filtered.
URI
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 |
Example Request
Post /ges/v1.0/{project_id}/graphs/test/action?action_id=query-tree { "executionMode": "sync", "rootId": "0", "maxDepth": 20, "maxVertices": 5000, "maxEdges": 10000, "maxDegree": 1000, "direction": "both", "labelFilters": [ "edge", "default" ], "withVertex": true, "withEdge": true }
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
executionMode |
No |
String |
The default value is async, indicating asynchronous response. |
rootId |
Yes |
String |
ID of the root node |
maxDepth |
Yes |
Integer |
Tree depth, that is, the maximum length of a path. The value ranges from 1 to 20. |
direction |
Yes |
String |
Possible values: in: Query incoming edges. out: Query outgoing edges. both: Query edges in both directions. |
labelFilters |
No |
Array of Json |
Whether to filter paths by label. The default value is []. |
maxVertices |
Yes |
Integer |
Maximum number of vertices that can be obtained. The value ranges from 0 to 200,000 (excluding 0). |
maxEdges |
Yes |
Integer |
Maximum number of edges that can be obtained. The value ranges from 0 to 200,000 (excluding 0). |
maxDegree |
No |
Long |
This parameter is used to access a super node. When the number of unidirectionally connected edges of an accessed node is greater than maxDegree, the next hop of the node will not be accessed. |
withVertex |
No |
Boolean |
Whether to output the vertex data. The default value is true. |
withEdge |
No |
Boolean |
Whether to output the edge data. The default value is true. |

In asynchronous mode, vertex and edge data is output at the same time. Pagination is not supported.
Response Parameters
Parameter |
Type |
Description |
---|---|---|
errorMessage |
String |
System prompt.
|
errorCode |
String |
System prompt.
|
data |
Object |
Query results. For details, see Table 4 and Table 5. This parameter is left blank when the query fails. |
Example Response
- Synchronous call
Example response (successful request)
Http Status Code: 200 { "data": { "edges" : [ { "index" : "0", "label" : "edge", "properties" : { "_type" : [ "ACTED_IN" ], "role" : [ "Neo" ] }, "source" : "546", "target" : "0" }, ... ], "vertices" : [ { "id" : "546", "label" : "node", "properties" : { "_labels" : [ "Actor" ], "d" : [ "" ], "name" : [ "Keanu Reeves" ], "personId" : [ "keanu" ], "title" : [ "" ], "year" : [ "" ] } }, ... ] } }
Status code: 400
Example response (failed request)Http Status Code: 400 { "errorMessage": "graph [test] is not found", "errorCode": "GES.8808" }
- Asynchronous call
Example response (successful request)
{ "jobId": "aca63a57-55f9-4c6e-932f-bcd6b87f7ab4", "jobType": 1 }
Status code: 400
Example response (failed request)
Http Status Code: 400 { "errorMessage": "executionMode is not correct, it should be sync or async", "errorCode": "GES.8808" }
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. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot