For others to reproduce, here's the sample graph:
g = TinkerGraph.open().traversal()
g.addV().property(id, 'A').
addV().property(id, 'B').
addV().property(id, 'C').
addV().property(id, 'D').
addV().property(id, 'E').
addV().property(id, 'F').
addV().property(id, 'G').
addE('link').from(V('A')).to(V('B')).
addE('link').from(V('A')).to(V('C')).
addE('link').from(V('B')).to(V('D')).
addE('link').from(V('B')).to(V('E')).
addE('link').from(V('C')).to(V('F')).
addE('link').from(V('C')).to(V('G')).iterate()
A depth first search from A should return
A-B-D-E-C-F-G
gremlin> g.V('A').repeat(out('link')).until(__.not(outE('link'))).path().
unfold().dedup().id().fold()
==>[A,B,D,E,C,F,G]
But if I could get the below order it would be even better
D-E-B-F-G-C-A
This one is kinda rolling up the paths from behind. It's tricky, but doable:
gremlin> g.V('A').
repeat(outE('link').aggregate('edges').inV()).
until(__.not(outE('link'))).
flatMap(
union(identity(),
repeat(inE('link').where(within('edges')).as('current').
map(select('edges').unfold().
where(neq('current').and(without('done'))).
outV().where(without('ad')).fold()).as('bl').
select(last, 'current').store('done').
filter(outV().where(without('bl').and(without('ad')))).
outV().store('ad')).
emit())).
id().fold()
==>[D,E,B,F,G,C,A]
However, it's probably a lot easier to just get the paths and do the ordering on the application side.