Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tinkerpop/gremlin-python: next() vs iterate()

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()?

like image 917
JTW Avatar asked Jan 01 '23 11:01

JTW


1 Answers

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).

like image 72
Daniel Kuppitz Avatar answered Jan 09 '23 04:01

Daniel Kuppitz