-
Notifications
You must be signed in to change notification settings - Fork 119
docs: Add Algorithm Job REST API documentation #458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,99 @@ | ||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||
| title: "算法 API" | ||||||||||||||||||||||||||||||||||||||
| linkTitle: "算法" | ||||||||||||||||||||||||||||||||||||||
| weight: 11 | ||||||||||||||||||||||||||||||||||||||
| description: "算法任务 REST API:提交和监控异步图算法任务。" | ||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ### 6.1 算法 | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| 算法 API 允许提交长时间运行的图算法作为异步任务并跟踪其进度。 | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| #### 6.1.1 提交算法任务 | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
| weight: 11 | |
| description: "算法任务 REST API:提交和监控异步图算法任务。" | |
| --- | |
| ### 6.1 算法 | |
| 算法 API 允许提交长时间运行的图算法作为异步任务并跟踪其进度。 | |
| #### 6.1.1 提交算法任务 | |
| weight: 12 | |
| description: "算法任务 REST API:提交和监控异步图算法任务。" | |
| --- | |
| ### 6.2 算法 | |
| 算法 API 允许提交长时间运行的图算法作为异步任务并跟踪其进度。 | |
| #### 6.2.1 提交算法任务 |
Copilot
AI
Apr 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In CN docs this link points to the non-localized /docs/... path. Please use /cn/docs/clients/restful-api/task (or a relative link like ./task) so Chinese pages don’t redirect to the English site.
| 响应仅包含任务 ID。使用 [任务 API](/docs/clients/restful-api/task) 监控任务。 | |
| #### 6.1.2 监控算法任务 | |
| 使用 [任务 API](/docs/clients/restful-api/task) 检查算法任务的状态: | |
| 响应仅包含任务 ID。使用 [任务 API](./task) 监控任务。 | |
| #### 6.1.2 监控算法任务 | |
| 使用 [任务 API](./task) 检查算法任务的状态: |
Copilot
AI
Apr 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vertices query example uses filter=properties.{property_name}, but the Vertices API uses the properties={...} query parameter (see vertex.md “Get Vertices that Meet the Criteria”). This example should be updated to a valid format.
| GET http://localhost:8080/graphspaces/DEFAULT/graphs/{graph}/graph/vertices?filter=properties.{property_name} | |
| GET http://localhost:8080/graphspaces/DEFAULT/graphs/{graph}/graph/vertices?properties={"{property_name}":"{property_value}"} |
Copilot
AI
Apr 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result property table is malformed because rows start with || instead of |, which breaks Markdown rendering. Please switch to standard Markdown table syntax.
Copilot
AI
Apr 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In CN docs these links point to the non-localized /docs/... path. Please use /cn/docs/quickstart/computing/hugegraph-computer and /cn/docs/quickstart/computing/hugegraph-vermeer so navigation stays within the Chinese docs.
| 对于非常大的图(数百万+个顶点/边),考虑使用 [HugeGraph-Computer](/docs/quickstart/computing/hugegraph-computer) 或 [HugeGraph-Vermeer](/docs/quickstart/computing/hugegraph-vermeer) 进行分布式计算,而不是 REST API。 | |
| 对于非常大的图(数百万+个顶点/边),考虑使用 [HugeGraph-Computer](/cn/docs/quickstart/computing/hugegraph-computer) 或 [HugeGraph-Vermeer](/cn/docs/quickstart/computing/hugegraph-vermeer) 进行分布式计算,而不是 REST API。 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| --- | ||
| title: "Algorithm API" | ||
| linkTitle: "Algorithm" | ||
| weight: 11 | ||
| description: "Algorithm Job REST API: Submit and monitor asynchronous graph algorithm jobs." | ||
| --- | ||
|
|
||
| ### 6.1 Algorithm | ||
|
||
|
|
||
| The Algorithm API allows you to submit long-running graph algorithms as asynchronous jobs and track their progress. | ||
|
|
||
| #### 6.1.1 Submit an Algorithm Job | ||
|
|
||
| ##### Method & Url | ||
|
|
||
| ``` | ||
| POST http://localhost:8080/graphspaces/DEFAULT/graphs/{graph}/jobs/algorithm/{algorithm_name} | ||
| ``` | ||
|
|
||
| For legacy setups without graphspaces: | ||
|
morningstarxcdcode marked this conversation as resolved.
|
||
| ``` | ||
| POST http://localhost:8080/graphs/{graph}/jobs/algorithm/{algorithm_name} | ||
| ``` | ||
|
morningstarxcdcode marked this conversation as resolved.
|
||
|
|
||
| ##### Request Body | ||
|
|
||
| The request body varies by algorithm. Common parameters include: | ||
|
morningstarxcdcode marked this conversation as resolved.
|
||
|
|
||
| - `max_iteration`: Maximum number of iterations (used by iterative algorithms like LPA) | ||
| - `alpha`: Damping factor for PageRank (default: 0.85) | ||
| - `sample_rate`: Sampling rate for algorithms like betweenness_centrality (0-1) | ||
| - `direction`: Edge direction for traversal (OUT, IN, or BOTH) | ||
|
|
||
| ##### Example: Submit a PageRank Job | ||
|
|
||
| ```json | ||
| { | ||
| "alpha": 0.85, | ||
| "max_iteration": 20 | ||
| } | ||
| ``` | ||
|
|
||
| ##### Response Status | ||
|
|
||
| ```json | ||
| 201 | ||
| ``` | ||
|
|
||
| ##### Response Body | ||
|
|
||
| ```json | ||
| { | ||
| "task_id": 1 | ||
| } | ||
| ``` | ||
|
|
||
| The response contains only the task ID. Use the [Task API](/docs/clients/restful-api/task) to monitor the job. | ||
|
|
||
| #### 6.1.2 Monitor Algorithm Job | ||
|
|
||
| Use the [Task API](/docs/clients/restful-api/task) to check the status of an algorithm job: | ||
|
|
||
| ``` | ||
| GET http://localhost:8080/graphspaces/DEFAULT/graphs/{graph}/tasks/{task_id} | ||
| ``` | ||
|
|
||
| #### 6.1.3 Retrieve Algorithm Results | ||
|
|
||
| Once the job completes (task_status = "success"), algorithm results are stored as vertex properties. Query vertices to access the results: | ||
|
|
||
| ``` | ||
| GET http://localhost:8080/graphspaces/DEFAULT/graphs/{graph}/graph/vertices?filter=properties.{property_name} | ||
| ``` | ||
|
||
|
|
||
| Common result property names by algorithm: | ||
|
|
||
| | Algorithm | Result Property | | ||
| |-----------|-----------------| | ||
| | pagerank | `page_rank` | | ||
| | lpa | `community` | | ||
| | wcc | `component` | | ||
| | degree_centrality | `degree` | | ||
| | closeness_centrality | `closeness` | | ||
| | betweenness_centrality | `betweenness` | | ||
| | triangle_count | `triangles` | | ||
|
||
|
|
||
| #### 6.1.4 Supported Algorithms | ||
|
|
||
| - `pagerank`: Compute vertex importance scores | ||
| - `lpa`: Label Propagation Algorithm for community detection | ||
| - `wcc`: Weakly Connected Components | ||
| - `degree_centrality`: Vertex connectivity measure | ||
| - `closeness_centrality`: Average distance to other vertices | ||
| - `betweenness_centrality`: Vertex importance based on shortest paths | ||
| - `triangle_count`: Count triangles in the graph | ||
|
|
||
| #### 6.1.5 Performance Considerations | ||
|
|
||
| For very large graphs (millions+ vertices/edges), consider using [HugeGraph-Computer](/docs/quickstart/computing/hugegraph-computer) or [HugeGraph-Vermeer](/docs/quickstart/computing/hugegraph-vermeer) for distributed computation instead of the REST API. | ||
|
morningstarxcdcode marked this conversation as resolved.
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CN SUMMARY navigation uses English labels for all RESTful API entries; adding
算法here is inconsistent with the established pattern in this file. Consider naming itAlgorithm(matching the surrounding entries) unless you intend to localize the entire SUMMARY list.