Consider the following data:
g.addV(\'RootTopic\').property(\'name\', \'A\').as(\'A\')
.addV(\'RootTopic\').property(\'name\', \'M\').as(\'M\')
.addV(\'Topic\').
The by()
modulator can take more than just a property key value as an argument. You can also pass in an anonymous traversal which would thus allow:
g.V().hasLabel('RootTopic').
repeat(out()).times(2).
emit().
tree()
by(values('name','k1','k2').fold())
or you might use project()
if you had more complex output:
g.V().hasLabel('RootTopic').
repeat(out()).times(2).
emit().
tree()
by(project('name','k1','degree').
by('name').
by('k1').
by(both().count())
The main point to take away here is that with an anonymous traversal you can develop just about any output you would like.