Minimum Spanning Trees COSC 594: Graph Algorithms Spring 2017 By Kevin Chiang and Parker Tooley
Test Questions 1. What is one NP-Hard problem for which Minimum Spanning Trees is a good approximation for? 2. What was the purpose for the first development of a Minimum Spanning Tree algorithm? 3. Who initially wrote Prim's algorithm?
Parker Tooley
Kevin Chiang
Outline 1. 2. 3. 4. 5. 6. 7. Overview History Algorithms Implementations Applications Open Issues Discussion
Overview Spanning Tree - a subgraph of a undirected graph that is a tree including all vertices of the graph, with a minimum number of edges
Overview Minimum Spanning Tree - same as spanning tree, but with minimum total edge weights as well Note - MSTs with directed graphs is a different but analogous problem known as minimum spanning arborescence or optimum branching.
Overview Properties of spanning trees Fundamental cycle - adding any edge to a spanning tree forms a cycle All spanning trees of a graph have V -1 edges Fundamental cutset - deleting one edge of a spanning tree forms two disjoints sets
History First algorithm implementation was by Otakar Borůvka in 1926 purposed for electrical coverage of Moravia in the Czech Republic Otakar Borůvka
History Prim s algorithm was first discovered by Vojtěch Jarnik in 1930, later rediscovered by Robert C. Prim in 1957 Kruskal's algorithm was published in a paper by Joseph Kruskal in 1956 Faster, more complex algorithms have been found. Robert C. Prim Joseph Kruskal
Algorithms Classic, greedy algorithms: Prim's Algorithm Kruskal's Algorithm Borůvka's Algorithm Linear time algorithms Karger, Klein, and Tarjan's Algorithm Chazelle's Algorithm
Algorithms Prim s Algorithm Very similar to Dijkstra s algorithm Process: Start with a random vertex Repeatedly add the closest isolated vertex until the tree spans all nodes O(E + V Log V) using a fibonacci heap O(E Log V) Good with dense graphs
Algorithms Kruskal s algorithms Connects disjoint sets Process Sort edges in non-decreasing order Repeatedly include smallest unincluded edge, discard if cycle forms O(E Log V) Better with sparse graphs Works with spanning forests
Algorithms Borůvka s algorithm Broken into Borůvka s steps All edge weights must be distinct Process Each vertex initially its own set For each set, find the lowest cost edge combine sets, repeat O(ELogV)
Algorithms Classic, greedy algorithms: Prim's Algorithm O(E + VLogV) Kruskal's Algorithm O(ELogV) Borůvka's Algorithm O(ELogV) Linear time algorithms Karger, Klein, and Tarjan's Algorithm Chazelle's Algorithm
Algorithms Karger, Klein, and Tarjan's Algorithm Randomly creates two subgraphs Recursively find minimum spanning forests using Borůvka s steps Expected runtime, O(E) Worst-case O(min{V2, ELogV})
Algorithms Chazelle's Algorithm Fastest non-randomized, comparison based algorithm with known complexity Uses a data structure developed by Chazelle called a soft heap Amortized constant operations O(M*α(m,n)) -- α(m,n) is inverse Ackermann function, extremely slow growth
Implementation Timings Idea: compare Prim's and Kruskal's algorithms on graphs with the primary metric being density Standard implementation of Kruskal's with Union-Find, standard implementation of Prim's with binary heap
Implementations Dataset: 50 graphs with 500 vertices and random density (up to 400,000) edges Observation: Kruskal's is generally faster, though Prim's supposed to be faster as graphs become more dense Possible explanation: Python's sorting algorithm (timsort) is very efficient
Implementations Further tests confirm Kruskal having much better runtime than Prim's in Python 2000 vertices, 2 million edges for the densest graphs
Applications Networking Spanning Tree Protocol prevents loops and redundant paths in a switched network Laying out electrical grids Water supply networks Roads..etc Airports in the U.S.
Approximating TSP These algorithms approximate metric TSP (a NP-Hard problem), which are TSP problems with triangle-inequality: The least cost path from vertex i to j is always the path from i to j, rather than through some other vertex k
Approximating TSP Basic algorithm that is 2-approximate: Create a MST from root of TSP Perform a preorder traversal starting from the start point of the salesman, then add the salesman to the traversal as the end point
Approximating TSP How is it 2-approximate? An optimal TSP with an edge removed is a spanning tree Therefore, the weight of the MST <= TSP with edge removed Due to triangle inequality, 2->4 must be less than 2->1->4
Approximating TSP with Christofides Christofides Algorithm approximates TSP within a factor of 1.5 Algorithm Overview: 1. Create a minimum spanning tree T of graph G 2. Create a set of vertices O with odd degree vertices of T
Approximating TSP with Christofides 3. Find a minimum-weight perfect matching M of the induced subgraph given by vertices O
Approximating TSP with Christofides 4. Combine the edges of the minimum weight perfect matching and the minimum spanning tree to form multigraph H
Approximating TSP with Christofides 5. Form an Eulerian circuit of H 6. Create the Hamiltonian circuit by skipping repeated vertices
Applications Math expression handwriting recognition Symbols found using stroke analysis Need to find baselines Symbols have attraction points Use a minimum spanning tree algorithm Use a dominance function to better associate symbols with each other
Initial spanning tree of strokes Final tree of spacial relations
Applications Assisting Real-time salient object identification
Open issues Can the Euclidean minimum spanning tree of n points in d be computed in time close to the lower bound of Ω(V log V)
References https://en.wikipedia.org/wiki/minimum_spanning_tree https://en.wikipedia.org/wiki/soft_heap https://en.wikipedia.org/wiki/expected_linear_time_mst_algorithm https://en.wikipedia.org/wiki/bor%c5%afvka%27s_algorithm https://github.com/robert-emerson/6161_final/tree/master/boruvka_tree https://sites.google.com/site/wctu1009/cvpr16_mstsaliency http://www.geeksforgeeks.org/travelling-salesman-problem-set-2-approximate-using-mst/ https://en.wikipedia.org/wiki/christofides_algorithm http://page.mi.fu-berlin.de/rojas/2003/grec03.pdf
Discussion
Implementations 15 test graphs from class with random weights assigned to edges Varying V, E, density Python code
Implementations 15 test graphs from class with random weights assigned to edges Varying V, E, density