Query if else in gremlin

I have a query and that return a list vertex. I want to do a query from those vertexes like this (if - else):
  • vertex doesn't has out edge -> return itself
  • vertex has out edge -> then keep querying until there are no edges out ( repeat(out()).until(outE().count().is(0)) )
    I'm trying to limit the use of loops here to improve performance. Who can help me.
    Thank you very much
Was this page helpful?