给定:在二维平面上有一组N个点(x和y坐标),以及与每个点对应的N个半径。我们将称一个点的圆盘为以该点为中心并具有其半径的圆盘。
问题:聚类这些点。点的聚类是指每个点要么落在集群中至少一个其他点的圆盘内,要么至少一个其他点在该点的圆盘内。单个点不算做聚类。
我需要一种高效的算法来计算这个问题(最好不使用复杂的空间哈希技术,例如kd树)。我可以接受O(N^2)运行时间,但绝对不能超过O(N^3)。我觉得这应该很简单,但我卡在了聚类条件的非对称性上。
实质上,我正在寻找填充C函数原型的方法:
int cluster_points(
size_t n,
point_t *pt, // length n list of points
double *radius, // length n list of radii for each point
int *cluster, // length n list of cluster indexes; -1 if not clustered
size_t *ncluster // number of clusters (number of distinct non -1 entries in cluster)
);
这不是作业。我需要它作为聚类复数矩阵算法的一部分。