HugeGraphServer provides a RESTful API interface for the HugeGraph graph database. In addition to the basic CRUD operations for vertices and edges, it also offers several traversal methods, which we refer to as the traverser API. These traversal methods implement various complex graph algorithms, making it convenient for users to analyze and explore the graph.
The Traverser API supported by HugeGraph includes:
K-out API: It finds neighbors that are exactly N steps away from a given starting vertex. There are two versions:
The basic version uses the GET method to find neighbors that are exactly N steps away from a given starting vertex.
The advanced version uses the POST method to find neighbors that are exactly N steps away from a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge properties
Supports returning the shortest path to reach the neighbor
K-neighbor API: It finds all neighbors that are within N steps of a given starting vertex. There are two versions:
The basic version uses the GET method to find all neighbors that are within N steps of a given starting vertex.
The advanced version uses the POST method to find all neighbors that are within N steps of a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge properties
Supports returning the shortest path to reach the neighbor
Same Neighbors: It queries the common neighbors of two vertices.
Jaccard Similarity API: It calculates the Jaccard similarity, which includes two types:
One type uses the GET method to calculate the similarity (intersection over union) of neighbors between two vertices.
The other type uses the POST method to find the top N vertices with the highest Jaccard similarity to a given starting vertex in the entire graph.
Shortest Path API: It finds the shortest path between two vertices.
All Shortest Paths: It finds all shortest paths between two vertices.
Weighted Shortest Path: It finds the shortest weighted path from a starting vertex to a target vertex.
Single Source Shortest Path: It finds the weighted shortest path from a single source vertex to all other vertices.
Multi Node Shortest Path: It finds the shortest path between every pair of specified vertices.
Paths API: It finds all paths between two vertices. There are two versions:
The basic version uses the GET method to find all paths between a given starting vertex and an ending vertex.
The advanced version uses the POST method to find all paths that meet certain conditions between a set of starting vertices and a set of ending vertices.
3.2 Detailed Explanation of Traverser API
In the following, we provide a detailed explanation of the Traverser API:
Customized Paths API: It traverses all paths that pass through a batch of vertices according to a specific pattern.
Template Path API: It specifies a starting point, an ending point, and the path information between them to find matching paths.
Crosspoints API: It finds the intersection (common ancestors or common descendants) between two vertices.
Customized Crosspoints API: It traverses multiple patterns starting from a batch of vertices and finds the intersections with the vertices reached in the final step.
Rings API: It finds the cyclic paths that can be reached from a starting vertex.
Rays API: It finds the paths from a starting vertex that reach the boundaries (i.e., paths without cycles).
Fusiform Similarity API: It finds the fusiform similar vertices to a given vertex.
Vertices API:
Batch querying vertices by ID.
Getting the partitions of vertices.
Querying vertices by partition.
Edges API:
Batch querying edges by ID.
Getting the partitions of edges.
Querying edges by partition.
3.2 Detailed Explanation of Traverser API
The usage examples provided in this section are based on the graph presented on the TinkerPop official website:
The data import program is as follows:
publicclassLoader{
+
5.1.9 - Traverser API
3.1 Overview of Traverser API
HugeGraphServer provides a RESTful API interface for the HugeGraph graph database. In addition to the basic CRUD operations for vertices and edges, it also offers several traversal methods, which we refer to as the traverser API. These traversal methods implement various complex graph algorithms, making it convenient for users to analyze and explore the graph.
The Traverser API supported by HugeGraph includes:
K-out API: It finds neighbors that are exactly N steps away from a given starting vertex. There are two versions:
The basic version uses the GET method to find neighbors that are exactly N steps away from a given starting vertex.
The advanced version uses the POST method to find neighbors that are exactly N steps away from a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge and vertex properties
Supports returning the shortest path to reach the neighbor
K-neighbor API: It finds all neighbors that are within N steps of a given starting vertex. There are two versions:
The basic version uses the GET method to find all neighbors that are within N steps of a given starting vertex.
The advanced version uses the POST method to find all neighbors that are within N steps of a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge and vertex properties
Supports returning the shortest path to reach the neighbor
Same Neighbors: It queries the common neighbors of two vertices.
Jaccard Similarity API: It calculates the Jaccard similarity, which includes two types:
One type uses the GET method to calculate the similarity (intersection over union) of neighbors between two vertices.
The other type uses the POST method to find the top N vertices with the highest Jaccard similarity to a given starting vertex in the entire graph.
Shortest Path API: It finds the shortest path between two vertices.
All Shortest Paths: It finds all shortest paths between two vertices.
Weighted Shortest Path: It finds the shortest weighted path from a starting vertex to a target vertex.
Single Source Shortest Path: It finds the weighted shortest path from a single source vertex to all other vertices.
Multi Node Shortest Path: It finds the shortest path between every pair of specified vertices.
Paths API: It finds all paths between two vertices. There are two versions:
The basic version uses the GET method to find all paths between a given starting vertex and an ending vertex.
The advanced version uses the POST method to find all paths that meet certain conditions between a set of starting vertices and a set of ending vertices.
3.2 Detailed Explanation of Traverser API
In the following, we provide a detailed explanation of the Traverser API:
Customized Paths API: It traverses all paths that pass through a batch of vertices according to a specific pattern.
Template Path API: It specifies a starting point, an ending point, and the path information between them to find matching paths.
Crosspoints API: It finds the intersection (common ancestors or common descendants) between two vertices.
Customized Crosspoints API: It traverses multiple patterns starting from a batch of vertices and finds the intersections with the vertices reached in the final step.
Rings API: It finds the cyclic paths that can be reached from a starting vertex.
Rays API: It finds the paths from a starting vertex that reach the boundaries (i.e., paths without cycles).
Fusiform Similarity API: It finds the fusiform similar vertices to a given vertex.
Vertices API:
Batch querying vertices by ID.
Getting the partitions of vertices.
Querying vertices by partition.
Edges API:
Batch querying edges by ID.
Getting the partitions of edges.
Querying edges by partition.
3.2 Detailed Explanation of Traverser API
The usage examples provided in this section are based on the graph presented on the TinkerPop official website:
Finding vertices that are exactly N steps away in a relationship. Two examples:
In a family relationship, finding all grandchildren of a person. The set of vertices that can be reached by person A through two consecutive “son” edges.
Discovering potential friends in a social network. For example, finding users who are two degrees of friendship away from the target user, reachable through two consecutive “friend” edges.
3.2.2 K-out API (POST, Advanced Version)
3.2.2.1 Functionality Overview
The K-out API allows you to find vertices that are exactly “depth” steps away from a given starting vertex, considering the specified steps (including direction, edge type, and attribute filtering).
The advanced version differs from the basic version of K-out API in the following aspects:
Supports counting the number of neighbors only
Supports edge attribute filtering
Supports returning the shortest path to the neighbor
Params
source: The ID of the starting vertex, required.
Step from the starting point, required, with the following structure:
direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.
labels: List of edge types.
properties: Filters edges based on property values.
max_degree: Maximum number of adjacent edges to traverse for a single vertex, default is 10000 (Note: Prior to version 0.12, the parameter name was “degree” instead of “max_degree”. Starting from version 0.12, “max_degree” is used uniformly, while still supporting the “degree” syntax for backward compatibility).
skip_degree: Sets the minimum number of edges to skip super vertices during the query process. If the number of adjacent edges for a vertex is greater than skip_degree, the vertex is completely skipped. Optional. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), indicating no skipping of any vertices (Note: Enabling this configuration means that during traversal, an attempt will be made to access skip_degree edges of a vertex, not just max_degree edges. This incurs additional traversal overhead and may have a significant impact on query performance. Please enable it only after understanding the implications).
max_depth: Number of steps, required.
nearest: When nearest is true, it means the shortest path length from the starting vertex to the result vertex is equal to depth, and there is no shorter path. When nearest is false, it means there is a path of length depth from the starting vertex to the result vertex (not necessarily the shortest and can contain cycles). Optional, default is true.
count_only: Boolean value, true indicates only counting the number of results without returning specific results, false indicates returning specific results. Default is false.
with_path: When true, it returns the shortest path from the starting vertex to each neighbor. When false, it does not return the shortest path. Optional, default is false.
with_vertex: Optional, default is false:
When true, the results include complete vertex information (all vertices in the path):
When with_path is true, it returns complete information of all vertices in all paths.
When with_path is false, it returns complete information of all neighbors.
When false, it only returns vertex IDs.
capacity: Maximum number of vertices to visit during traversal. Optional, default is 10000000.
limit: Maximum number of vertices to return. Optional, default is 10000000.
3.2.2.2 Usage
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kout
+
3.2.1.3 Use Cases
Finding vertices that are exactly N steps away in a relationship. Two examples:
In a family relationship, finding all grandchildren of a person. The set of vertices that can be reached by person A through two consecutive “son” edges.
Discovering potential friends in a social network. For example, finding users who are two degrees of friendship away from the target user, reachable through two consecutive “friend” edges.
3.2.2 K-out API (POST, Advanced Version)
3.2.2.1 Functionality Overview
The K-out API allows you to find vertices that are exactly “depth” steps away from a given starting vertex, considering the specified steps (including direction, edge type, and attribute filtering).
The advanced version differs from the basic version of K-out API in the following aspects:
Supports counting the number of neighbors only
Supports edge attribute filtering
Supports returning the shortest path to the neighbor
Params
source: The ID of the starting vertex, required.
steps: Steps from the starting point, required, with the following structure:
direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.
edge_steps: The step set of edges, supporting label and properties filtering for the edge. If edge_steps is empty, the edge is not filtered.
label: Edge types.
properties: Filter edges based on property values.
vertex_steps: The step set of vertices, supporting label and properties filtering for the vertex. If vertex_steps is empty, the vertex is not filtered.
label: Vertex types.
properties: Filter vertices based on property values.
max_degree: Maximum number of adjacent edges to traverse for a single vertex, default is 10000 (Note: Prior to version 0.12, the parameter name was “degree” instead of “max_degree”. Starting from version 0.12, “max_degree” is used uniformly, while still supporting the “degree” syntax for backward compatibility).
skip_degree: Sets the minimum number of edges to skip super vertices during the query process. If the number of adjacent edges for a vertex is greater than skip_degree, the vertex is completely skipped. Optional. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), indicating no skipping of any vertices (Note: Enabling this configuration means that during traversal, an attempt will be made to access skip_degree edges of a vertex, not just max_degree edges. This incurs additional traversal overhead and may have a significant impact on query performance. Please enable it only after understanding the implications).
max_depth: Number of steps, required.
nearest: When nearest is true, it means the shortest path length from the starting vertex to the result vertex is equal to depth, and there is no shorter path. When nearest is false, it means there is a path of length depth from the starting vertex to the result vertex (not necessarily the shortest and can contain cycles). Optional, default is true.
count_only: Boolean value, true indicates only counting the number of results without returning specific results, false indicates returning specific results. Default is false.
with_path: When true, it returns the shortest path from the starting vertex to each neighbor. When false, it does not return the shortest path. Optional, default is false.
with_edge: Optional parameter, default is false:
When true, the result will include complete edge information (all edges in the path):
When with_path is true, it returns complete information of all edges in all paths.
When with_path is false, no information is returned.
When false, it only returns edge IDs.
with_vertex: Optional parameter, default is false:
When true, the result will include complete vertex information (all vertices in the path):
When with_path is true, it returns complete information of all vertices in all paths.
When with_path is false, it returns complete information of all neighbors.
When false, it only returns vertex IDs.
capacity: Maximum number of vertices to visit during traversal. Optional, default is 10000000.
limit: Maximum number of vertices to return. Optional, default is 10000000.
traverse_mode: Traversal mode. There are two options: “breadth_first_search” and “depth_first_search”, default is “breadth_first_search”.
3.2.2.2 Usage
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kout
Find all vertices that are reachable within depth steps, including the starting vertex, based on the starting vertex, direction, edge type (optional), and depth.
Equivalent to the union of: starting vertex, K-out(1), K-out(2), …, K-out(max_depth).
Params
source: ID of the starting vertex, required.
direction: Direction in which the starting vertex’s edges extend (OUT, IN, BOTH). Optional, default is BOTH.
max_depth: Number of steps, required.
label: Edge type, optional, default represents all edge labels.
max_degree: Maximum number of adjacent edges to traverse for a single vertex during the query process. Optional, default is 10000.
limit: Maximum number of vertices to return, also represents the maximum number of vertices to visit during traversal. Optional, default is 10000000.
3.2.3.2 Usage
Method & Url
GET http://localhost:8080/graphs/{graph}/traversers/kneighbor?source=“1:marko”&max_depth=2
@@ -3476,70 +3510,81 @@
"2:lop"]}
-
3.2.3.3 Use Cases
Find all vertices reachable within N steps, for example:
In a family relationship, find all descendants within five generations of a person. This can be achieved by traversing five consecutive “parent-child” edges from person A.
In a social network, discover friend circles. For example, users who can be reached by 1, 2, or 3 “friend” edges from the target user can form the target user’s friend circle.
3.2.4 K-neighbor API (POST, Advanced Version)
3.2.4.1 Function Introduction
Find all vertices that are reachable within depth steps from the starting vertex, based on the starting vertex, steps (including direction, edge type, and filter properties), and depth.
The difference from the Basic Version of K-neighbor API is that:
It supports counting the number of neighbors only.
It supports filtering edges based on their properties.
It supports returning the shortest path to reach the neighbors.
Params
source: Starting vertex ID, required.
Step from the starting point, required, with the following structure:
direction: Represents the direction of edges (OUT, IN, BOTH). Default is BOTH.
labels: List of edge types.
properties: Filter edges based on property values.
max_degree: Maximum number of adjacent edges to traverse for each vertex during the query process. Default is 10000. (Note: Before version 0.12, the parameter name within the step only supported “degree.” Starting from version 0.12, it is unified as “max_degree” and is backward compatible with the “degree” notation.)
skip_degree: Used to set the minimum number of edges to discard super vertices during the query process. When the number of adjacent edges for a vertex exceeds skip_degree, the vertex is completely discarded. This is an optional parameter. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), which means no vertices are skipped. (Note: When this configuration is enabled, the traversal will attempt to access skip_degree edges for each vertex, not just max_degree edges. This incurs additional traversal overhead and may significantly impact query performance. Please make sure to understand this before enabling.)
max_depth: Number of steps, required.
count_only: Boolean value. If true, only the count of results is returned without the actual results. If false, the specific results are returned. Default is false.
with_path: If true, the shortest path from the starting point to each neighbor is returned. If false, the shortest path from the starting point to each neighbor is not returned. This is an optional parameter. Default is false.
with_vertex: Optional parameter, default is false:
If true, the results include complete vertex information (all vertices in the path).
When with_path is true, it returns complete information of all vertices in the paths.
When with_path is false, it returns complete information of all neighbors.
If false, only the vertex ID is returned.
limit: Maximum number of vertices to be returned. Also, the maximum number of vertices visited during the traversal process. This is an optional parameter. Default is 10000000.
3.2.4.2 Usage Method
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kneighbor
+
3.2.3.3 Use Cases
Find all vertices reachable within N steps, for example:
In a family relationship, find all descendants within five generations of a person. This can be achieved by traversing five consecutive “parent-child” edges from person A.
In a social network, discover friend circles. For example, users who can be reached by 1, 2, or 3 “friend” edges from the target user can form the target user’s friend circle.
3.2.4 K-neighbor API (POST, Advanced Version)
3.2.4.1 Function Introduction
Find all vertices that are reachable within depth steps from the starting vertex, based on the starting vertex, steps (including direction, edge type, and filter properties), and depth.
The difference from the Basic Version of K-neighbor API is that:
It supports counting the number of neighbors only.
It supports filtering edges based on their properties.
It supports returning the shortest path to reach the neighbors.
Params
source: Starting vertex ID, required.
steps: Steps from the starting point, required, with the following structure:
direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.
edge_steps: The step set of edges, supporting label and properties filtering for the edge. If edge_steps is empty, the edge is not filtered.
label: Edge types.
properties: Filter edges based on property values.
vertex_steps: The step set of vertices, supporting label and properties filtering for the vertex. If vertex_steps is empty, the vertex is not filtered.
label: Vertex types.
properties: Filter vertices based on property values.
max_degree: Maximum number of adjacent edges to traverse for each vertex during the query process. Default is 10000. (Note: Before version 0.12, the parameter name within the step only supported “degree.” Starting from version 0.12, it is unified as “max_degree” and is backward compatible with the “degree” notation.)
skip_degree: Used to set the minimum number of edges to discard super vertices during the query process. When the number of adjacent edges for a vertex exceeds skip_degree, the vertex is completely discarded. This is an optional parameter. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), which means no vertices are skipped. (Note: When this configuration is enabled, the traversal will attempt to access skip_degree edges for each vertex, not just max_degree edges. This incurs additional traversal overhead and may significantly impact query performance. Please make sure to understand this before enabling.)
max_depth: Number of steps, required.
count_only: Boolean value. If true, only the count of results is returned without the actual results. If false, the specific results are returned. Default is false.
with_path: If true, the shortest path from the starting point to each neighbor is returned. If false, the shortest path from the starting point to each neighbor is not returned. This is an optional parameter. Default is false.
with_edge: Optional parameter, default is false:
When true, the result will include complete edge information (all edges in the path):
When with_path is true, it returns complete information of all edges in all paths.
When with_path is false, no information is returned.
When false, it only returns edge IDs.
with_vertex: Optional parameter, default is false:
When true, the result will include complete vertex information (all vertices in the path):
When with_path is true, it returns complete information of all vertices in all paths.
When with_path is false, it returns complete information of all neighbors.
When false, it only returns vertex IDs.
limit: Maximum number of vertices to be returned. Also, the maximum number of vertices visited during the traversal process. This is an optional parameter. Default is 10000000.
3.2.4.2 Usage Method
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kneighbor
HugeGraphServer provides a RESTful API interface for the HugeGraph graph database. In addition to the basic CRUD operations for vertices and edges, it also offers several traversal methods, which we refer to as the traverser API. These traversal methods implement various complex graph algorithms, making it convenient for users to analyze and explore the graph.
The Traverser API supported by HugeGraph includes:
K-out API: It finds neighbors that are exactly N steps away from a given starting vertex. There are two versions:
The basic version uses the GET method to find neighbors that are exactly N steps away from a given starting vertex.
The advanced version uses the POST method to find neighbors that are exactly N steps away from a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge properties
Supports returning the shortest path to reach the neighbor
K-neighbor API: It finds all neighbors that are within N steps of a given starting vertex. There are two versions:
The basic version uses the GET method to find all neighbors that are within N steps of a given starting vertex.
The advanced version uses the POST method to find all neighbors that are within N steps of a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge properties
Supports returning the shortest path to reach the neighbor
Same Neighbors: It queries the common neighbors of two vertices.
Jaccard Similarity API: It calculates the Jaccard similarity, which includes two types:
One type uses the GET method to calculate the similarity (intersection over union) of neighbors between two vertices.
The other type uses the POST method to find the top N vertices with the highest Jaccard similarity to a given starting vertex in the entire graph.
Shortest Path API: It finds the shortest path between two vertices.
All Shortest Paths: It finds all shortest paths between two vertices.
Weighted Shortest Path: It finds the shortest weighted path from a starting vertex to a target vertex.
Single Source Shortest Path: It finds the weighted shortest path from a single source vertex to all other vertices.
Multi Node Shortest Path: It finds the shortest path between every pair of specified vertices.
Paths API: It finds all paths between two vertices. There are two versions:
The basic version uses the GET method to find all paths between a given starting vertex and an ending vertex.
The advanced version uses the POST method to find all paths that meet certain conditions between a set of starting vertices and a set of ending vertices.
3.2 Detailed Explanation of Traverser API
In the following, we provide a detailed explanation of the Traverser API:
Customized Paths API: It traverses all paths that pass through a batch of vertices according to a specific pattern.
Template Path API: It specifies a starting point, an ending point, and the path information between them to find matching paths.
Crosspoints API: It finds the intersection (common ancestors or common descendants) between two vertices.
Customized Crosspoints API: It traverses multiple patterns starting from a batch of vertices and finds the intersections with the vertices reached in the final step.
Rings API: It finds the cyclic paths that can be reached from a starting vertex.
Rays API: It finds the paths from a starting vertex that reach the boundaries (i.e., paths without cycles).
Fusiform Similarity API: It finds the fusiform similar vertices to a given vertex.
Vertices API:
Batch querying vertices by ID.
Getting the partitions of vertices.
Querying vertices by partition.
Edges API:
Batch querying edges by ID.
Getting the partitions of edges.
Querying edges by partition.
3.2 Detailed Explanation of Traverser API
The usage examples provided in this section are based on the graph presented on the TinkerPop official website:
The data import program is as follows:
publicclassLoader{
+
1.9 - Traverser API
3.1 Overview of Traverser API
HugeGraphServer provides a RESTful API interface for the HugeGraph graph database. In addition to the basic CRUD operations for vertices and edges, it also offers several traversal methods, which we refer to as the traverser API. These traversal methods implement various complex graph algorithms, making it convenient for users to analyze and explore the graph.
The Traverser API supported by HugeGraph includes:
K-out API: It finds neighbors that are exactly N steps away from a given starting vertex. There are two versions:
The basic version uses the GET method to find neighbors that are exactly N steps away from a given starting vertex.
The advanced version uses the POST method to find neighbors that are exactly N steps away from a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge and vertex properties
Supports returning the shortest path to reach the neighbor
K-neighbor API: It finds all neighbors that are within N steps of a given starting vertex. There are two versions:
The basic version uses the GET method to find all neighbors that are within N steps of a given starting vertex.
The advanced version uses the POST method to find all neighbors that are within N steps of a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge and vertex properties
Supports returning the shortest path to reach the neighbor
Same Neighbors: It queries the common neighbors of two vertices.
Jaccard Similarity API: It calculates the Jaccard similarity, which includes two types:
One type uses the GET method to calculate the similarity (intersection over union) of neighbors between two vertices.
The other type uses the POST method to find the top N vertices with the highest Jaccard similarity to a given starting vertex in the entire graph.
Shortest Path API: It finds the shortest path between two vertices.
All Shortest Paths: It finds all shortest paths between two vertices.
Weighted Shortest Path: It finds the shortest weighted path from a starting vertex to a target vertex.
Single Source Shortest Path: It finds the weighted shortest path from a single source vertex to all other vertices.
Multi Node Shortest Path: It finds the shortest path between every pair of specified vertices.
Paths API: It finds all paths between two vertices. There are two versions:
The basic version uses the GET method to find all paths between a given starting vertex and an ending vertex.
The advanced version uses the POST method to find all paths that meet certain conditions between a set of starting vertices and a set of ending vertices.
3.2 Detailed Explanation of Traverser API
In the following, we provide a detailed explanation of the Traverser API:
Customized Paths API: It traverses all paths that pass through a batch of vertices according to a specific pattern.
Template Path API: It specifies a starting point, an ending point, and the path information between them to find matching paths.
Crosspoints API: It finds the intersection (common ancestors or common descendants) between two vertices.
Customized Crosspoints API: It traverses multiple patterns starting from a batch of vertices and finds the intersections with the vertices reached in the final step.
Rings API: It finds the cyclic paths that can be reached from a starting vertex.
Rays API: It finds the paths from a starting vertex that reach the boundaries (i.e., paths without cycles).
Fusiform Similarity API: It finds the fusiform similar vertices to a given vertex.
Vertices API:
Batch querying vertices by ID.
Getting the partitions of vertices.
Querying vertices by partition.
Edges API:
Batch querying edges by ID.
Getting the partitions of edges.
Querying edges by partition.
3.2 Detailed Explanation of Traverser API
The usage examples provided in this section are based on the graph presented on the TinkerPop official website:
Finding vertices that are exactly N steps away in a relationship. Two examples:
In a family relationship, finding all grandchildren of a person. The set of vertices that can be reached by person A through two consecutive “son” edges.
Discovering potential friends in a social network. For example, finding users who are two degrees of friendship away from the target user, reachable through two consecutive “friend” edges.
3.2.2 K-out API (POST, Advanced Version)
3.2.2.1 Functionality Overview
The K-out API allows you to find vertices that are exactly “depth” steps away from a given starting vertex, considering the specified steps (including direction, edge type, and attribute filtering).
The advanced version differs from the basic version of K-out API in the following aspects:
Supports counting the number of neighbors only
Supports edge attribute filtering
Supports returning the shortest path to the neighbor
Params
source: The ID of the starting vertex, required.
Step from the starting point, required, with the following structure:
direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.
labels: List of edge types.
properties: Filters edges based on property values.
max_degree: Maximum number of adjacent edges to traverse for a single vertex, default is 10000 (Note: Prior to version 0.12, the parameter name was “degree” instead of “max_degree”. Starting from version 0.12, “max_degree” is used uniformly, while still supporting the “degree” syntax for backward compatibility).
skip_degree: Sets the minimum number of edges to skip super vertices during the query process. If the number of adjacent edges for a vertex is greater than skip_degree, the vertex is completely skipped. Optional. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), indicating no skipping of any vertices (Note: Enabling this configuration means that during traversal, an attempt will be made to access skip_degree edges of a vertex, not just max_degree edges. This incurs additional traversal overhead and may have a significant impact on query performance. Please enable it only after understanding the implications).
max_depth: Number of steps, required.
nearest: When nearest is true, it means the shortest path length from the starting vertex to the result vertex is equal to depth, and there is no shorter path. When nearest is false, it means there is a path of length depth from the starting vertex to the result vertex (not necessarily the shortest and can contain cycles). Optional, default is true.
count_only: Boolean value, true indicates only counting the number of results without returning specific results, false indicates returning specific results. Default is false.
with_path: When true, it returns the shortest path from the starting vertex to each neighbor. When false, it does not return the shortest path. Optional, default is false.
with_vertex: Optional, default is false:
When true, the results include complete vertex information (all vertices in the path):
When with_path is true, it returns complete information of all vertices in all paths.
When with_path is false, it returns complete information of all neighbors.
When false, it only returns vertex IDs.
capacity: Maximum number of vertices to visit during traversal. Optional, default is 10000000.
limit: Maximum number of vertices to return. Optional, default is 10000000.
3.2.2.2 Usage
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kout
+
3.2.1.3 Use Cases
Finding vertices that are exactly N steps away in a relationship. Two examples:
In a family relationship, finding all grandchildren of a person. The set of vertices that can be reached by person A through two consecutive “son” edges.
Discovering potential friends in a social network. For example, finding users who are two degrees of friendship away from the target user, reachable through two consecutive “friend” edges.
3.2.2 K-out API (POST, Advanced Version)
3.2.2.1 Functionality Overview
The K-out API allows you to find vertices that are exactly “depth” steps away from a given starting vertex, considering the specified steps (including direction, edge type, and attribute filtering).
The advanced version differs from the basic version of K-out API in the following aspects:
Supports counting the number of neighbors only
Supports edge attribute filtering
Supports returning the shortest path to the neighbor
Params
source: The ID of the starting vertex, required.
steps: Steps from the starting point, required, with the following structure:
direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.
edge_steps: The step set of edges, supporting label and properties filtering for the edge. If edge_steps is empty, the edge is not filtered.
label: Edge types.
properties: Filter edges based on property values.
vertex_steps: The step set of vertices, supporting label and properties filtering for the vertex. If vertex_steps is empty, the vertex is not filtered.
label: Vertex types.
properties: Filter vertices based on property values.
max_degree: Maximum number of adjacent edges to traverse for a single vertex, default is 10000 (Note: Prior to version 0.12, the parameter name was “degree” instead of “max_degree”. Starting from version 0.12, “max_degree” is used uniformly, while still supporting the “degree” syntax for backward compatibility).
skip_degree: Sets the minimum number of edges to skip super vertices during the query process. If the number of adjacent edges for a vertex is greater than skip_degree, the vertex is completely skipped. Optional. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), indicating no skipping of any vertices (Note: Enabling this configuration means that during traversal, an attempt will be made to access skip_degree edges of a vertex, not just max_degree edges. This incurs additional traversal overhead and may have a significant impact on query performance. Please enable it only after understanding the implications).
max_depth: Number of steps, required.
nearest: When nearest is true, it means the shortest path length from the starting vertex to the result vertex is equal to depth, and there is no shorter path. When nearest is false, it means there is a path of length depth from the starting vertex to the result vertex (not necessarily the shortest and can contain cycles). Optional, default is true.
count_only: Boolean value, true indicates only counting the number of results without returning specific results, false indicates returning specific results. Default is false.
with_path: When true, it returns the shortest path from the starting vertex to each neighbor. When false, it does not return the shortest path. Optional, default is false.
with_edge: Optional parameter, default is false:
When true, the result will include complete edge information (all edges in the path):
When with_path is true, it returns complete information of all edges in all paths.
When with_path is false, no information is returned.
When false, it only returns edge IDs.
with_vertex: Optional parameter, default is false:
When true, the result will include complete vertex information (all vertices in the path):
When with_path is true, it returns complete information of all vertices in all paths.
When with_path is false, it returns complete information of all neighbors.
When false, it only returns vertex IDs.
capacity: Maximum number of vertices to visit during traversal. Optional, default is 10000000.
limit: Maximum number of vertices to return. Optional, default is 10000000.
traverse_mode: Traversal mode. There are two options: “breadth_first_search” and “depth_first_search”, default is “breadth_first_search”.
3.2.2.2 Usage
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kout
Find all vertices that are reachable within depth steps, including the starting vertex, based on the starting vertex, direction, edge type (optional), and depth.
Equivalent to the union of: starting vertex, K-out(1), K-out(2), …, K-out(max_depth).
Params
source: ID of the starting vertex, required.
direction: Direction in which the starting vertex’s edges extend (OUT, IN, BOTH). Optional, default is BOTH.
max_depth: Number of steps, required.
label: Edge type, optional, default represents all edge labels.
max_degree: Maximum number of adjacent edges to traverse for a single vertex during the query process. Optional, default is 10000.
limit: Maximum number of vertices to return, also represents the maximum number of vertices to visit during traversal. Optional, default is 10000000.
3.2.3.2 Usage
Method & Url
GET http://localhost:8080/graphs/{graph}/traversers/kneighbor?source=“1:marko”&max_depth=2
@@ -1687,70 +1721,81 @@
"2:lop"]}
-
3.2.3.3 Use Cases
Find all vertices reachable within N steps, for example:
In a family relationship, find all descendants within five generations of a person. This can be achieved by traversing five consecutive “parent-child” edges from person A.
In a social network, discover friend circles. For example, users who can be reached by 1, 2, or 3 “friend” edges from the target user can form the target user’s friend circle.
3.2.4 K-neighbor API (POST, Advanced Version)
3.2.4.1 Function Introduction
Find all vertices that are reachable within depth steps from the starting vertex, based on the starting vertex, steps (including direction, edge type, and filter properties), and depth.
The difference from the Basic Version of K-neighbor API is that:
It supports counting the number of neighbors only.
It supports filtering edges based on their properties.
It supports returning the shortest path to reach the neighbors.
Params
source: Starting vertex ID, required.
Step from the starting point, required, with the following structure:
direction: Represents the direction of edges (OUT, IN, BOTH). Default is BOTH.
labels: List of edge types.
properties: Filter edges based on property values.
max_degree: Maximum number of adjacent edges to traverse for each vertex during the query process. Default is 10000. (Note: Before version 0.12, the parameter name within the step only supported “degree.” Starting from version 0.12, it is unified as “max_degree” and is backward compatible with the “degree” notation.)
skip_degree: Used to set the minimum number of edges to discard super vertices during the query process. When the number of adjacent edges for a vertex exceeds skip_degree, the vertex is completely discarded. This is an optional parameter. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), which means no vertices are skipped. (Note: When this configuration is enabled, the traversal will attempt to access skip_degree edges for each vertex, not just max_degree edges. This incurs additional traversal overhead and may significantly impact query performance. Please make sure to understand this before enabling.)
max_depth: Number of steps, required.
count_only: Boolean value. If true, only the count of results is returned without the actual results. If false, the specific results are returned. Default is false.
with_path: If true, the shortest path from the starting point to each neighbor is returned. If false, the shortest path from the starting point to each neighbor is not returned. This is an optional parameter. Default is false.
with_vertex: Optional parameter, default is false:
If true, the results include complete vertex information (all vertices in the path).
When with_path is true, it returns complete information of all vertices in the paths.
When with_path is false, it returns complete information of all neighbors.
If false, only the vertex ID is returned.
limit: Maximum number of vertices to be returned. Also, the maximum number of vertices visited during the traversal process. This is an optional parameter. Default is 10000000.
3.2.4.2 Usage Method
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kneighbor
+
3.2.3.3 Use Cases
Find all vertices reachable within N steps, for example:
In a family relationship, find all descendants within five generations of a person. This can be achieved by traversing five consecutive “parent-child” edges from person A.
In a social network, discover friend circles. For example, users who can be reached by 1, 2, or 3 “friend” edges from the target user can form the target user’s friend circle.
3.2.4 K-neighbor API (POST, Advanced Version)
3.2.4.1 Function Introduction
Find all vertices that are reachable within depth steps from the starting vertex, based on the starting vertex, steps (including direction, edge type, and filter properties), and depth.
The difference from the Basic Version of K-neighbor API is that:
It supports counting the number of neighbors only.
It supports filtering edges based on their properties.
It supports returning the shortest path to reach the neighbors.
Params
source: Starting vertex ID, required.
steps: Steps from the starting point, required, with the following structure:
direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.
edge_steps: The step set of edges, supporting label and properties filtering for the edge. If edge_steps is empty, the edge is not filtered.
label: Edge types.
properties: Filter edges based on property values.
vertex_steps: The step set of vertices, supporting label and properties filtering for the vertex. If vertex_steps is empty, the vertex is not filtered.
label: Vertex types.
properties: Filter vertices based on property values.
max_degree: Maximum number of adjacent edges to traverse for each vertex during the query process. Default is 10000. (Note: Before version 0.12, the parameter name within the step only supported “degree.” Starting from version 0.12, it is unified as “max_degree” and is backward compatible with the “degree” notation.)
skip_degree: Used to set the minimum number of edges to discard super vertices during the query process. When the number of adjacent edges for a vertex exceeds skip_degree, the vertex is completely discarded. This is an optional parameter. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), which means no vertices are skipped. (Note: When this configuration is enabled, the traversal will attempt to access skip_degree edges for each vertex, not just max_degree edges. This incurs additional traversal overhead and may significantly impact query performance. Please make sure to understand this before enabling.)
max_depth: Number of steps, required.
count_only: Boolean value. If true, only the count of results is returned without the actual results. If false, the specific results are returned. Default is false.
with_path: If true, the shortest path from the starting point to each neighbor is returned. If false, the shortest path from the starting point to each neighbor is not returned. This is an optional parameter. Default is false.
with_edge: Optional parameter, default is false:
When true, the result will include complete edge information (all edges in the path):
When with_path is true, it returns complete information of all edges in all paths.
When with_path is false, no information is returned.
When false, it only returns edge IDs.
with_vertex: Optional parameter, default is false:
When true, the result will include complete vertex information (all vertices in the path):
When with_path is true, it returns complete information of all vertices in all paths.
When with_path is false, it returns complete information of all neighbors.
When false, it only returns vertex IDs.
limit: Maximum number of vertices to be returned. Also, the maximum number of vertices visited during the traversal process. This is an optional parameter. Default is 10000000.
3.2.4.2 Usage Method
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kneighbor
HugeGraphServer provides a RESTful API interface for the HugeGraph graph database. In addition to the basic CRUD operations for vertices and edges, it also offers several traversal methods, which we refer to as the traverser API. These traversal methods implement various complex graph algorithms, making it convenient for users to analyze and explore the graph.
The Traverser API supported by HugeGraph includes:
K-out API: It finds neighbors that are exactly N steps away from a given starting vertex. There are two versions:
The basic version uses the GET method to find neighbors that are exactly N steps away from a given starting vertex.
The advanced version uses the POST method to find neighbors that are exactly N steps away from a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge properties
Supports returning the shortest path to reach the neighbor
K-neighbor API: It finds all neighbors that are within N steps of a given starting vertex. There are two versions:
The basic version uses the GET method to find all neighbors that are within N steps of a given starting vertex.
The advanced version uses the POST method to find all neighbors that are within N steps of a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge properties
Supports returning the shortest path to reach the neighbor
Same Neighbors: It queries the common neighbors of two vertices.
Jaccard Similarity API: It calculates the Jaccard similarity, which includes two types:
One type uses the GET method to calculate the similarity (intersection over union) of neighbors between two vertices.
The other type uses the POST method to find the top N vertices with the highest Jaccard similarity to a given starting vertex in the entire graph.
Shortest Path API: It finds the shortest path between two vertices.
All Shortest Paths: It finds all shortest paths between two vertices.
Weighted Shortest Path: It finds the shortest weighted path from a starting vertex to a target vertex.
Single Source Shortest Path: It finds the weighted shortest path from a single source vertex to all other vertices.
Multi Node Shortest Path: It finds the shortest path between every pair of specified vertices.
Paths API: It finds all paths between two vertices. There are two versions:
The basic version uses the GET method to find all paths between a given starting vertex and an ending vertex.
The advanced version uses the POST method to find all paths that meet certain conditions between a set of starting vertices and a set of ending vertices.
3.2 Detailed Explanation of Traverser API
In the following, we provide a detailed explanation of the Traverser API:
Customized Paths API: It traverses all paths that pass through a batch of vertices according to a specific pattern.
Template Path API: It specifies a starting point, an ending point, and the path information between them to find matching paths.
Crosspoints API: It finds the intersection (common ancestors or common descendants) between two vertices.
Customized Crosspoints API: It traverses multiple patterns starting from a batch of vertices and finds the intersections with the vertices reached in the final step.
Rings API: It finds the cyclic paths that can be reached from a starting vertex.
Rays API: It finds the paths from a starting vertex that reach the boundaries (i.e., paths without cycles).
Fusiform Similarity API: It finds the fusiform similar vertices to a given vertex.
Vertices API:
Batch querying vertices by ID.
Getting the partitions of vertices.
Querying vertices by partition.
Edges API:
Batch querying edges by ID.
Getting the partitions of edges.
Querying edges by partition.
3.2 Detailed Explanation of Traverser API
The usage examples provided in this section are based on the graph presented on the TinkerPop official website:
The data import program is as follows:
publicclassLoader{
+
9 - Traverser API
3.1 Overview of Traverser API
HugeGraphServer provides a RESTful API interface for the HugeGraph graph database. In addition to the basic CRUD operations for vertices and edges, it also offers several traversal methods, which we refer to as the traverser API. These traversal methods implement various complex graph algorithms, making it convenient for users to analyze and explore the graph.
The Traverser API supported by HugeGraph includes:
K-out API: It finds neighbors that are exactly N steps away from a given starting vertex. There are two versions:
The basic version uses the GET method to find neighbors that are exactly N steps away from a given starting vertex.
The advanced version uses the POST method to find neighbors that are exactly N steps away from a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge and vertex properties
Supports returning the shortest path to reach the neighbor
K-neighbor API: It finds all neighbors that are within N steps of a given starting vertex. There are two versions:
The basic version uses the GET method to find all neighbors that are within N steps of a given starting vertex.
The advanced version uses the POST method to find all neighbors that are within N steps of a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge and vertex properties
Supports returning the shortest path to reach the neighbor
Same Neighbors: It queries the common neighbors of two vertices.
Jaccard Similarity API: It calculates the Jaccard similarity, which includes two types:
One type uses the GET method to calculate the similarity (intersection over union) of neighbors between two vertices.
The other type uses the POST method to find the top N vertices with the highest Jaccard similarity to a given starting vertex in the entire graph.
Shortest Path API: It finds the shortest path between two vertices.
All Shortest Paths: It finds all shortest paths between two vertices.
Weighted Shortest Path: It finds the shortest weighted path from a starting vertex to a target vertex.
Single Source Shortest Path: It finds the weighted shortest path from a single source vertex to all other vertices.
Multi Node Shortest Path: It finds the shortest path between every pair of specified vertices.
Paths API: It finds all paths between two vertices. There are two versions:
The basic version uses the GET method to find all paths between a given starting vertex and an ending vertex.
The advanced version uses the POST method to find all paths that meet certain conditions between a set of starting vertices and a set of ending vertices.
3.2 Detailed Explanation of Traverser API
In the following, we provide a detailed explanation of the Traverser API:
Customized Paths API: It traverses all paths that pass through a batch of vertices according to a specific pattern.
Template Path API: It specifies a starting point, an ending point, and the path information between them to find matching paths.
Crosspoints API: It finds the intersection (common ancestors or common descendants) between two vertices.
Customized Crosspoints API: It traverses multiple patterns starting from a batch of vertices and finds the intersections with the vertices reached in the final step.
Rings API: It finds the cyclic paths that can be reached from a starting vertex.
Rays API: It finds the paths from a starting vertex that reach the boundaries (i.e., paths without cycles).
Fusiform Similarity API: It finds the fusiform similar vertices to a given vertex.
Vertices API:
Batch querying vertices by ID.
Getting the partitions of vertices.
Querying vertices by partition.
Edges API:
Batch querying edges by ID.
Getting the partitions of edges.
Querying edges by partition.
3.2 Detailed Explanation of Traverser API
The usage examples provided in this section are based on the graph presented on the TinkerPop official website:
Finding vertices that are exactly N steps away in a relationship. Two examples:
In a family relationship, finding all grandchildren of a person. The set of vertices that can be reached by person A through two consecutive “son” edges.
Discovering potential friends in a social network. For example, finding users who are two degrees of friendship away from the target user, reachable through two consecutive “friend” edges.
3.2.2 K-out API (POST, Advanced Version)
3.2.2.1 Functionality Overview
The K-out API allows you to find vertices that are exactly “depth” steps away from a given starting vertex, considering the specified steps (including direction, edge type, and attribute filtering).
The advanced version differs from the basic version of K-out API in the following aspects:
Supports counting the number of neighbors only
Supports edge attribute filtering
Supports returning the shortest path to the neighbor
Params
source: The ID of the starting vertex, required.
Step from the starting point, required, with the following structure:
direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.
labels: List of edge types.
properties: Filters edges based on property values.
max_degree: Maximum number of adjacent edges to traverse for a single vertex, default is 10000 (Note: Prior to version 0.12, the parameter name was “degree” instead of “max_degree”. Starting from version 0.12, “max_degree” is used uniformly, while still supporting the “degree” syntax for backward compatibility).
skip_degree: Sets the minimum number of edges to skip super vertices during the query process. If the number of adjacent edges for a vertex is greater than skip_degree, the vertex is completely skipped. Optional. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), indicating no skipping of any vertices (Note: Enabling this configuration means that during traversal, an attempt will be made to access skip_degree edges of a vertex, not just max_degree edges. This incurs additional traversal overhead and may have a significant impact on query performance. Please enable it only after understanding the implications).
max_depth: Number of steps, required.
nearest: When nearest is true, it means the shortest path length from the starting vertex to the result vertex is equal to depth, and there is no shorter path. When nearest is false, it means there is a path of length depth from the starting vertex to the result vertex (not necessarily the shortest and can contain cycles). Optional, default is true.
count_only: Boolean value, true indicates only counting the number of results without returning specific results, false indicates returning specific results. Default is false.
with_path: When true, it returns the shortest path from the starting vertex to each neighbor. When false, it does not return the shortest path. Optional, default is false.
with_vertex: Optional, default is false:
When true, the results include complete vertex information (all vertices in the path):
When with_path is true, it returns complete information of all vertices in all paths.
When with_path is false, it returns complete information of all neighbors.
When false, it only returns vertex IDs.
capacity: Maximum number of vertices to visit during traversal. Optional, default is 10000000.
limit: Maximum number of vertices to return. Optional, default is 10000000.
3.2.2.2 Usage
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kout
+
3.2.1.3 Use Cases
Finding vertices that are exactly N steps away in a relationship. Two examples:
In a family relationship, finding all grandchildren of a person. The set of vertices that can be reached by person A through two consecutive “son” edges.
Discovering potential friends in a social network. For example, finding users who are two degrees of friendship away from the target user, reachable through two consecutive “friend” edges.
3.2.2 K-out API (POST, Advanced Version)
3.2.2.1 Functionality Overview
The K-out API allows you to find vertices that are exactly “depth” steps away from a given starting vertex, considering the specified steps (including direction, edge type, and attribute filtering).
The advanced version differs from the basic version of K-out API in the following aspects:
Supports counting the number of neighbors only
Supports edge attribute filtering
Supports returning the shortest path to the neighbor
Params
source: The ID of the starting vertex, required.
steps: Steps from the starting point, required, with the following structure:
direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.
edge_steps: The step set of edges, supporting label and properties filtering for the edge. If edge_steps is empty, the edge is not filtered.
label: Edge types.
properties: Filter edges based on property values.
vertex_steps: The step set of vertices, supporting label and properties filtering for the vertex. If vertex_steps is empty, the vertex is not filtered.
label: Vertex types.
properties: Filter vertices based on property values.
max_degree: Maximum number of adjacent edges to traverse for a single vertex, default is 10000 (Note: Prior to version 0.12, the parameter name was “degree” instead of “max_degree”. Starting from version 0.12, “max_degree” is used uniformly, while still supporting the “degree” syntax for backward compatibility).
skip_degree: Sets the minimum number of edges to skip super vertices during the query process. If the number of adjacent edges for a vertex is greater than skip_degree, the vertex is completely skipped. Optional. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), indicating no skipping of any vertices (Note: Enabling this configuration means that during traversal, an attempt will be made to access skip_degree edges of a vertex, not just max_degree edges. This incurs additional traversal overhead and may have a significant impact on query performance. Please enable it only after understanding the implications).
max_depth: Number of steps, required.
nearest: When nearest is true, it means the shortest path length from the starting vertex to the result vertex is equal to depth, and there is no shorter path. When nearest is false, it means there is a path of length depth from the starting vertex to the result vertex (not necessarily the shortest and can contain cycles). Optional, default is true.
count_only: Boolean value, true indicates only counting the number of results without returning specific results, false indicates returning specific results. Default is false.
with_path: When true, it returns the shortest path from the starting vertex to each neighbor. When false, it does not return the shortest path. Optional, default is false.
with_edge: Optional parameter, default is false:
When true, the result will include complete edge information (all edges in the path):
When with_path is true, it returns complete information of all edges in all paths.
When with_path is false, no information is returned.
When false, it only returns edge IDs.
with_vertex: Optional parameter, default is false:
When true, the result will include complete vertex information (all vertices in the path):
When with_path is true, it returns complete information of all vertices in all paths.
When with_path is false, it returns complete information of all neighbors.
When false, it only returns vertex IDs.
capacity: Maximum number of vertices to visit during traversal. Optional, default is 10000000.
limit: Maximum number of vertices to return. Optional, default is 10000000.
traverse_mode: Traversal mode. There are two options: “breadth_first_search” and “depth_first_search”, default is “breadth_first_search”.
3.2.2.2 Usage
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kout
Find all vertices that are reachable within depth steps, including the starting vertex, based on the starting vertex, direction, edge type (optional), and depth.
Equivalent to the union of: starting vertex, K-out(1), K-out(2), …, K-out(max_depth).
Params
source: ID of the starting vertex, required.
direction: Direction in which the starting vertex’s edges extend (OUT, IN, BOTH). Optional, default is BOTH.
max_depth: Number of steps, required.
label: Edge type, optional, default represents all edge labels.
max_degree: Maximum number of adjacent edges to traverse for a single vertex during the query process. Optional, default is 10000.
limit: Maximum number of vertices to return, also represents the maximum number of vertices to visit during traversal. Optional, default is 10000000.
3.2.3.2 Usage
Method & Url
GET http://localhost:8080/graphs/{graph}/traversers/kneighbor?source=“1:marko”&max_depth=2
@@ -1687,70 +1721,81 @@
"2:lop"]}
-
3.2.3.3 Use Cases
Find all vertices reachable within N steps, for example:
In a family relationship, find all descendants within five generations of a person. This can be achieved by traversing five consecutive “parent-child” edges from person A.
In a social network, discover friend circles. For example, users who can be reached by 1, 2, or 3 “friend” edges from the target user can form the target user’s friend circle.
3.2.4 K-neighbor API (POST, Advanced Version)
3.2.4.1 Function Introduction
Find all vertices that are reachable within depth steps from the starting vertex, based on the starting vertex, steps (including direction, edge type, and filter properties), and depth.
The difference from the Basic Version of K-neighbor API is that:
It supports counting the number of neighbors only.
It supports filtering edges based on their properties.
It supports returning the shortest path to reach the neighbors.
Params
source: Starting vertex ID, required.
Step from the starting point, required, with the following structure:
direction: Represents the direction of edges (OUT, IN, BOTH). Default is BOTH.
labels: List of edge types.
properties: Filter edges based on property values.
max_degree: Maximum number of adjacent edges to traverse for each vertex during the query process. Default is 10000. (Note: Before version 0.12, the parameter name within the step only supported “degree.” Starting from version 0.12, it is unified as “max_degree” and is backward compatible with the “degree” notation.)
skip_degree: Used to set the minimum number of edges to discard super vertices during the query process. When the number of adjacent edges for a vertex exceeds skip_degree, the vertex is completely discarded. This is an optional parameter. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), which means no vertices are skipped. (Note: When this configuration is enabled, the traversal will attempt to access skip_degree edges for each vertex, not just max_degree edges. This incurs additional traversal overhead and may significantly impact query performance. Please make sure to understand this before enabling.)
max_depth: Number of steps, required.
count_only: Boolean value. If true, only the count of results is returned without the actual results. If false, the specific results are returned. Default is false.
with_path: If true, the shortest path from the starting point to each neighbor is returned. If false, the shortest path from the starting point to each neighbor is not returned. This is an optional parameter. Default is false.
with_vertex: Optional parameter, default is false:
If true, the results include complete vertex information (all vertices in the path).
When with_path is true, it returns complete information of all vertices in the paths.
When with_path is false, it returns complete information of all neighbors.
If false, only the vertex ID is returned.
limit: Maximum number of vertices to be returned. Also, the maximum number of vertices visited during the traversal process. This is an optional parameter. Default is 10000000.
3.2.4.2 Usage Method
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kneighbor
+
3.2.3.3 Use Cases
Find all vertices reachable within N steps, for example:
In a family relationship, find all descendants within five generations of a person. This can be achieved by traversing five consecutive “parent-child” edges from person A.
In a social network, discover friend circles. For example, users who can be reached by 1, 2, or 3 “friend” edges from the target user can form the target user’s friend circle.
3.2.4 K-neighbor API (POST, Advanced Version)
3.2.4.1 Function Introduction
Find all vertices that are reachable within depth steps from the starting vertex, based on the starting vertex, steps (including direction, edge type, and filter properties), and depth.
The difference from the Basic Version of K-neighbor API is that:
It supports counting the number of neighbors only.
It supports filtering edges based on their properties.
It supports returning the shortest path to reach the neighbors.
Params
source: Starting vertex ID, required.
steps: Steps from the starting point, required, with the following structure:
direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.
edge_steps: The step set of edges, supporting label and properties filtering for the edge. If edge_steps is empty, the edge is not filtered.
label: Edge types.
properties: Filter edges based on property values.
vertex_steps: The step set of vertices, supporting label and properties filtering for the vertex. If vertex_steps is empty, the vertex is not filtered.
label: Vertex types.
properties: Filter vertices based on property values.
max_degree: Maximum number of adjacent edges to traverse for each vertex during the query process. Default is 10000. (Note: Before version 0.12, the parameter name within the step only supported “degree.” Starting from version 0.12, it is unified as “max_degree” and is backward compatible with the “degree” notation.)
skip_degree: Used to set the minimum number of edges to discard super vertices during the query process. When the number of adjacent edges for a vertex exceeds skip_degree, the vertex is completely discarded. This is an optional parameter. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), which means no vertices are skipped. (Note: When this configuration is enabled, the traversal will attempt to access skip_degree edges for each vertex, not just max_degree edges. This incurs additional traversal overhead and may significantly impact query performance. Please make sure to understand this before enabling.)
max_depth: Number of steps, required.
count_only: Boolean value. If true, only the count of results is returned without the actual results. If false, the specific results are returned. Default is false.
with_path: If true, the shortest path from the starting point to each neighbor is returned. If false, the shortest path from the starting point to each neighbor is not returned. This is an optional parameter. Default is false.
with_edge: Optional parameter, default is false:
When true, the result will include complete edge information (all edges in the path):
When with_path is true, it returns complete information of all edges in all paths.
When with_path is false, no information is returned.
When false, it only returns edge IDs.
with_vertex: Optional parameter, default is false:
When true, the result will include complete vertex information (all vertices in the path):
When with_path is true, it returns complete information of all vertices in all paths.
When with_path is false, it returns complete information of all neighbors.
When false, it only returns vertex IDs.
limit: Maximum number of vertices to be returned. Also, the maximum number of vertices visited during the traversal process. This is an optional parameter. Default is 10000000.
3.2.4.2 Usage Method
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kneighbor
direction: Direction in which the vertex expands outward (OUT, IN, BOTH). Optional, default is BOTH.
label: Edge type. Optional, default represents all edge labels.
max_degree: Maximum number of adjacent edges to traverse for each vertex during the query process. Optional, default is 10000.
limit: Maximum number of common neighbors to be returned. Optional, default is 10000000.
3.2.5.2 Usage Method
Method & Url
GET http://localhost:8080/graphs/{graph}/traversers/sameneighbors?vertex=“1:marko”&other="1:josh"
diff --git a/docs/clients/restful-api/index.xml b/docs/clients/restful-api/index.xml
index cb3005a06..55c5c0b0a 100644
--- a/docs/clients/restful-api/index.xml
+++ b/docs/clients/restful-api/index.xml
@@ -2087,7 +2087,7 @@
<li>The advanced version uses the POST method to find neighbors that are exactly N steps away from a given starting vertex. The advanced version differs from the basic version in the following ways:
<ul>
<li>Supports counting the number of neighbors only</li>
-<li>Supports filtering by edge properties</li>
+<li>Supports filtering by edge and vertex properties</li>
<li>Supports returning the shortest path to reach the neighbor</li>
</ul>
</li>
@@ -2099,7 +2099,7 @@
<li>The advanced version uses the POST method to find all neighbors that are within N steps of a given starting vertex. The advanced version differs from the basic version in the following ways:
<ul>
<li>Supports counting the number of neighbors only</li>
-<li>Supports filtering by edge properties</li>
+<li>Supports filtering by edge and vertex properties</li>
<li>Supports returning the shortest path to reach the neighbor</li>
</ul>
</li>
@@ -2320,11 +2320,21 @@
<h6 id="params-1">Params</h6>
<ul>
<li>source: The ID of the starting vertex, required.</li>
-<li>Step from the starting point, required, with the following structure:
+<li>steps: Steps from the starting point, required, with the following structure:
<ul>
<li>direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.</li>
-<li>labels: List of edge types.</li>
-<li>properties: Filters edges based on property values.</li>
+<li>edge_steps: The step set of edges, supporting label and properties filtering for the edge. If edge_steps is empty, the edge is not filtered.
+<ul>
+<li>label: Edge types.</li>
+<li>properties: Filter edges based on property values.</li>
+</ul>
+</li>
+<li>vertex_steps: The step set of vertices, supporting label and properties filtering for the vertex. If vertex_steps is empty, the vertex is not filtered.
+<ul>
+<li>label: Vertex types.</li>
+<li>properties: Filter vertices based on property values.</li>
+</ul>
+</li>
<li>max_degree: Maximum number of adjacent edges to traverse for a single vertex, default is 10000 (Note: Prior to version 0.12, the parameter name was “degree” instead of “max_degree”. Starting from version 0.12, “max_degree” is used uniformly, while still supporting the “degree” syntax for backward compatibility).</li>
<li>skip_degree: Sets the minimum number of edges to skip super vertices during the query process. If the number of adjacent edges for a vertex is greater than skip_degree, the vertex is completely skipped. Optional. If enabled, it should satisfy the constraint <code>skip_degree >= max_degree</code>. Default is 0 (not enabled), indicating no skipping of any vertices (Note: Enabling this configuration means that during traversal, an attempt will be made to access skip_degree edges of a vertex, not just max_degree edges. This incurs additional traversal overhead and may have a significant impact on query performance. Please enable it only after understanding the implications).</li>
</ul>
@@ -2333,9 +2343,20 @@
<li>nearest: When nearest is true, it means the shortest path length from the starting vertex to the result vertex is equal to depth, and there is no shorter path. When nearest is false, it means there is a path of length depth from the starting vertex to the result vertex (not necessarily the shortest and can contain cycles). Optional, default is true.</li>
<li>count_only: Boolean value, true indicates only counting the number of results without returning specific results, false indicates returning specific results. Default is false.</li>
<li>with_path: When true, it returns the shortest path from the starting vertex to each neighbor. When false, it does not return the shortest path. Optional, default is false.</li>
-<li>with_vertex: Optional, default is false:
+<li>with_edge: Optional parameter, default is false:
+<ul>
+<li>When true, the result will include complete edge information (all edges in the path):
+<ul>
+<li>When with_path is true, it returns complete information of all edges in all paths.</li>
+<li>When with_path is false, no information is returned.</li>
+</ul>
+</li>
+<li>When false, it only returns edge IDs.</li>
+</ul>
+</li>
+<li>with_vertex: Optional parameter, default is false:
<ul>
-<li>When true, the results include complete vertex information (all vertices in the path):
+<li>When true, the result will include complete vertex information (all vertices in the path):
<ul>
<li>When with_path is true, it returns complete information of all vertices in all paths.</li>
<li>When with_path is false, it returns complete information of all neighbors.</li>
@@ -2346,6 +2367,7 @@
</li>
<li>capacity: Maximum number of vertices to visit during traversal. Optional, default is 10000000.</li>
<li>limit: Maximum number of vertices to return. Optional, default is 10000000.</li>
+<li>traverse_mode: Traversal mode. There are two options: “breadth_first_search” and “depth_first_search”, default is “breadth_first_search”.</li>
</ul>
<h5 id="3222-usage">3.2.2.2 Usage</h5>
<h6 id="method--url-1">Method & Url</h6>
@@ -2353,12 +2375,34 @@
</span></span></code></pre></div><h6 id="request-body">Request Body</h6>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span><span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"source"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"step"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"steps"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"direction"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"BOTH"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"labels"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span><span style="color:#4e9a06">"knows"</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#4e9a06">"created"</span><span style="color:#000;font-weight:bold">],</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"edge_steps"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"knows"</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"weight"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"P.gt(0.1)"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"created"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"weight"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"P.gt(0.1)"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">],</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"vertex_steps"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"age"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"P.lt(32)"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"software"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">],</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"max_degree"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">10000</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"skip_degree"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">100000</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
@@ -2366,15 +2410,15 @@
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"nearest"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#204a87;font-weight:bold">true</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"limit"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">10000</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"with_vertex"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#204a87;font-weight:bold">true</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"with_path"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#204a87;font-weight:bold">true</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"with_path"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#204a87;font-weight:bold">true</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"with_edge"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#204a87;font-weight:bold">true</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">}</span>
</span></span></code></pre></div><h6 id="response-status-1">Response Status</h6>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span><span style="color:#0000cf;font-weight:bold">200</span>
</span></span></code></pre></div><h6 id="response-body-1">Response Body</h6>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span><span style="color:#000;font-weight:bold">{</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"size"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">3</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"size"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">2</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"kout"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:josh"</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:vadas"</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"2:lop"</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">],</span>
@@ -2382,7 +2426,7 @@
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"objects"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:josh"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"2:lop"</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">]</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
@@ -2390,12 +2434,6 @@
</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:vadas"</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">]</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"objects"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"2:lop"</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">]</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">],</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"vertices"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
@@ -2410,16 +2448,6 @@
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"id"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:josh"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"type"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"vertex"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"name"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"josh"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"age"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">32</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"city"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"Beijing"</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"id"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:vadas"</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"type"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"vertex"</span><span style="color:#000;font-weight:bold">,</span>
@@ -2439,6 +2467,34 @@
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"price"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">328</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">],</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"edges"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"id"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"S1:marko>1>20160110>S1:vadas"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"knows"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"type"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"edge"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"outV"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"outVLabel"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"inV"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:vadas"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"inVLabel"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"weight"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">0.5</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"date"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"20160110"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"id"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"S1:marko>2>>S2:lop"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"created"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"type"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"edge"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"outV"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"outVLabel"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"inV"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"2:lop"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"inVLabel"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"software"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"weight"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">0.4</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"date"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"20171210"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">]</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">}</span>
</span></span></code></pre></div><h5 id="3223-use-cases">3.2.2.3 Use Cases</h5>
@@ -2494,11 +2550,21 @@
<h6 id="params-3">Params</h6>
<ul>
<li>source: Starting vertex ID, required.</li>
-<li>Step from the starting point, required, with the following structure:
+<li>steps: Steps from the starting point, required, with the following structure:
<ul>
-<li>direction: Represents the direction of edges (OUT, IN, BOTH). Default is BOTH.</li>
-<li>labels: List of edge types.</li>
+<li>direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.</li>
+<li>edge_steps: The step set of edges, supporting label and properties filtering for the edge. If edge_steps is empty, the edge is not filtered.
+<ul>
+<li>label: Edge types.</li>
<li>properties: Filter edges based on property values.</li>
+</ul>
+</li>
+<li>vertex_steps: The step set of vertices, supporting label and properties filtering for the vertex. If vertex_steps is empty, the vertex is not filtered.
+<ul>
+<li>label: Vertex types.</li>
+<li>properties: Filter vertices based on property values.</li>
+</ul>
+</li>
<li>max_degree: Maximum number of adjacent edges to traverse for each vertex during the query process. Default is 10000. (Note: Before version 0.12, the parameter name within the step only supported “degree.” Starting from version 0.12, it is unified as “max_degree” and is backward compatible with the “degree” notation.)</li>
<li>skip_degree: Used to set the minimum number of edges to discard super vertices during the query process. When the number of adjacent edges for a vertex exceeds skip_degree, the vertex is completely discarded. This is an optional parameter. If enabled, it should satisfy the constraint <code>skip_degree >= max_degree</code>. Default is 0 (not enabled), which means no vertices are skipped. (Note: When this configuration is enabled, the traversal will attempt to access skip_degree edges for each vertex, not just max_degree edges. This incurs additional traversal overhead and may significantly impact query performance. Please make sure to understand this before enabling.)</li>
</ul>
@@ -2506,15 +2572,26 @@
<li>max_depth: Number of steps, required.</li>
<li>count_only: Boolean value. If true, only the count of results is returned without the actual results. If false, the specific results are returned. Default is false.</li>
<li>with_path: If true, the shortest path from the starting point to each neighbor is returned. If false, the shortest path from the starting point to each neighbor is not returned. This is an optional parameter. Default is false.</li>
+<li>with_edge: Optional parameter, default is false:
+<ul>
+<li>When true, the result will include complete edge information (all edges in the path):
+<ul>
+<li>When with_path is true, it returns complete information of all edges in all paths.</li>
+<li>When with_path is false, no information is returned.</li>
+</ul>
+</li>
+<li>When false, it only returns edge IDs.</li>
+</ul>
+</li>
<li>with_vertex: Optional parameter, default is false:
<ul>
-<li>If true, the results include complete vertex information (all vertices in the path).
+<li>When true, the result will include complete vertex information (all vertices in the path):
<ul>
-<li>When with_path is true, it returns complete information of all vertices in the paths.</li>
+<li>When with_path is true, it returns complete information of all vertices in all paths.</li>
<li>When with_path is false, it returns complete information of all neighbors.</li>
</ul>
</li>
-<li>If false, only the vertex ID is returned.</li>
+<li>When false, it only returns vertex IDs.</li>
</ul>
</li>
<li>limit: Maximum number of vertices to be returned. Also, the maximum number of vertices visited during the traversal process. This is an optional parameter. Default is 10000000.</li>
@@ -2525,69 +2602,80 @@
</span></span></code></pre></div><h6 id="request-body-1">Request Body</h6>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span><span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"source"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"step"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"steps"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"direction"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"BOTH"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"labels"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span><span style="color:#4e9a06">"knows"</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#4e9a06">"created"</span><span style="color:#000;font-weight:bold">],</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"edge_steps"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"knows"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"weight"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"P.gt(0.1)"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"created"</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"weight"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"P.gt(0.1)"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">],</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"vertex_steps"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"age"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"P.lt(32)"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"software"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">],</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"max_degree"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">10000</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"skip_degree"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">100000</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"max_depth"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">3</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"max_depth"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">1</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"nearest"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#204a87;font-weight:bold">true</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"limit"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">10000</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"with_vertex"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#204a87;font-weight:bold">true</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"with_path"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#204a87;font-weight:bold">true</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"with_path"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#204a87;font-weight:bold">true</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"with_edge"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#204a87;font-weight:bold">true</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">}</span>
</span></span></code></pre></div><h6 id="response-status-3">Response Status</h6>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span><span style="color:#0000cf;font-weight:bold">200</span>
</span></span></code></pre></div><h6 id="response-body-3">Response Body</h6>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span><span style="color:#000;font-weight:bold">{</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"size"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">6</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"size"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">4</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"kneighbor"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"2:ripple"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:josh"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:vadas"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"2:lop"</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:peter"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"2:lop"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"2:ripple"</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">],</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"paths"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"objects"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:josh"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"2:ripple"</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">]</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"objects"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:marko"</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">]</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"objects"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:josh"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"2:lop"</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">]</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"objects"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:vadas"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"2:lop"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:peter"</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">]</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"objects"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"2:lop"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:peter"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:josh"</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">]</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"objects"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"2:lop"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"1:josh"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"2:ripple"</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">]</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">],</span>
@@ -2623,16 +2711,6 @@
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"id"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:vadas"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"type"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"vertex"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"name"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"vadas"</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"age"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">27</span><span style="color:#000;font-weight:bold">,</span>
-</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"city"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"Hongkong"</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
-</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"id"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:peter"</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"type"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"vertex"</span><span style="color:#000;font-weight:bold">,</span>
@@ -2652,6 +2730,60 @@
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"price"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">328</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">],</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"edges"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">[</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"id"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"S1:josh>2>>S2:ripple"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"created"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"type"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"edge"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"outV"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:josh"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"outVLabel"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"inV"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"2:ripple"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"inVLabel"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"software"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"weight"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">1.0</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"date"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"20171210"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"id"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"S1:marko>2>>S2:lop"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"created"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"type"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"edge"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"outV"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"outVLabel"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"inV"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"2:lop"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"inVLabel"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"software"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"weight"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">0.4</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"date"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"20171210"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"id"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"S1:marko>1>20130220>S1:josh"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"knows"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"type"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"edge"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"outV"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:marko"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"outVLabel"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"inV"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:josh"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"inVLabel"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"weight"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">1.0</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"date"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"20130220"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">},</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"id"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"S1:peter>2>>S2:lop"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"label"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"created"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"type"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"edge"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"outV"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"1:peter"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"outVLabel"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"person"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"inV"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"2:lop"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"inVLabel"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"software"</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"properties"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"weight"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">0.2</span><span style="color:#000;font-weight:bold">,</span>
+</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"date"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">"20170324"</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
+</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">}</span>
</span></span><span style="display:flex;"><span> <span style="color:#000;font-weight:bold">]</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">}</span>
</span></span></code></pre></div><h5 id="3243-use-cases">3.2.4.3 Use Cases</h5>
diff --git a/docs/clients/restful-api/traverser/index.html b/docs/clients/restful-api/traverser/index.html
index f55c371bc..ce1bf8800 100644
--- a/docs/clients/restful-api/traverser/index.html
+++ b/docs/clients/restful-api/traverser/index.html
@@ -1,9 +1,9 @@
Traverser API | HugeGraph
Traverser API
3.1 Overview of Traverser API
HugeGraphServer provides a RESTful API interface for the HugeGraph graph database. In addition to the basic CRUD operations for vertices and edges, it also offers several traversal methods, which we refer to as the traverser API. These traversal methods implement various complex graph algorithms, making it convenient for users to analyze and explore the graph.
The Traverser API supported by HugeGraph includes:
K-out API: It finds neighbors that are exactly N steps away from a given starting vertex. There are two versions:
The basic version uses the GET method to find neighbors that are exactly N steps away from a given starting vertex.
The advanced version uses the POST method to find neighbors that are exactly N steps away from a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge properties
Supports returning the shortest path to reach the neighbor
K-neighbor API: It finds all neighbors that are within N steps of a given starting vertex. There are two versions:
The basic version uses the GET method to find all neighbors that are within N steps of a given starting vertex.
The advanced version uses the POST method to find all neighbors that are within N steps of a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge properties
Supports returning the shortest path to reach the neighbor
Same Neighbors: It queries the common neighbors of two vertices.
Jaccard Similarity API: It calculates the Jaccard similarity, which includes two types:
One type uses the GET method to calculate the similarity (intersection over union) of neighbors between two vertices.
The other type uses the POST method to find the top N vertices with the highest Jaccard similarity to a given starting vertex in the entire graph.
Shortest Path API: It finds the shortest path between two vertices.
All Shortest Paths: It finds all shortest paths between two vertices.
Weighted Shortest Path: It finds the shortest weighted path from a starting vertex to a target vertex.
Single Source Shortest Path: It finds the weighted shortest path from a single source vertex to all other vertices.
Multi Node Shortest Path: It finds the shortest path between every pair of specified vertices.
Paths API: It finds all paths between two vertices. There are two versions:
The basic version uses the GET method to find all paths between a given starting vertex and an ending vertex.
The advanced version uses the POST method to find all paths that meet certain conditions between a set of starting vertices and a set of ending vertices.
3.2 Detailed Explanation of Traverser API
In the following, we provide a detailed explanation of the Traverser API:
Customized Paths API: It traverses all paths that pass through a batch of vertices according to a specific pattern.
Template Path API: It specifies a starting point, an ending point, and the path information between them to find matching paths.
Crosspoints API: It finds the intersection (common ancestors or common descendants) between two vertices.
Customized Crosspoints API: It traverses multiple patterns starting from a batch of vertices and finds the intersections with the vertices reached in the final step.
Rings API: It finds the cyclic paths that can be reached from a starting vertex.
Rays API: It finds the paths from a starting vertex that reach the boundaries (i.e., paths without cycles).
Fusiform Similarity API: It finds the fusiform similar vertices to a given vertex.
Vertices API:
Batch querying vertices by ID.
Getting the partitions of vertices.
Querying vertices by partition.
Edges API:
Batch querying edges by ID.
Getting the partitions of edges.
Querying edges by partition.
3.2 Detailed Explanation of Traverser API
The usage examples provided in this section are based on the graph presented on the TinkerPop official website:
HugeGraphServer provides a RESTful API interface for the HugeGraph graph database. In addition to the basic CRUD operations for vertices and edges, it also offers several traversal methods, which we refer to as the traverser API. These traversal methods implement various complex graph algorithms, making it convenient for users to analyze and explore the graph.
The Traverser API supported by HugeGraph includes:
K-out API: It finds neighbors that are exactly N steps away from a given starting vertex. There are two versions:
The basic version uses the GET method to find neighbors that are exactly N steps away from a given starting vertex.
The advanced version uses the POST method to find neighbors that are exactly N steps away from a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge and vertex properties
Supports returning the shortest path to reach the neighbor
K-neighbor API: It finds all neighbors that are within N steps of a given starting vertex. There are two versions:
The basic version uses the GET method to find all neighbors that are within N steps of a given starting vertex.
The advanced version uses the POST method to find all neighbors that are within N steps of a given starting vertex. The advanced version differs from the basic version in the following ways:
Supports counting the number of neighbors only
Supports filtering by edge and vertex properties
Supports returning the shortest path to reach the neighbor
Same Neighbors: It queries the common neighbors of two vertices.
Jaccard Similarity API: It calculates the Jaccard similarity, which includes two types:
One type uses the GET method to calculate the similarity (intersection over union) of neighbors between two vertices.
The other type uses the POST method to find the top N vertices with the highest Jaccard similarity to a given starting vertex in the entire graph.
Shortest Path API: It finds the shortest path between two vertices.
All Shortest Paths: It finds all shortest paths between two vertices.
Weighted Shortest Path: It finds the shortest weighted path from a starting vertex to a target vertex.
Single Source Shortest Path: It finds the weighted shortest path from a single source vertex to all other vertices.
Multi Node Shortest Path: It finds the shortest path between every pair of specified vertices.
Paths API: It finds all paths between two vertices. There are two versions:
The basic version uses the GET method to find all paths between a given starting vertex and an ending vertex.
The advanced version uses the POST method to find all paths that meet certain conditions between a set of starting vertices and a set of ending vertices.
3.2 Detailed Explanation of Traverser API
In the following, we provide a detailed explanation of the Traverser API:
Customized Paths API: It traverses all paths that pass through a batch of vertices according to a specific pattern.
Template Path API: It specifies a starting point, an ending point, and the path information between them to find matching paths.
Crosspoints API: It finds the intersection (common ancestors or common descendants) between two vertices.
Customized Crosspoints API: It traverses multiple patterns starting from a batch of vertices and finds the intersections with the vertices reached in the final step.
Rings API: It finds the cyclic paths that can be reached from a starting vertex.
Rays API: It finds the paths from a starting vertex that reach the boundaries (i.e., paths without cycles).
Fusiform Similarity API: It finds the fusiform similar vertices to a given vertex.
Vertices API:
Batch querying vertices by ID.
Getting the partitions of vertices.
Querying vertices by partition.
Edges API:
Batch querying edges by ID.
Getting the partitions of edges.
Querying edges by partition.
3.2 Detailed Explanation of Traverser API
The usage examples provided in this section are based on the graph presented on the TinkerPop official website:
Finding vertices that are exactly N steps away in a relationship. Two examples:
In a family relationship, finding all grandchildren of a person. The set of vertices that can be reached by person A through two consecutive “son” edges.
Discovering potential friends in a social network. For example, finding users who are two degrees of friendship away from the target user, reachable through two consecutive “friend” edges.
3.2.2 K-out API (POST, Advanced Version)
3.2.2.1 Functionality Overview
The K-out API allows you to find vertices that are exactly “depth” steps away from a given starting vertex, considering the specified steps (including direction, edge type, and attribute filtering).
The advanced version differs from the basic version of K-out API in the following aspects:
Supports counting the number of neighbors only
Supports edge attribute filtering
Supports returning the shortest path to the neighbor
Params
source: The ID of the starting vertex, required.
Step from the starting point, required, with the following structure:
direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.
labels: List of edge types.
properties: Filters edges based on property values.
max_degree: Maximum number of adjacent edges to traverse for a single vertex, default is 10000 (Note: Prior to version 0.12, the parameter name was “degree” instead of “max_degree”. Starting from version 0.12, “max_degree” is used uniformly, while still supporting the “degree” syntax for backward compatibility).
skip_degree: Sets the minimum number of edges to skip super vertices during the query process. If the number of adjacent edges for a vertex is greater than skip_degree, the vertex is completely skipped. Optional. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), indicating no skipping of any vertices (Note: Enabling this configuration means that during traversal, an attempt will be made to access skip_degree edges of a vertex, not just max_degree edges. This incurs additional traversal overhead and may have a significant impact on query performance. Please enable it only after understanding the implications).
max_depth: Number of steps, required.
nearest: When nearest is true, it means the shortest path length from the starting vertex to the result vertex is equal to depth, and there is no shorter path. When nearest is false, it means there is a path of length depth from the starting vertex to the result vertex (not necessarily the shortest and can contain cycles). Optional, default is true.
count_only: Boolean value, true indicates only counting the number of results without returning specific results, false indicates returning specific results. Default is false.
with_path: When true, it returns the shortest path from the starting vertex to each neighbor. When false, it does not return the shortest path. Optional, default is false.
with_vertex: Optional, default is false:
When true, the results include complete vertex information (all vertices in the path):
When with_path is true, it returns complete information of all vertices in all paths.
When with_path is false, it returns complete information of all neighbors.
When false, it only returns vertex IDs.
capacity: Maximum number of vertices to visit during traversal. Optional, default is 10000000.
limit: Maximum number of vertices to return. Optional, default is 10000000.
3.2.2.2 Usage
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kout
+
3.2.1.3 Use Cases
Finding vertices that are exactly N steps away in a relationship. Two examples:
In a family relationship, finding all grandchildren of a person. The set of vertices that can be reached by person A through two consecutive “son” edges.
Discovering potential friends in a social network. For example, finding users who are two degrees of friendship away from the target user, reachable through two consecutive “friend” edges.
3.2.2 K-out API (POST, Advanced Version)
3.2.2.1 Functionality Overview
The K-out API allows you to find vertices that are exactly “depth” steps away from a given starting vertex, considering the specified steps (including direction, edge type, and attribute filtering).
The advanced version differs from the basic version of K-out API in the following aspects:
Supports counting the number of neighbors only
Supports edge attribute filtering
Supports returning the shortest path to the neighbor
Params
source: The ID of the starting vertex, required.
steps: Steps from the starting point, required, with the following structure:
direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.
edge_steps: The step set of edges, supporting label and properties filtering for the edge. If edge_steps is empty, the edge is not filtered.
label: Edge types.
properties: Filter edges based on property values.
vertex_steps: The step set of vertices, supporting label and properties filtering for the vertex. If vertex_steps is empty, the vertex is not filtered.
label: Vertex types.
properties: Filter vertices based on property values.
max_degree: Maximum number of adjacent edges to traverse for a single vertex, default is 10000 (Note: Prior to version 0.12, the parameter name was “degree” instead of “max_degree”. Starting from version 0.12, “max_degree” is used uniformly, while still supporting the “degree” syntax for backward compatibility).
skip_degree: Sets the minimum number of edges to skip super vertices during the query process. If the number of adjacent edges for a vertex is greater than skip_degree, the vertex is completely skipped. Optional. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), indicating no skipping of any vertices (Note: Enabling this configuration means that during traversal, an attempt will be made to access skip_degree edges of a vertex, not just max_degree edges. This incurs additional traversal overhead and may have a significant impact on query performance. Please enable it only after understanding the implications).
max_depth: Number of steps, required.
nearest: When nearest is true, it means the shortest path length from the starting vertex to the result vertex is equal to depth, and there is no shorter path. When nearest is false, it means there is a path of length depth from the starting vertex to the result vertex (not necessarily the shortest and can contain cycles). Optional, default is true.
count_only: Boolean value, true indicates only counting the number of results without returning specific results, false indicates returning specific results. Default is false.
with_path: When true, it returns the shortest path from the starting vertex to each neighbor. When false, it does not return the shortest path. Optional, default is false.
with_edge: Optional parameter, default is false:
When true, the result will include complete edge information (all edges in the path):
When with_path is true, it returns complete information of all edges in all paths.
When with_path is false, no information is returned.
When false, it only returns edge IDs.
with_vertex: Optional parameter, default is false:
When true, the result will include complete vertex information (all vertices in the path):
When with_path is true, it returns complete information of all vertices in all paths.
When with_path is false, it returns complete information of all neighbors.
When false, it only returns vertex IDs.
capacity: Maximum number of vertices to visit during traversal. Optional, default is 10000000.
limit: Maximum number of vertices to return. Optional, default is 10000000.
traverse_mode: Traversal mode. There are two options: “breadth_first_search” and “depth_first_search”, default is “breadth_first_search”.
3.2.2.2 Usage
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kout
Find all vertices that are reachable within depth steps, including the starting vertex, based on the starting vertex, direction, edge type (optional), and depth.
Equivalent to the union of: starting vertex, K-out(1), K-out(2), …, K-out(max_depth).
Params
source: ID of the starting vertex, required.
direction: Direction in which the starting vertex’s edges extend (OUT, IN, BOTH). Optional, default is BOTH.
max_depth: Number of steps, required.
label: Edge type, optional, default represents all edge labels.
max_degree: Maximum number of adjacent edges to traverse for a single vertex during the query process. Optional, default is 10000.
limit: Maximum number of vertices to return, also represents the maximum number of vertices to visit during traversal. Optional, default is 10000000.
3.2.3.2 Usage
Method & Url
GET http://localhost:8080/graphs/{graph}/traversers/kneighbor?source=“1:marko”&max_depth=2
@@ -239,70 +273,81 @@
"2:lop"]}
-
3.2.3.3 Use Cases
Find all vertices reachable within N steps, for example:
In a family relationship, find all descendants within five generations of a person. This can be achieved by traversing five consecutive “parent-child” edges from person A.
In a social network, discover friend circles. For example, users who can be reached by 1, 2, or 3 “friend” edges from the target user can form the target user’s friend circle.
3.2.4 K-neighbor API (POST, Advanced Version)
3.2.4.1 Function Introduction
Find all vertices that are reachable within depth steps from the starting vertex, based on the starting vertex, steps (including direction, edge type, and filter properties), and depth.
The difference from the Basic Version of K-neighbor API is that:
It supports counting the number of neighbors only.
It supports filtering edges based on their properties.
It supports returning the shortest path to reach the neighbors.
Params
source: Starting vertex ID, required.
Step from the starting point, required, with the following structure:
direction: Represents the direction of edges (OUT, IN, BOTH). Default is BOTH.
labels: List of edge types.
properties: Filter edges based on property values.
max_degree: Maximum number of adjacent edges to traverse for each vertex during the query process. Default is 10000. (Note: Before version 0.12, the parameter name within the step only supported “degree.” Starting from version 0.12, it is unified as “max_degree” and is backward compatible with the “degree” notation.)
skip_degree: Used to set the minimum number of edges to discard super vertices during the query process. When the number of adjacent edges for a vertex exceeds skip_degree, the vertex is completely discarded. This is an optional parameter. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), which means no vertices are skipped. (Note: When this configuration is enabled, the traversal will attempt to access skip_degree edges for each vertex, not just max_degree edges. This incurs additional traversal overhead and may significantly impact query performance. Please make sure to understand this before enabling.)
max_depth: Number of steps, required.
count_only: Boolean value. If true, only the count of results is returned without the actual results. If false, the specific results are returned. Default is false.
with_path: If true, the shortest path from the starting point to each neighbor is returned. If false, the shortest path from the starting point to each neighbor is not returned. This is an optional parameter. Default is false.
with_vertex: Optional parameter, default is false:
If true, the results include complete vertex information (all vertices in the path).
When with_path is true, it returns complete information of all vertices in the paths.
When with_path is false, it returns complete information of all neighbors.
If false, only the vertex ID is returned.
limit: Maximum number of vertices to be returned. Also, the maximum number of vertices visited during the traversal process. This is an optional parameter. Default is 10000000.
3.2.4.2 Usage Method
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kneighbor
+
3.2.3.3 Use Cases
Find all vertices reachable within N steps, for example:
In a family relationship, find all descendants within five generations of a person. This can be achieved by traversing five consecutive “parent-child” edges from person A.
In a social network, discover friend circles. For example, users who can be reached by 1, 2, or 3 “friend” edges from the target user can form the target user’s friend circle.
3.2.4 K-neighbor API (POST, Advanced Version)
3.2.4.1 Function Introduction
Find all vertices that are reachable within depth steps from the starting vertex, based on the starting vertex, steps (including direction, edge type, and filter properties), and depth.
The difference from the Basic Version of K-neighbor API is that:
It supports counting the number of neighbors only.
It supports filtering edges based on their properties.
It supports returning the shortest path to reach the neighbors.
Params
source: Starting vertex ID, required.
steps: Steps from the starting point, required, with the following structure:
direction: Represents the direction of the edges (OUT, IN, BOTH), default is BOTH.
edge_steps: The step set of edges, supporting label and properties filtering for the edge. If edge_steps is empty, the edge is not filtered.
label: Edge types.
properties: Filter edges based on property values.
vertex_steps: The step set of vertices, supporting label and properties filtering for the vertex. If vertex_steps is empty, the vertex is not filtered.
label: Vertex types.
properties: Filter vertices based on property values.
max_degree: Maximum number of adjacent edges to traverse for each vertex during the query process. Default is 10000. (Note: Before version 0.12, the parameter name within the step only supported “degree.” Starting from version 0.12, it is unified as “max_degree” and is backward compatible with the “degree” notation.)
skip_degree: Used to set the minimum number of edges to discard super vertices during the query process. When the number of adjacent edges for a vertex exceeds skip_degree, the vertex is completely discarded. This is an optional parameter. If enabled, it should satisfy the constraint skip_degree >= max_degree. Default is 0 (not enabled), which means no vertices are skipped. (Note: When this configuration is enabled, the traversal will attempt to access skip_degree edges for each vertex, not just max_degree edges. This incurs additional traversal overhead and may significantly impact query performance. Please make sure to understand this before enabling.)
max_depth: Number of steps, required.
count_only: Boolean value. If true, only the count of results is returned without the actual results. If false, the specific results are returned. Default is false.
with_path: If true, the shortest path from the starting point to each neighbor is returned. If false, the shortest path from the starting point to each neighbor is not returned. This is an optional parameter. Default is false.
with_edge: Optional parameter, default is false:
When true, the result will include complete edge information (all edges in the path):
When with_path is true, it returns complete information of all edges in all paths.
When with_path is false, no information is returned.
When false, it only returns edge IDs.
with_vertex: Optional parameter, default is false:
When true, the result will include complete vertex information (all vertices in the path):
When with_path is true, it returns complete information of all vertices in all paths.
When with_path is false, it returns complete information of all neighbors.
When false, it only returns vertex IDs.
limit: Maximum number of vertices to be returned. Also, the maximum number of vertices visited during the traversal process. This is an optional parameter. Default is 10000000.
3.2.4.2 Usage Method
Method & Url
POST http://localhost:8080/graphs/{graph}/traversers/kneighbor