DivideandConquer MST Pasi Frnti 27 10 2016 Based
Divide-and-Conquer MST Pasi Fränti 27. 10. 2016 Based on: C. Zhong, M. I. Malinen, D. Miao and P. Fränti "A fast minimum spanning tree algorithm based on K-means“ Information Sciences 295, 1 -17, February 2015
Minimum spanning tree Prim’s algorithm: • N nodes and M links. • Creates tree by adding links one-by-one • Always shortest link that connects one new node • Even best solutions lower limited by O(M) • Time complexity for full graph O(N 2) because M=N 2. 8 5 3 6 1 2 6 8 2 4 5 10 3 1 7 3 5
Prim’s algorithm example 8 5 3 6 1 2 6 8 2 4 5 10 3 1 7 3 5
O(N 1. 5) divide-and-conquer algorithm for Minimum Spanning Tree problem C. Zhong, M. I. Malinen, D. Miao and P. Fränti, "A fast minimum spanning tree algorithm based on K-means", Information Sciences 295, 1 -17, February 2015. Step 1: Divide the graph into N clusters Step 2: Solve each cluster by Prim's algorithm Step 3: Merge the results of clusters: l Create meta graph where one node per cluster l Solve MST for the meta graph l Combine MSTs of the meta graph and clusters
Example 8 5 3 6 1 2 8 2 4 5 10 3 1 7 3 Example by: Michiyo Ashida (IMPIT’ 2010) 6 5
Step 1: Divide the graph into N sub-graph by clustering 8 5 3 6 1 2 6 8 2 4 5 10 3 1 7 3 5
Step 2: Solve each sub-problem by Prim’s algorithm 8 5 3 6 1 2 6 8 2 4 5 10 3 1 7 3 5
Step 3. 1 (a): Select center point for each cluster 8 5 3 6 1 2 6 8 2 4 5 10 3 1 7 3 5
Step 3. 1 (b): Connect the nodes of this meta graph 8 5 3 6 1 2 6 8 2 4 5 10 3 1 7 3 5
Step 3. 1 (c): Set the weights based on shortest distances 8 5 3 1 6 1 2 6 8 2 3 4 5 3 4 1 7 3 10 5
Step 3. 2: Solve MST for the meta graph 8 5 3 1 6 1 2 6 8 2 3 4 5 3 4 1 7 3 10 5
Step 3. 3: Select the corresponding links 8 5 3 1 6 1 2 6 8 2 3 4 5 10 3 1 7 3 5
Step 3. 3: Add links from the MST of the meta graph 8 5 3 6 1 2 6 8 2 4 5 10 3 1 7 3 Total weight = 21 5
Optimality of the solution? 8 5 3 6 Remove 1 2 6 8 2 4 5 10 3 Better solution: Total weight = 20 1 7 3 5 Add
Bigger example Clustering Dataset Clustering
Bigger example Creation of MST Cluster-level MST Connecting clusters
Time complexity Step 1 Cluster to N sub-graphs: O(k∙N) = N∙N = N 1. 5 Step 2 k= N sub-problems of size N /k = N /N 1/2 = N Prim's for one: ( N)2 = N For All sub-problems: N∙N = N 1. 5 Step 3 Construct meta graph: ( N)∙( N)2 = N Solve meta graph: ( N)2 = N Add links: N 1. 5
Refinement stage Step 1: 2: 3: 4: Calculate midpoints of links in the meta graph Cluster based on midpoints Solve each cluster by Prim's algorithm Merge the 1 st MST with the 2 nd MST
Mid-points
Secondary clustering
Secondary MST within clusters 8 5 3 1 6 2 6 8 2 4 5 10 3 1 7 3 5
Secondary MST between clusters 8 5 3 1 6 2 6 8 2 4 5 10 3 1 7 3 5
Merge of 1 st and 2 nd MST 8 5 3 6 1 2 6 8 2 4 5 10 3 1 7 3 5
Final MST 8 5 3 6 1 2 6 8 2 4 5 10 3 1 7 3 Total weight = 20 5
Illustration with collinear partition
Experiments t 4. 8 k Processing time Approximation error
Experiments Conf. Long. Demo Processing time Approximation error
Effect of cluster size n
Effect of cluster size n
Blank space for notes
- Slides: 30