Sometimes there is need to create Vertex with optional Edge.
g.addV('label')
.property(id, 'uniq_id_2').as('u')
.property('edge_is_needed', edgeIsNeeded)
.constant(edgeIsNeeded)
.choose(eq(true),
addE('connected').from('u').to(V('uniq_id_1'))
)
.select('u')
.toList()
This Traversal works, I just injecting boolean value with edgeIsNeeded
variable in JS.
Is there a better way to do it in single Traversal, for example, based on previous property edge_is_needed
value?