Nearest_neighbor() and euclidean_distance in Agents

Hey,

Im working with interaction_pair() function which uses nearest_neighbor() to find a pair. Now while applying this function I feel that doesn’t matter how small r value we give in nearest_neighbor(model[2], model, 10^-100) there is a limit and it finds neighbor based on that.

Euclidean distance output for neighbor :

julia> euclidean_distance(model[2].pos, nearest_neighbor(model[2], model, 10^-100).pos, model)
0.07715281063325427

Now this value is pretty big as compare to radius given in nearest_neighbor fucntion. I will not expect it to find any neighbor based on that r value. Its just too small.

Im afraid that Im mixing different ideas here? does that r has any significance in that function ?

Thank you :slight_smile:

file a bug report with a reproducible MWE!

Done. Conflict between nearest_neighbor() function and euclidean distance for agent pair. · Issue #1043 · JuliaDynamics/Agents.jl · GitHub