Hi,
I'm using Neo4j gremlin console and attempting the recipe for paths
between two nodes. I see odd results and need some help.
I get different results if I change the it.loops<X condition and don't
understand why. Also, the last condition (< 2) produces a path that
was never indicated in the previous two conditions (<=3, <3)
The example given is:
g.v(A).out.loop(1){it.loops<=N && !(
it.object.id in
[A,B])}.filter{
it.id==B}.paths
How does one select the value of N, since my results seem dependent on
it. Only paths that seem to be exactly N hops away are generated and
the shorter paths
are excluded. Is that right? If so, it means some paths cannot be
found with some queries, like the results below.
gremlin> g.v(35).out.loop(1){it.loops<3}.paths
==> [v[35], v[41], v[42]]
==> [v[35], v[41], v[42]]
==> [v[35], v[41], v[42]]
==> [v[35], v[41], v[42]]
gremlin> g.v(35).out.loop(1){it.loops<=3}.paths
==> [v[35], v[41], v[42], v[55]]
==> [v[35], v[41], v[42], v[55]]
==> [v[35], v[41], v[42], v[55]]
==> [v[35], v[41], v[42], v[55]]
==> [v[35], v[41], v[42], v[55]]
==> [v[35], v[41], v[42], v[55]]
==> [v[35], v[41], v[42], v[55]]
==> [v[35], v[41], v[42], v[55]]
gremlin> g.v(35).out.loop(1){it.loops<2}.paths
==> [v[35], v[36]]
==> [v[35], v[36]]
==> [v[35], v[36]]
==> [v[35], v[36]]
==> [v[35], v[36]]
==> [v[35], v[36]]
==> [v[35], v[36]]
==> [v[35], v[36]]
==> [v[35], v[41]]
==> [v[35], v[41]]
gremlin>