00:01
We are given a weighted graph and we are asked to use prims algorithm to find a minimum spanning tree for this graph.
00:12
So the graph we're given is a weighted graph on the edges, a, b, c, d, e, f, g, h, i, j -k -l -m -n -o -p.
00:19
It's a very detailed graph, and you can find it in exercise four of this section.
00:26
I'm not going to draw the weighted graph here because i think it will just take too much time.
00:31
I really isn't going to illustrate anything exceptional that the book wouldn't already tell you.
00:37
But to use prims algorithm, first we are drawing the graph with the vertices of our given weighted graph and with no edges between the vertices.
00:51
So our first step is what i've already done here.
00:54
I've drawn the graph of the vertices a through p.
01:01
The next step is to select one of the vertices as a root.
01:05
And now i'm just going to say that a will be the root arbitrarily.
01:13
You could pick another vertex if you wanted to.
01:17
And now we're going to consider the edges incident to a in the weighted graph.
01:22
Well, we have that there are two edges incident to a, and that both edges have the same weight, which is two.
01:31
And so we can choose either edge.
01:34
I'm just going to arbitrarily pick edge ab, or i mean edge a.
01:44
D, my mistake.
02:01
Ok, now the smallest edges are ab and de.
02:04
So i'm going to pick ab, the length of one, or weight of one, i should say.
02:11
And in the next step, we have that there's one edge still incident to a, and two edges now incident to b.
02:20
And the smallest way of these edges is one, which belongs to the edge, ae, which we saw before.
02:26
And if we add this edge, we don't cause a circuit.
02:29
So let's add the edge ae to the graph.
02:32
Also of weight 1, and of the remaining vertices that are incident to a, b, or e, there are multiple vertices that have the minimum weight, which in this case is 2.
02:53
So, let's just arbitrarily choose the edge b .c.
02:59
Now we notice that if we pick the edge b .c and we add it, we don't obtain a circuit, so this is a legal move.
03:06
So we add the edge b .c of weight.
03:08
2.
03:12
And for the next step, the remaining edges that are now incident to a, b, c, or e, we have the smallest weight, which is 1, belongs to the edge cd.
03:24
Now if we add the edge cd to the graph, we don't obtain a circuit, so this is a valid move, and we add cd with a weight of 1 to the graph.
03:35
In the next step, we have, of all the remaining edges that are incident to a, b, c, d, or e, the smallest weight of one again...