Robert Saccone
Robert Saccone

Reputation: 119

How to find all vertices that have no incoming edges in TinkerPop 3?

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.

Upvotes: 4

Views: 1944

Answers (1)

Alaa Mahmoud
Alaa Mahmoud

Reputation: 743

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)))

Upvotes: 10

Related Questions