Divide-and-Conquer MST Pasi Fränti 27.10.2016
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 byO(M) Time complexity for full graph O(N2) because M=N2. 5 8 1 3 2 6 10 4 7
Prim’s algorithm example 5 8 1 3 2 6 10 4 7
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: Create meta graph where one node per cluster Solve MST for the meta graph Combine MSTs of the meta graph and clusters
Example 8 5 5 5 3 6 1 2 6 8 2 4 5 5 10 1 7 3 3 Example by: Michiyo Ashida (IMPIT’2010)
Step 1: Divide the graph into N sub-graph by clustering 8 5 5 5 3 6 1 2 6 8 2 4 5 5 10 1 7 3 3
Step 2: Solve each sub-problem by Prim’s algorithm 8 5 5 5 3 6 1 2 6 8 2 4 5 5 10 1 7 3 3
Step 3.1 (a): Select center point for each cluster 8 5 3 6 1 2 6 8 2 4 5 5 10 1 7 3 3
Step 3.1 (b): Connect the nodes of this meta graph 8 5 3 6 1 2 6 8 2 4 5 5 10 1 7 3 3
Step 3.1 (c): Set the weights based on shortest distances 8 5 1 3 6 1 2 6 8 2 3 4 4 5 5 10 1 7 3 3
Step 3.2: Solve MST for the meta graph 8 5 1 3 6 1 2 6 8 2 3 4 4 5 5 10 1 7 3 3
Step 3.3: Select the corresponding links 8 5 1 3 6 1 2 6 8 2 3 4 5 5 10 1 7 3 3
Step 3.3: Add links from the MST of the meta graph 8 5 3 6 1 2 6 8 2 4 5 5 10 1 7 3 3 Total weight = 21
Optimality of the solution? 8 Remove 5 3 6 1 2 6 8 2 4 5 5 10 1 7 3 Add 3 Better solution: Total weight = 20
Bigger example Clustering Dataset Clustering
Bigger example Creation of MST Cluster-level MST Connecting clusters
Time complexity Step 1 Step 2 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 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 1.5 Solve meta graph: (N)2 = N Add links: N
Refinement stage Step 1: Calculate midpoints of links in the meta graph Step 2: Cluster based on midpoints Step 3: Solve each cluster by Prim's algorithm Step 4: Merge the 1st MST with the 2nd MST
Mid-points
Secondary clustering
Secondary MST within clusters 8 5 3 1 2 6 6 8 2 4 5 5 10 1 7 3 3
Secondary MST between clusters 8 5 3 1 2 6 6 8 2 4 5 5 10 1 7 3 3
Merge of 1st and 2nd MST 8 5 3 6 1 2 6 8 2 4 5 5 10 1 7 3 3
Final MST 8 5 3 6 1 2 6 8 2 4 5 5 10 1 7 3 3 Total weight = 20
Illustration with collinear partition
Experiments t4.8k Processing time Approximation error
Experiments ConfLongDemo Processing time Approximation error
Effect of cluster size n
Effect of cluster size n
Blank space for notes