emit
Emit traversers before or after a repeat() step.
Synopsis
emit( [ 'predicate' | 'traversal' ])
Description
The emit()
step is a step modulator, a helper step for another traversal step.
Its main use is to emit either incoming traversers before a repeat() step, or emit outgoing traversers after a repeat()
step.
The emission sends a copy of the current objects to the next step in the query.
A predicate or traversal can be used in an emit()
step to cause the emission only if the predicate or traversal is true.
Examples
g.V(1).emit().repeat(out()).times(2).path() ==>[v[1]] ==>[v[1],v[3]] ==>[v[1],v[2]] ==>[v[1],v[4]] ==>[v[1],v[4],v[5]] ==>[v[1],v[4],v[3]] gremlin> g.V(1).repeat(out()).times(2).emit().path() ==>[v[1],v[3]] ==>[v[1],v[2]] ==>[v[1],v[4]] ==>[v[1],v[4],v[5]] ==>[v[1],v[4],v[3]]