apoc.coll.pairsMin
Syntax |
|
||
Description |
Returns |
||
Arguments |
Name |
Type |
Description |
|
|
The list to create pairs from. |
|
Returns |
|
Usage examples
The following examples create a list of lists, where each nested list contains adjacent element pairs from the input list, skipping the last adjacent pair ([5, null]
in this example), using both APOC and Cypher:
apoc.coll.pairsMin
RETURN apoc.coll.pairsMin([1,2,3,4,5]) AS output;
Cypher’s UNWIND
WITH [1,2,3,4,5] AS list
RETURN [i IN range(0, size(list) - 2) | [list[i], list[i + 1]]] AS value
Output |
---|
[[1, 2], [2, 3], [3, 4], [4, 5]] |