an efficient function to find the radius by bi-section method , then find neighbors based on the matrix of position, which ensures that each spot has approximately lower.med~upper.med neighbors in the sense of median.

getAdj_auto(pos, lower.med=4, upper.med=6, radius.upper= NULL)

Arguments

pos

a n-by-2 matrix of position.

lower.med

an integer, the lower bound of median number of neighbors among all spots.

upper.med

an integer, the upper bound of median number of neighbors among all spots.

radius.upper

a real, the upper bound of radius, default as NULL. If radius.upper= NULL, the upper bound is automatically determined by algorithm.

Value

A sparse adjacency matrix containing the neighbourhood.

See also