Details
Description
This block of code iterates over all remote traverses to select one related to the current vertex and remove it. This operation is repeated for the next vertex and so one. For following example query it means n^2 operations (n is number of vertices). All of them in sync block. multi core spark executor will do this operations serial.
g.V().emit().repeat(both().dedup()).count().next()
See jvisualvm screenshot.