I have a graph with dependencies:
dep1 -> dep2 -> ... -> dep3 -> ...
| ^
+-> dep4 |
| |
+-------------------+
I'm looking for unnecessary dependencies, which are those where a direct link exists, but also a link through a sub-dependency. In the above example, the link "dep1 -> dep3" is unnecessary.
The cypher statement to find those would be:
start n = node(*)
match n -[:dependency]-> n2,
n -[:dependency*2..]-> n2
with n, n2
return distinct id(n), n.name, id(n2), n2.name
I tried to solve this issue with a single gremlin statement (with the "table"-step), but I just couldn't make it work. Is this even possible or do I have to solve this with multiple statements?
Any hints, tips, ideas would be appreciated.
Thanks in advance