min()
The reducer function min()
aggregates all values corresponding to the same ID and returns the minimum value.
Accepted parameter types
This function only accepts parameters that can be interpreted as a numeric type.
Example
If we have the following data in a CSV file of the different scores of test takers, and we want to load the lowest score to an attribute of the vertex:
name | score |
---|---|
Tommy |
95 |
Tommy |
93 |
Tommy |
92 |
Amy |
85 |
Amy |
94 |
Amy |
99 |
We can use write the following load statement to use the min()
reduce function to load the minimum of the scores matching each vertex ID.
LOAD f TO VERTEX Person
VALUES ($"name", REDUCE(min($"score"))
After loading, Tommy has a score
attribute of 92 and Amy has a score
attribute of 85.