can explain the name of the traverser?

93 views
Skip to first unread message

pengzhi...@gmail.com

unread,
Jan 3, 2017, 10:45:16 PM1/3/17
to Gremlin-users
Hi,
   I find traverser class under package org.apache.tinkerpop.gremlin.process.traversal.traverser, their name are O_Traverser or B_O_Traverser etc, can you explain what is mean about their name?

Marko Rodriguez

unread,
Jan 4, 2017, 5:49:32 AM1/4/17
to gremli...@googlegroups.com
Hello,

   I find traverser class under package org.apache.tinkerpop.gremlin.process.traversal.traverser, their name are O_Traverser or B_O_Traverser etc, can you explain what is mean about their name?

At its most abstract level, a Traverser maintains the following data:

1. A reference to its current location in the graph (Traverser.get())
2. A reference to its current location in the traversal (Traverser.getStepId())
3. A bulk denoting how many traversers it represents (Traverser.bulk())
4. A loop stack denoting how many times its gone through a repeat sequence (Traverser.loops())
5. A path denoting the history of the traverser’s travel through the graph (Traverser.path())
6. A sack denoting a traverser local side-effect data structure (Traverser.sack())



This is a lot of data to maintain especially when there can be millions of traversers flowing through the system. Fortunately, most traversals don’t require all 6 concepts of the traverser. Thus, there are different “species” of Traversers that have varying amounts of the above data represented.

O_Traverser is the simplest — only maintaining data for 1 and 2.
B_O_Traverser is a bit more — only maintaining data for 1, 2, and 3.
so forth and so on.

Thus, while theoretically, a Traverser has all 6 items of data, in practice, at compile time, we can choose the “slimmest” (light weight) traverser species to use for the respective Traversal in order to reduce the memory footprint. This becomes all the more important in distributed traversal execution where traversers jump between machines.

You might ask — “how do you know which traverser species to use for a traversal?” … Thats all about Traversal.getRequirements().

I hope that is clear,
Marko.




--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/a9901ef3-2428-4553-918f-06fc61e2c7c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pengzhi...@gmail.com

unread,
Jan 6, 2017, 5:37:00 AM1/6/17
to Gremlin-users
Hello marko:
                  Thanks, it answer is clear.

在 2017年1月4日星期三 UTC+8下午6:49:32,Marko A. Rodriguez写道:
Reply all
Reply to author
Forward
0 new messages