Dr. Thomas C. King
Dr. Thomas C. King

Reputation: 1034

How to find vertices that have at least one single-direction links in Gremlin?

I am trying to find each vertex that has a one-way connection to at least one other vertex. This is what I have, but it is clearly wrong.

g.V().has("label","SomeVertex").as('Vertex').Out().where(__.in().hasNot('Vertex'))

Any ideas? Thank you!

Upvotes: 2

Views: 82

Answers (1)

noam621
noam621

Reputation: 2856

You can try something like that:

g.V().as('a').
  where(out().not(where(out().as('a'))))

example: https://gremlify.com/8m

Upvotes: 1

Related Questions