Search code examples
gremlingremlin-serverazure-cosmosdb-gremlinapi

Gremlin : How to get all the vertex details in the traversal?


Sample Data

A knows B
A knows C
A knows D
B knows E
C knows F

Desired Output

B
C
D
E
F

I tried the following query, but it's not working,

g.V('A').
out('knows').
as('x').
out('knows').
as('x').
project('Employee').
by(select('x'))

Solution

  • If you just want to get all the vertices in the path you can do:

    g.V('A').repeat(out("knows")).emit().label()
    

    example: https://gremlify.com/c533ij58a98z8