0% found this document useful (0 votes)
62 views7 pages

MST - Kruskals Algorithm PDF

The document describes Kruskal's algorithm for finding a minimum spanning tree in a weighted graph. Kruskal's algorithm collects the edges of the graph sorted by weight from lowest to highest. It then adds edges to the spanning tree one by one, only if the edge connects two components that were previously not connected. This ensures a cycle is not formed. The running example shows applying Kruskal's algorithm to a graph with 6 vertices and connecting them with the minimum cost set of edges.

Uploaded by

sudhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views7 pages

MST - Kruskals Algorithm PDF

The document describes Kruskal's algorithm for finding a minimum spanning tree in a weighted graph. Kruskal's algorithm collects the edges of the graph sorted by weight from lowest to highest. It then adds edges to the spanning tree one by one, only if the edge connects two components that were previously not connected. This ensures a cycle is not formed. The running example shows applying Kruskal's algorithm to a graph with 6 vertices and connecting them with the minimum cost set of edges.

Uploaded by

sudhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Graph – Minimum Spanning

Tree – Kruskal Algorithm

P VASUKI
Definition
• A (free) tree is a connected undirected
graph with no cycles.

• A spanning tree for an undirected graph is


a free tree that contains all of its vertices
– spanning trees exists iff the graph is
connected

• For example, given n islands and a desire


to connect them with bridges, the minimal
set of bridges forms a spanning tree.
• The minimal set of bridges has size n-1
– spanning trees always have n-1 edges

• Minimizing the total cost of constructing the


bridges corresponds to finding a minimum
cost spanning tree.

• Here we begin with a weighted graph where


the cost of the edge {v,w} is the cost of
building the bridge between v and w.
– not the cost of using it
• Kruskal algorithm collects the edges
• Retrieve the edges using Minheap
(Min heap – pushes the element with
minimum cost)

• If the edge connects the edges,


which are not connected earlier add it
to the tree, if not leave it.
Kruskal’s Algorithm – Example

A
A
6
12

B 5 C C
8 B
12

12 D 7 D
3 1 1
9 F
F
E
E
A
A

B 5 C
B C

D
D 1
1 3
3 F
F
E
E
A
A
6
6

B 8 5 C
B 5 C

D D
1 1
3 3
F F
E E

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy