Gremlin: Count connections ignoring edges with a parallel edge in the opposing direction In this question, I like to know if there is a way to find vertices which are connected in both ways from a given vertex. We know dedup() is there to avoid duplicate. But is there any way to find the vertices which have parallel edges?
1 Answers
0
votes
Searching vertices with parallel edges is a special case of cycle detection.
You can find the recipe for the cycle detection here.
A simplified version of the code to match your case:
g.V().as('a').
out().simplePath().where(out().as('a')).
path().dedup().by(unfold().
order().by(id).
dedup().fold())
example: https://gremlify.com/8c