Best way to get density of game objects

I’m currently trying to determine the location density of player game objects so that my ai picks player game objects that are isolated.

Currently i’m doing a linecast between each player object and getting the distance, but this seems to be fairly expensive.

What would be a better way of getting game obejct location density?

Seems, or is expensive?

If I remember rightly Opensteer had something called a LQ lattice thats an efficient way to find neighbours and do range queries.

Well, on the iPad i do get a spike due to the linecasts.

I will look into the LQ Lattice idea