Search code examples
gremlintinkerpop

Let A be a gremlin query, and let t1, t2 be two point in times. Excluding ids of edges and nodes, is At1 = At2?


This might be a pretty obscure question but I'll try my best here.

Assuming I have a very simple query, for instance:

g.addV('Person').property('name', 'Marko');

And then I run the same query again. Of course the graph created two different nodes, but regardless of the id, are they "the same"?

Same for querying the graph:

g.V()

Will the graph produce the results in the same order for any run (assuming it didn't change)?

What I'm trying to ask - can I count on the order of the Gremlin execution?

Thanks!


Solution

  • Gremlin does not enforce iteration order unless you explicitly specify it. It is up to the underlying graph to determine order and most that I'm familiar with do not make such guarantees. Therefore, if you want an order, you need to specify it as in: g.V().order().by('name').