Prims Algorithm for finding a minimum spanning tree - PowerPoint PPT Presentation

About This Presentation
Title:

Prims Algorithm for finding a minimum spanning tree

Description:

Prims Algorithm for finding a minimum spanning tree 115 90 52 35 45 55 20 40 110 120 100 32 50 60 38 88 30 25 70 A 70 Starting at vertex A, choose the edge of least ... – PowerPoint PPT presentation

Number of Views:873
Avg rating:3.0/5.0
Slides: 12
Provided by: Math198
Learn more at: https://math.gmu.edu
Category:

less

Transcript and Presenter's Notes

Title: Prims Algorithm for finding a minimum spanning tree


1
Prims Algorithmfor finding a minimum spanning
tree
115
90
52
35
45
55
20
40
110
120
100
32
50
60
38
88
30
25
70
A
70
Starting at vertex A, choose the edge of least
weight. Your choices are shown in green.. The
edge with least weight 25 will be the first edge
in the tree.
2
From now on, the tree will be marked in blue.
Consider all edges with one end in the blue tree
so far and one end outside. Your choices are in
green. Choose the one of least weight and add it
to the tree. That is the edge marked with weight
30.
115
90
52
35
45
55
20
40
110
120
100
32
50
60
38
88
30
25
70
A
70
3
Consider all edges with one end in the blue tree
so far and one end outside. Your choices are in
green. Notice that one edge of weight 70 now has
both ends in the tree, so it is no longer a
choice. Choose the one of least weight and add it
to the tree. The least weight edge is marked with
50.
115
90
52
35
45
55
20
40
110
120
100
32
50
60
38
88
30
25
70
A
70
4
Consider all edges with one end in the blue tree
so far and one end outside. Your choices are in
green. As we continue adding edges to the tree,
some green edges are changed back to black
because they have both ends in the tree. Choose
the one of least weight and add it to the tree.
The least weight edge is marked with 40.
115
90
52
35
45
55
20
40
110
120
100
32
50
60
38
88
30
25
70
A
70
5
Consider all edges with one end in the blue tree
so far and one end outside. Your choices are in
green. Choose the one of least weight and add it
to the tree. The least weight edge is marked with
55.
115
90
52
35
45
55
20
40
110
120
100
32
50
60
38
88
30
25
70
A
70
6
Consider all edges with one end in the blue tree
so far and one end outside. Your choices are in
green. Choose the one of least weight and add it
to the tree. The least weight edge is marked with
70.
115
90
52
35
45
55
20
40
110
120
100
32
50
60
38
88
30
25
70
A
70
7
Consider all edges with one end in the blue tree
so far and one end outside. Your choices are in
green. Choose the one of least weight and add it
to the tree. The least weight edge is marked with
38.
115
90
52
35
45
55
20
40
110
120
100
32
50
60
38
88
30
25
70
A
70
8
Consider all edges with one end in the blue tree
so far and one end outside. Your choices are in
green. Choose the one of least weight and add it
to the tree. The least weight edge is marked with
20.
115
90
52
35
45
55
20
40
110
120
100
32
50
60
38
88
30
25
70
A
70
9
Consider all edges with one end in the blue tree
so far and one end outside. Your choices are in
green. Choose the one of least weight and add it
to the tree. The least weight edge is marked with
32.
115
90
52
35
45
55
20
40
110
120
100
32
50
60
38
88
30
25
70
A
70
10
Consider all edges with one end in the blue tree
so far and one end outside. Your choices are in
green. Choose the one of least weight and add it
to the tree. The least weight edge is marked with
35.
115
90
52
35
45
55
20
40
110
120
100
32
50
60
38
88
30
25
70
A
70
11
Done!
Now the blue tree contains all the vertices of
the graph, so it is a spanning tree. The total
weight is 395
115
90
52
35
45
55
20
40
110
120
100
32
50
60
38
88
30
25
70
A
70
Write a Comment
User Comments (0)
About PowerShow.com