Design max-spacing k-clustering using MST
Analyze the design max-spacing k-clustering using mst.
Examples
Input: "test_input_1"
Output: "output_1"
Input: "test_input_2"
Output: "output_2"
Hints
Recall that in a Maximum Spacing k-Clustering problem, the goal is to partition the graph into k clusters such that the minimum distance between any two clusters is as large as possible.
Consider how Kruskal's algorithm for Minimum Spanning Trees (MST) can be adapted to achieve this clustering by stopping early when only k clusters remain.
Think about how to efficiently track and merge clusters during the MST construction, and how to compute the spacing between clusters at each step to determine the maximum possible spacing.
Design max-spacing k-clustering using MST
Analyze the design max-spacing k-clustering using mst.