4

How would write a traversal in use Gremlin TinkerPop 3 to find all vertices that have no incoming edges?

As a follow up I also need to find a vertices that have no outgoing edges as well.

1 Answers1

10

This is simpler than the below version

g.V().not(inE())
g.V().not(outE())

Keeping my original answer for reference

g.V().where(inE().count().is(eq(0)))

For 0 outgoing edges

g.V().where(outE().count().is(eq(0)))
Alaa Mahmoud
  • 723
  • 3
  • 18