Skip to content

K-Mean clustering algorithm implementation in C++ with GLFW3 OpenGL

Notifications You must be signed in to change notification settings

Haruno19/k-means-opengl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

k-means-opengl

09.2020

K-Means clustering algorithm simulation in C++ with GLFW3 OpenGL.

The output is an animated graphical simulation of the K-means clustering algorithm on a set of randomly generated clusters and data points. The user can input the number of Data Points and Clusters at the start of the program, and then run the simulation.

How it works

Data Points and Clusters are stored in separate linked lists and are dynamically allocated.
Each point is initially positioned in the plane at randomly generated coordinates; the algorithm is simulated by attaching each Data Point to one Cluster based on their coordinates, the Cluster is then moved at the center of its attached Data Points. These two operations are then iterated until no Cluster is moving between one interation and the next, meaning that every Cluster has reached a stable position and each Data Point is attached to its "correct" Cluster.


Sample outputs (stable state)
10000 Data Points and 10 Clusters 1000 Data Points and 9 Clusters 2000 Data Points and 12 Clusters