Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 822
Robert Saccone Avatar asked Dec 25 '22 02:12

Robert Saccone


1 Answers

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)))
like image 122
Alaa Mahmoud Avatar answered May 12 '23 18:05

Alaa Mahmoud