I'm clustering a set of points using DBScan algorithm. I have a set of IDs for a set of points and I have a set of clusters, where each cluster has a set of points. I would like to correlate between the clusters and the points ID.
For example I have a set of ids { 1,2,3,4}, Now if I have two cluster and two clusters has two points, then those two points of the first cluster should have the ids 1,2 and for the second one 3,4. Also If I have 4 clusters and each cluster has one point, then the Ids of the points should be 1,2,3, and 4. Furthermore, If I have two clusters but one cluster has 3 points and the other one has one point, then the Ids of the points should be 1,2,3 for the first cluster's points and for the second cluster's point is 4.
I tried to code it, but I'm stopped at calculating the formula to achieve that scenario.
std::vector<int>_IDs;
// for each cluster
for( int j = 0; j<clusters.size();j++ )
{
// for each point in that cluster
for ( int i=0; i < clusters[j].m_Points.size(); i++)
{
// assign its ID from the _IDs array based and save it in Clusters Vector
clusters[j].m_IDs.push_back(_IDs[j+ i*clusters[j].m_Points.size()]);
}
}
Correlating between Cluster and Points
You should probably post this in either general programming or math and physics, because I'm almost completely sure none of this is "for beginners".
I'm clustering a set of points using DBScan algorithm. I have a set of IDs for a set of points and I have a set of clusters, where each cluster has a set of points. I would like to correlate between the clusters and the points ID.
Can you clarify exactly what you mean by "correlate between the clusters and the points ID?" I'm not quite understanding.
For example I have a set of ids { 1,2,3,4}, Now if I have two cluster and two clusters has two points, then those two points of the first cluster should have the ids 1,2 and for the second one 3,4. Also If I have 4 clusters and each cluster has one point, then the Ids of the points should be 1,2,3, and 4. Furthermore, If I have two clusters but one cluster has 3 points and the other one has one point, then the Ids of the points should be 1,2,3 for the first cluster's points and for the second cluster's point is 4.
You lost me here (starting right after the list of IDs). So many clusters and IDs... could you create an image or clear, well formatted example or something that would clarify this? It'd help everyone to know how to help you out.
Agreed. I'm unclear what the clustering criteria are. The IDs, 2D co-ordinates, 3D co-ordinates, other? Are the clusters known ahead of time, or are you trying to dynamically create clusters from the points?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement