Analyzing Graphs Using HyG Algorithms
GES offers a range of fundamental graph algorithms, graph analysis algorithms, and graph metric algorithms. These algorithms can be used for analyzing relationships within a graph.
Prerequisites
The HyG computing engine slider was toggled on when creating a graph of the database edition.
Procedure
- Create a HyG graph.
- Send POST /ges/v1.0/{project_id}/hyg/{graph_name}. project_id indicates the project ID, and graph_name indicates the name of a graph created in the graph database.
- Add X-Auth-Token to the request header.
- Specify the following parameters in the request body:
{ "inEdge": true // Whether the graph contains the incoming edge }
- Check the response. The request is successful if the following response is displayed:
{ "result": "success" }
If the request is abnormal, locate the fault by referring to Error Codes for Service Plane APIs.
- Synchronize data from the graph database to the HyG computing engine.
- Send POST /ges/v1.0/{project_id}/hyg/{graph_name}/sync. project_id indicates the project ID, and graph_name indicates the graph name.
- Add X-Auth-Token to the request header.
- Specify the following parameters in the request body:
{ "vertex": [], // Vertex property list "edge": [ { "property": [ "Rating" ], "label": "rate" } ] // Edge property list }
- Check the response based on the job ID. The request is successful if the following response is displayed:
{ "status": "complete", "result": "success" }
If the request is abnormal, locate the fault by referring to Error Codes for Service Plane APIs.
With this API, you can synchronize any changes made to the graph database, whether it be adding, deleting, or modifying data, to the HyG computing engine. During the initial data synchronization, the vertex and edge parameters specified in the request body will be applied. For subsequent synchronizations, these parameters will default to the values specified during the first synchronization.
- Check details about the HyG graph.
- Send GET /ges/v1.0/{project_id}/hyg/{graph_name}/summary. project_id indicates the project ID, and graph_name indicates the graph name.
- Add X-Auth-Token to the request header.
- Check the response. The request is successful if the following response is displayed:
{ "data": { "inEdge": true, "idIndex": true, "policy": "oec", "updateTime": "2024-01-25 10:55:31", "vertex": [], "edge": [ { "label": "rate", "property": [ "Rating" ] } ], "vertexNum": 146, "edgeNum": 1659 }, "result": "success" }
If the request is abnormal, locate the fault by referring to Error Codes for Service Plane APIs.
- Execute the algorithm.
- Send POST /ges/v1.0/{project_id}/hyg/{graph_name}/algorithm. project_id indicates the project ID, and graph_name indicates the graph name.
- Add X-Auth-Token to the request header.
- Specify the following parameters in the request body (using PageRank as an example):
{ "algorithmName":"pagerank", "parameters":{ "alpha":0.85, "convergence":0.00001, "max_iterations":1000, "directed":true } }
- Check the response based on the job ID. The request is successful if the following response is displayed:
{ "status": "complete", "data": { "outputs": { "data_offset": 0, "data_return_size": 147, "data_total_size": 147, "pagerank": [ { "38": 0.02115960730038959 }, { "13": 0.018535705068819635 }, { "7": 0.0166381431701182 }, ... ... ], "runtime": 0.022 } }, "result": "success" }
If the request is abnormal, locate the fault by referring to Error Codes for Service Plane APIs.
- Delete the HyG graph.
- Send DELETE /ges/v1.0/{project_id}/hyg/{graph_name}. project_id indicates the project ID, and graph_name indicates the graph name.
- Add X-Auth-Token to the request header.
- Check the response based on the job ID. The request is successful if the following response is displayed:
{ "status": "complete", "result": "success" }
If the request is abnormal, locate the fault by referring to Error Codes for Service Plane APIs.
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