Recurse with calculated field

I’m not sure if you could do this, but maybe yes.

With math functions, Var block and K-Shortest Path you might get something interesting.

I’m not sure if Recurse would be your case, it’s used to penetrate and expand Nodes via a set of predicates (with filter, facets, etc.). https://docs.dgraph.io/query-language#recurse-query

check this example Flattening to get unique nodes within n steps

For your SET example, I see you want to expand just one user and relate to others until you reach a certain minimum value. Recurse would do this separately, would not relate things (But you might get something by using Var Block in sequences). In that case something like K-Shortest might be the case. But not sure exactly.

This week I’m focused on some tests with Dgraph, I can not delve into your case. But I can get your doubts to come.

Math on value variables
https://docs.dgraph.io/query-language#math-on-value-variables

Aggregation
https://docs.dgraph.io/query-language#aggregation

Var Blocks
https://docs.dgraph.io/query-language#var-blocks

Facets and Variable Propagation
https://docs.dgraph.io/query-language#facets-and-variable-propagation

Facets and Aggregation
https://docs.dgraph.io/query-language#facets-and-aggregation

K-Shortest Path Queries
https://docs.dgraph.io/query-language#k-shortest-path-queries