I have CALL apoc.algo.allSimplePaths(A, B, '', 3)
result that look like this:
- [A –>relation1 –>B]
- [A –>relation2 –>B]
- [A –>relation2->C->relation 1–>B]
- [A –>relation5->D->relation 3–>B]
- [A –>relation2->Y->relation 1–>B]
- [A –>relation2->E->relation 1–>B]
- [A –>relation2->D–>relation2->F->relation 1–>B]
- [A –>relation2->F–>relation4->Y->relation 2–>B]
Desired result: FOREACH pathlength, randomly return 1 row
[A –>relation2 –>B]
[A –>relation2->Y->relation 1–>B]
[A –>relation2->D–>relation2->F->relation 1–>B]
The result is representative of all pathlengths:
The first row:
[A –>relation2 –>B] is a sample from path length 1 The second row:
[A –>relation2->Y->relation 1–>B is a sample from path length 2 the third row:
[A –>relation2->D–>relation2->F->relation 1–>B]. is a sample from path length 3