@@ -194,6 +194,10 @@ MATCH path=(n {id: 0})-[* (r, n, p | r.eu_border = false AND n.drinks_USD < 15 A
194
194
RETURN path;
195
195
```
196
196
197
+ ** Note:** ` last(relationships(p)) ` returns the most recent relationship in the
198
+ current traversal path p, allowing you to filter based on how the current node
199
+ was reached.
200
+
197
201
## Breadth-first search
198
202
199
203
In breadth-first search (BFS) traversal starts from a single node, and the order of
@@ -348,6 +352,10 @@ MATCH path=(n {id: 0})-[*BFS (r, n, p | r.eu_border = false AND n.drinks_USD < 1
348
352
RETURN path;
349
353
```
350
354
355
+ ** Note:** ` last(relationships(p)) ` returns the most recent relationship in the
356
+ current traversal path p, allowing you to filter based on how the current node
357
+ was reached.
358
+
351
359
## Constraining the expansion based on the number of hops
352
360
353
361
### Overview
@@ -641,6 +649,10 @@ MATCH path=(n {id: 0})-[*WSHORTEST (r, n | n.total_USD) total_weight (r, n, p, w
641
649
RETURN path, total_weight;
642
650
```
643
651
652
+ ** Note:** ` last(relationships(p)) ` returns the most recent relationship in the
653
+ current traversal path p, allowing you to filter based on how the current node
654
+ was reached.
655
+
644
656
## All shortest paths
645
657
646
658
Finding all shortest paths is an expansion of the weighted shortest paths problem. The goal
@@ -779,4 +791,8 @@ MATCH path=(n {id: 0})-[*ALLSHORTEST (r, n | n.total_USD) total_weight (r, n, p,
779
791
RETURN path, total_weight;
780
792
```
781
793
794
+ ** Note:** ` last(relationships(p)) ` returns the most recent relationship in the
795
+ current traversal path p, allowing you to filter based on how the current node
796
+ was reached.
797
+
782
798
<CommunityLinks />
0 commit comments