Correlating between Cluster and Points

Started by
2 comments, last by jefferytitan 11 years, 7 months ago
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()]);

}
}
Advertisement
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 a game programmer and computer science ninja !

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here !


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.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
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