Presentation is loading. Please wait.

Presentation is loading. Please wait.

Minimal Spanning Tree Problems 204.302 in 2005. What is a minimal spanning tree An MST is a tree (set of edges) that connects all nodes in a graph, using.

Similar presentations


Presentation on theme: "Minimal Spanning Tree Problems 204.302 in 2005. What is a minimal spanning tree An MST is a tree (set of edges) that connects all nodes in a graph, using."— Presentation transcript:

1 Minimal Spanning Tree Problems 204.302 in 2005

2 What is a minimal spanning tree An MST is a tree (set of edges) that connects all nodes in a graph, using the smallest total cost possible. There will be n-1 edges in the MST for a graph with n nodes. We will see three algorithms that find the optimal solution to the MST problem, and a fourth which is a blend of two of these.

3 Optimal? These solutions are only optimal for undirected graphs, or in other words, graphs with symmetric distance matrices. We will work through a symmetric problem in class. A directed graph may lead to a tree that has some edges that emanate from leaf nodes on the tree, and some that terminate at leaf nodes. This may be a problem in itself and may not lead to a feasible problem for the actual problem you are solving.

4 Boruvka’s algorithm Invented in 1926 to supply electricity around Bohemia. It follows the steps Start with each node as a separate tree. Find the shortest link from each tree to any other tree. Place all of these edges into the solution. Continue linking trees until a single tree remains.

5 Boruvka’s algorithm cont’d This algorithm merges pairs of trees at each iteration. You will often link a pair of trees twice, but can at times link three or more trees in the forest. Has been shown to run in time of O(m log(n)). Where m and n are the number of edges and nodes respectively.

6 Prim’s algorithm Prim’s algorithm has been “invented” three times, so is at times known by other names. It follows the steps: Start with a single node as the current set of nodes. Of all edges that link one of the current nodes to a node not yet included in the tree, find the edge with the minimum cost and add it to the tree. Repeat until all nodes are in the tree.

7 Prim’s algorithm cont’d Prim’s algorithm differs from the other two we look at because it focuses on the nodes of the graph rather than the edges. It runs in time of O(m + nlog(n)) which is shorter than Boruvka’s algorithm when m>>n..

8 Kruskal’s algorithm. Kruskal’s algorithm is called “greedy” as it looks for the best thing to do at each stage. It follows the steps: Sort all edges into ascending order of cost. Working through the list of edges in order of cost, add an edge to the tree if it does not form a cycle in the graph. Continue until the list of edges is exhausted.

9 Kruskal’s algorithm cont’d Used by many software packages because of its simplicity, this algorithm runs in time of O(m log(n)). It is therefore considered to be significantly faster than Prim’s algorithm, but this will depend on the number of edges vs nodes in the graph.

10 A hybrid algorithm Because the various algorithms do a different amount of work in each iteration, it has been shown to be a good idea to switch between algorithms to gain extra efficiency. If Boruvka’s algorithm is used until a certain number of merges has been sought, then Prim’s algorithm takes over, an MST can be found in time of O(m log log n).

11 A maximal spanning tree problem Christofides (1975) needed to use a maximal spanning tree in a reliability problem. Probabilities needed to be multiplied together, so logs were taken. Multiplying by -1 gave a set of values that could then be used with a minimal spanning tree algorithm.

12 Other constraints Other problems based on minimal spanning trees include: Degree Constrained Spanning Tree - Finding a tree whose node with the highest degree is constrained to be less than some predetermined integer. Maximum leaf spanning tree - Finding a tree with at least a predetermined number of leaves. Shortest total path length spanning tree - Finding a spanning tree such that no path between two nodes exceeds a predetermined length. Bounded diameter spanning tree - Finding a spanning tree such that no pair of nodes has more than a predetermined number of arcs in their path, while minimizing the total length of the spanning tree.


Download ppt "Minimal Spanning Tree Problems 204.302 in 2005. What is a minimal spanning tree An MST is a tree (set of edges) that connects all nodes in a graph, using."

Similar presentations


Ads by Google