Docsity

Algorithms for Minimum Spanning Tree with Priority Queues and Union-Find, Study notes of Algorithms and Programming

Partial preview of the text

Download Algorithms for Minimum Spanning Tree with Priority Queues and Union-Find and more Study notes Algorithms and Programming in PDF only on Docsity!

CS 473ug: Algorithms

Mahesh Viswanathan

[email protected]

3232 Siebel Center

University of Illinois, Urbana-Champaign

Spring 2008

Minimum Spanning Tree

Part I

Greedy Algorithms: Minimum Spanning Tree

Minimum Spanning Tree The Algorithms Correctness

Minimum Spanning Tree

Input Connected graph G = (V , E ) with edge costs

Goal Find T ⊆ E such that (V , T ) is connected and total

cost of all edges in T is smallest

T is the minimum spanning tree (MST) of G

Minimum Spanning Tree The Algorithms Correctness

Applications

Network Design

Designing networks with minimum cost but maximum

connectivity

Approximation algorithms

Can be used to bound the optimality of algorithms to

approximate Travelling Salesman Problem, Steiner Trees, etc.

Cluster Analysis

Minimum Spanning Tree The Algorithms Correctness

Kruskal’s Algorithm

Process edges in the order of their costs (starting from the least)

and add edges to T as long as they don’t form a cycle.

Figure: Graph G

Figure: MST of G

Back

Minimum Spanning Tree The Algorithms Correctness

Kruskal’s Algorithm

Process edges in the order of their costs (starting from the least)

and add edges to T as long as they don’t form a cycle.

Figure: Graph G

Figure: MST of G

Back

Minimum Spanning Tree The Algorithms Correctness

Kruskal’s Algorithm

Process edges in the order of their costs (starting from the least)

and add edges to T as long as they don’t form a cycle.

Figure: Graph G

Figure: MST of G

Back

Minimum Spanning Tree The Algorithms Correctness

Kruskal’s Algorithm

Process edges in the order of their costs (starting from the least)

and add edges to T as long as they don’t form a cycle.

Figure: Graph G

Figure: MST of G

Back

Minimum Spanning Tree The Algorithms Correctness

Kruskal’s Algorithm

Process edges in the order of their costs (starting from the least)

and add edges to T as long as they don’t form a cycle.

Figure: Graph G

Figure: MST of G

Back

Minimum Spanning Tree The Algorithms Correctness

Prim’s Algorithm

T maintained by algorithm will be a tree. In each iteration, pick

edge with least attachment cost to T.

Figure: Graph G

Figure: MST of G

Back

Minimum Spanning Tree The Algorithms Correctness

Prim’s Algorithm

T maintained by algorithm will be a tree. In each iteration, pick

edge with least attachment cost to T.

Figure: Graph G

Figure: MST of G

Back

Minimum Spanning Tree The Algorithms Correctness

Prim’s Algorithm

T maintained by algorithm will be a tree. In each iteration, pick

edge with least attachment cost to T.

Figure: Graph G

Figure: MST of G

Back

Minimum Spanning Tree The Algorithms Correctness

Prim’s Algorithm

T maintained by algorithm will be a tree. In each iteration, pick

edge with least attachment cost to T.

Figure: Graph G

Figure: MST of G

Back

Minimum Spanning Tree The Algorithms Correctness

Prim’s Algorithm

T maintained by algorithm will be a tree. In each iteration, pick

edge with least attachment cost to T.

Figure: Graph G

Figure: MST of G

Back