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.
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.
10000 Data Points and 10 Clusters | 1000 Data Points and 9 Clusters | 2000 Data Points and 12 Clusters |