Skip to content

Commit e54c98d

Browse files
authored
docs(interactive): Add documentations for Interactive builtin procedures. (#4452)
As titled. Fix #4448
1 parent fa58153 commit e54c98d

File tree

2 files changed

+81
-2
lines changed

2 files changed

+81
-2
lines changed

docs/flex/interactive/stored_procedures.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,83 @@ CALL test_procedure("marko") YIELD *;
107107

108108

109109
In addition to defining a stored procedure with a Cypher query, we also support for customizing query execution through C++ stored procedures. See [C++ Stored Procedure](./development/stored_procedure/cpp_procedure.md).
110+
111+
112+
## Builtin Procedures
113+
114+
To enhance the user experience in Interactive, we have integrated built-in stored procedures. These procedures facilitate both commonly executed queries and those that, while complex and challenging to devise, are essential and frequently utilized. To access these features, simply input the correct procedure name and the necessary parameters.
115+
116+
### count_vertices
117+
118+
This procedure returns the count of vertices for a specified label.
119+
120+
```cypher
121+
CALL count_vertices(vertex_label_name)
122+
```
123+
124+
###### Parameters
125+
126+
- `vertex_label_name`: The name of the vertex label to be counted.
127+
128+
###### Returns
129+
130+
- `count`: The total number of vertices.
131+
132+
### k_hop_neighbors
133+
134+
This finds all vertices that can be reached from a starting vertex within `k` hops.
135+
136+
```cypher
137+
CALL k_neighbors(src_vertex_label_name, src_vertex_pk, k)
138+
```
139+
140+
###### Parameters
141+
142+
- `src_vertex_label_name`: The label of the starting vertex.
143+
- `src_vertex_pk`: The primary key identifying the starting vertex.
144+
- `k`: The number of hops, which must be greater than or equal to 0.
145+
146+
###### Returns
147+
148+
- `label_name`: The label of each reachable vertex.
149+
- `vertex_pk`: The primary key of each reachable vertex.
150+
151+
### shortest_path_among_three
152+
153+
This finds the shortest path connecting three specified vertices.
154+
155+
```cypher
156+
CALL shortest_path_among_three(label_1, pk_1, label_2, pk_2, label_3, pk_3)
157+
```
158+
159+
###### Parameters
160+
161+
- `label_1`: The label of the first vertex.
162+
- `pk_1`: The primary key of the first vertex.
163+
- `label_2`: The label of the second vertex.
164+
- `pk_2`: The primary key of the second vertex.
165+
- `label_3`: The label of the third vertex.
166+
- `pk_3`: The primary key of the third vertex.
167+
168+
###### Returns
169+
170+
- `path`: The shortest path, represented as a string.
171+
172+
173+
### pagerank
174+
175+
Calculate the PageRank values for a subgraph of the current graph.
176+
177+
```note
178+
Currently, we only support calculating PageRank on a subgraph with a single type of vertex and a single type of relationship.
179+
```
180+
181+
```cypher
182+
CALL page_rank(vertex_label, edge_label, damping_factor, max_iterations, epsilon)
183+
```
184+
185+
- `vertex_label`: The label of the vertices to be queried.
186+
- `edge_label`: The label of the relationships between vertices.
187+
- `damping_factor`: A parameter for the PageRank algorithm.
188+
- `max_iterations`: The maximum number of iterations.
189+
- `epsilon`: A convergence parameter for the PageRank algorithm.

flex/storages/metadata/graph_meta_store.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ const std::vector<PluginMeta>& get_builtin_plugin_metas() {
131131
shortest_path_among_three.params.push_back(
132132
{"oid3", PropertyType::kInt64, false});
133133
shortest_path_among_three.returns.push_back(
134-
{"shortest_path_among_three (label name, vertex oid)",
135-
PropertyType::kString});
134+
{"path", PropertyType::kString});
136135
builtin_plugins.push_back(shortest_path_among_three);
137136

138137
initialized = true;

0 commit comments

Comments
 (0)