00:01
All right, for this problem, we have to solve the breadth first search and depth first search using prologue program for the graph that was given.
00:15
And this is how it looks like.
00:16
It looks like this.
00:18
You have a, you have b, you have c.
00:20
A connected to b, connected to c.
00:25
C is connected to f.
00:27
I'm just going to do a rough thing here.
00:29
You have e here and e is connected to a.
00:33
Okay, do that again.
00:35
A is a and then a is connected to d and d is connected to g.
00:42
G goes to h and h finally to i.
00:47
So that, oh, sorry, one more thing.
00:50
G also is connected to e.
00:53
And we are told to use numbers, like a hint, to use numbers.
00:59
1 to 9 instead of a to i to make breadth first search tree from above graph or the graph we have here.
01:12
And we're started from this node.
01:15
All right, we start from here.
01:18
So that is what the question is required for us to do.
01:25
All right, so how are we going to go about this? well, clearly, first thing to do here is to name this to, well, change this a to 1, b to 2, c to 3, d to 4, e to 5, f to 6, you guys, g7, h8, and i would be 9.
01:52
All right, so that's an easy thing to do.
01:55
And we can see all the connections here.
01:59
And we are also going to assume this is an undirected graph, which will mean that each edge can be traversed in both directions, right? so that is something we're going to think about.
02:14
So, well, the breadth first search, how we're going to do that, is we are going to start with a, which is one.
02:24
And then what is one? one is connected to two, one is also connected to four, right? and it's also connected to five.
02:38
Okay, so i'd probably have to do that a little differently.
02:41
It's connected to four, it's connected to five.
02:44
That is pretty much what we have there.
02:49
And we also have that two, in turn, is connected to three, and three is connected to six.
02:56
If we, you know, go to three, three is connected to six.
03:00
Next thing will be four.
03:02
And four is connected to, well, just, well, of course, it's just connected to seven.
03:14
Think about it that way, right? four is connected to seven.
03:18
But this is a thing that we're going to look at, right? so four is, yeah, four is connected to seven, right? okay.
03:33
Now five is connected to both seven and to eight.
03:42
Sorry, five is connected, not seven, not seven and eight.
03:45
So let's just take a look at that again.
03:48
I'm sorry.
03:49
So the neighbors of two are three and the neighbor is three there.
03:58
And then from four, we have seven.
04:04
Okay.
04:09
So, yeah, actually we're going to start with, so the neighbor of two is three, and then we're going to go to four rather.
04:19
We're going to go to four...