Skip to content

Commit 5f70843

Browse files
authored
DOC-3042: Update note on outdegree() function for clarity [3.6]
Clarified the note on outdegree() function to explain performance and potential outdated values due to concurrent write transactions.
1 parent 50d13f4 commit 5f70843

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/querying/pages/func/vertex-methods.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,10 @@ Returns the number of outgoing or undirected edges connected to the vertex. If e
309309
|===
310310

311311
[CAUTION]
312-
[discrete]
313312
====
314-
*Note on outdegree()*: This function reads a metadata value stored with each vertex, to avoid traversing the graph and thus have a fast response. The snapshot transaction semantics means that outdegree() may sometimes read an old value if there are concurrent write transactions. To guarantee an accurate count, traverse the neighboring edges and count them with a SumAccum, or use a function like neighbors() and then use size() on the set.
315-
[discrete]
313+
*Note on outdegree()*: The outdegree() function reads a stored metadata value for faster performance instead of traversing the graph.
314+
Because of snapshot transaction semantics, `outdegree()` might show an outdated value if there are *write transactions running or have just finished*. This delay happens because the background rebuild task may not have processed the updates yet.
315+
To get an exact count, traverse the edges manually using a `SumAccum`, or use the `neighbors()` function and apply `size()` on the result.
316316
====
317317

318318
=== `setAttr()`

0 commit comments

Comments
 (0)