Graph Algorithms: Minimum Spanning Tree - PowerPoint PPT Presentation

About This Presentation
Title:

Graph Algorithms: Minimum Spanning Tree

Description:

A spanning tree T = (V', E') is a subgraph of G such that V' = V and T is a tree. ... Prim's algorithm for finding a minimum spanning tree: ... – PowerPoint PPT presentation

Number of Views:183
Avg rating:3.0/5.0
Slides: 12
Provided by: DavidR6
Learn more at: http://www.cs.rpi.edu
Category:

less

Transcript and Presenter's Notes

Title: Graph Algorithms: Minimum Spanning Tree


1
Graph Algorithms Minimum Spanning Tree
We are given a weighted, undirected graph G (V,
E), with weight function w E ? R mapping edges
to real valued weights.
1
5
10
1
3
8
2
4
3
1
1
4
6
6
5
2
2
Graph Algorithms Minimum Spanning Tree
We are given a weighted, undirected graph G (V,
E), with weight function w E ? R mapping edges
to real valued weights.
1
A spanning tree T (V, E) is a subgraph of G
such that V V and T is a tree.
5
10
1
3
8
2
4
3
1
1
4
6
6
5
2
3
Graph Algorithms Minimum Spanning Tree
We are given a weighted, undirected graph G (V,
E), with weight function w E ? R mapping edges
to real valued weights.
1
A spanning tree T (V, E) is a subgraph of G
such that V V and T is a tree.
5
10
1
3
8
2
4
3
1
A minimum spanning tree is a spanning tree where
the sum of the weights in E is minimal.
1
4
6
6
5
2
4
Graph Algorithms Minimum Spanning Tree
Prims algorithm for finding a minimum spanning
tree 1. Starting from an empty tree, T, pick a
vertex, v0, at random and initialize V v0
and E .
v0
1
5
10
1
3
8
2
4
3
1
1
4
6
6
5
2
5
Graph Algorithms Minimum Spanning Tree
Prims algorithm for finding a minimum spanning
tree 1. Starting from an empty tree, T, pick a
vertex, v0, at random and initialize V v0
and E .
v0
1
2. Choose a vertex v not in V such that edge
weight from v to a vertex in V is minimal.
5
10
1
3
8
2
4
3
1
1
4
6
6
5
2
6
Graph Algorithms Minimum Spanning Tree
Prims algorithm for finding a minimum spanning
tree 1. Starting from an empty tree, T, pick a
vertex, v0, at random and initialize V v0
and E .
v0
1
2. Choose a vertex v not in V such that edge
weight from v to a vertex in V is minimal and no
cycle will be created if v and the edge are added
to (V, E). Add v to V and the edge to E.
5
10
1
3
8
2
4
3
1
1
4
6
6
5
2
7
Graph Algorithms Minimum Spanning Tree
Prims algorithm for finding a minimum spanning
tree 1. Starting from an empty tree, T, pick a
vertex, v0, at random and initialize V v0
and E .
v0
1
2. Choose a vertex v not in V such that edge
weight from v to a vertex in V is minimal and no
cycle will be created if v and the edge are added
to (V, E). Add v to V and the edge to
E. Repeat until all vertices have been added.
5
10
1
3
8
2
4
3
1
1
4
6
6
5
2
8
Graph Algorithms Minimum Spanning Tree
Prims algorithm for finding a minimum spanning
tree 1. Starting from an empty tree, T, pick a
vertex, v0, at random and initialize V v0
and E .
v0
1
2. Choose a vertex v not in V such that edge
weight from v to a vertex in V is minimal and no
cycle will be created if v and the edge are added
to (V, E). Add v to V and the edge to
E. Repeat until all vertices have been added.
5
10
1
3
8
2
4
3
1
1
4
6
6
5
2
9
Graph Algorithms Minimum Spanning Tree
Prims algorithm for finding a minimum spanning
tree 1. Starting from an empty tree, T, pick a
vertex, v0, at random and initialize V v0
and E .
v0
1
2. Choose a vertex v not in V such that edge
weight from v to a vertex in V is minimal and no
cycle will be created if v and the edge are added
to (V, E). Add v to V and the edge to
E. Repeat until all vertices have been added.
5
10
1
3
8
2
4
3
1
1
4
6
6
5
2
10
Graph Algorithms Minimum Spanning Tree
Prims algorithm for finding a minimum spanning
tree 1. Starting from an empty tree, T, pick a
vertex, v0, at random and initialize V v0
and E .
v0
1
2. Choose a vertex v not in V such that edge
weight from v to a vertex in V is minimal and no
cycle will be created if v and the edge are added
to (V, E). Add v to V and the edge to
E. Repeat until all vertices have been added.
5
10
1
3
8
2
4
3
1
1
4
6
6
5
2
11
Graph Algorithms Minimum Spanning Tree
Prims algorithm for finding a minimum spanning
tree 1. Starting from an empty tree, T, pick a
vertex, v0, at random and initialize V v0
and E .
v0
1
2. Choose a vertex v not in V such that edge
weight from v to a vertex in V is minimal and no
cycle will be created if v and the edge are added
to (V, E). Add v to V and the edge to
E. Repeat until all vertices have been added.
Done!
5
10
1
3
8
2
4
3
1
1
4
6
6
5
2
Sum of edge weights 1 3 4 1 1 10.
Write a Comment
User Comments (0)
About PowerShow.com