What is the difference between next() and iterate() when working with gremlin? Why does next() return the added vertex when calling g.addV()
, but iterate() does not? When should I use next() and when should I use iterate()?
tinkerpop/gremlin-python: next() vs iterate()
Asked Answered
The answer is already in your question. You'll use .next()
, when you need the result (and you are expecting exactly one result), and you'll use .iterate()
, when you don't need the result (typically mutation queries, that add/change properties, edges and/or vertices).
© 2022 - 2024 — McMap. All rights reserved.
.toList()
will return a list of all the results. – Rochkind