1
00:00:02,310 --> 00:00:07,080
In the previous coring session, we successfully extracted the interest points from our means.

2
00:00:07,500 --> 00:00:12,990
And now once we have the interest points, we need to create a graph class so that we can create a graph

3
00:00:13,020 --> 00:00:16,190
to store those interest points and the respective connection.

4
00:00:16,680 --> 00:00:17,400
So let's do that.

5
00:00:17,890 --> 00:00:19,920
We move over the board map of class.

6
00:00:20,220 --> 00:00:25,140
Right above it, we create the class that we name as graph.

7
00:00:25,260 --> 00:00:31,770
So this is a graph class and the very first function that we define inside it is init function or the

8
00:00:31,770 --> 00:00:32,940
initialization function.

9
00:00:33,990 --> 00:00:38,550
And this one shall be used to create the instance variable for our class graph class.

10
00:00:39,090 --> 00:00:46,950
The very first instance variable will be additionally to store our graph so we name it as graph and

11
00:00:46,950 --> 00:00:50,490
to create additionally without actually bracket in front of it.

12
00:00:51,030 --> 00:00:57,660
And then we define the two information variables instance variable that define entry point or exit point

13
00:00:57,660 --> 00:00:58,200
of our group.

14
00:00:58,980 --> 00:01:05,490
So that can be written as self doubt start initialize them to zero and says don't end as exit point

15
00:01:05,490 --> 00:01:06,060
for graph.

16
00:01:06,630 --> 00:01:13,650
And once you define the init function we move over to defining the next function that will add vertex

17
00:01:13,920 --> 00:01:14,400
function.

18
00:01:14,820 --> 00:01:20,040
Now this function would be used to perform the actual task of creating the graph one vertex at a time.

19
00:01:20,730 --> 00:01:26,370
Along with this problem, it will also perform the connection between those vertices and their neighbors.

20
00:01:26,940 --> 00:01:27,780
So let's do that.

21
00:01:28,050 --> 00:01:29,700
If we define this argument itself.

22
00:01:30,420 --> 00:01:32,370
The sixth next argument of Vertex.

23
00:01:36,470 --> 00:01:40,400
The next argument or vertex and third argument of neighbor.

24
00:01:41,340 --> 00:01:45,570
Now, if the neighbor is not provided, we initialize this to none.

25
00:01:46,910 --> 00:01:48,980
And the next argument, of course.

26
00:01:50,280 --> 00:01:53,250
And if the case has not been provided, we defaulted to none.

27
00:01:53,910 --> 00:01:57,810
So if the neighbor is not present, this case would be for the vertex.

28
00:01:58,020 --> 00:02:01,650
And if the neighbor is present in this case would be for the neighbor.

29
00:02:02,700 --> 00:02:09,750
And the last argument is the cost is basically represents the cost of traversing from our vertex to

30
00:02:09,750 --> 00:02:11,850
a neighbor when adding the connection.

31
00:02:12,450 --> 00:02:17,550
So using this parameters, we defined this particular function, starting with the case where if the

32
00:02:17,550 --> 00:02:23,100
vertex was already present graph, if it is already present, that this means that we are utilizing

33
00:02:23,100 --> 00:02:26,490
this function to make a connection between the vertex and its neighbor.

34
00:02:27,240 --> 00:02:28,440
So let's address that case.

35
00:02:29,370 --> 00:02:36,900
So if the vertex is in self doubt graph gherkins, so if it is already present inside it, what we need

36
00:02:36,900 --> 00:02:38,580
to do is to add the neighbor.

37
00:02:40,530 --> 00:02:41,610
So we add that neighbor.

38
00:02:42,720 --> 00:02:45,170
Several got vortex.

39
00:02:45,780 --> 00:02:46,860
So we add that neighbor.

40
00:02:48,150 --> 00:02:57,060
By creating additionally for that neighbor as a value of the vertex he so once we do that we a actually

41
00:02:57,150 --> 00:03:02,460
record and once you create the dictionary for the neighbor, then we all we need to do is to simply

42
00:03:02,910 --> 00:03:07,080
update the dictionary with a two keys that is the keys and cost for the neighbor.

43
00:03:07,950 --> 00:03:10,320
So we simply write graph vertex.

44
00:03:12,130 --> 00:03:13,270
Call the neighbor dictionary.

45
00:03:14,460 --> 00:03:23,370
And update the key ski with key keys provided by the user in the same way update the cost.

46
00:03:24,610 --> 00:03:27,160
With a cost provided by the user or the neighbour.

47
00:03:29,050 --> 00:03:35,380
Now once we have done this, we address the next case or the other case where our vertex was not present.

48
00:03:35,560 --> 00:03:36,580
In the case of a graph.

49
00:03:37,060 --> 00:03:39,460
So we need to add that vertex to the graph.

50
00:03:40,560 --> 00:03:42,360
By simply writing self your craft.

51
00:03:43,690 --> 00:03:44,280
Vortex.

52
00:03:44,920 --> 00:03:49,050
I'm creating additionally for that particular voters must recreate the dictionary.

53
00:03:49,090 --> 00:03:52,330
We can now add the key of case.

54
00:03:53,740 --> 00:04:01,540
We're adding social graph vortex, accessing that dictionary, writing history of kids and giving it

55
00:04:01,540 --> 00:04:03,190
the user defined gives.

56
00:04:04,280 --> 00:04:09,470
Now that we have addressed both the cases that could occur inside this function, we have completed

57
00:04:09,470 --> 00:04:15,110
the process of creating the graph using AdWords and also adding the connection between the vortex and

58
00:04:15,110 --> 00:04:15,620
its neighbor.

59
00:04:16,050 --> 00:04:21,170
Now the last function that we need to add is simply a display graph function that we use when we want

60
00:04:21,170 --> 00:04:22,170
to display our graph.

61
00:04:22,190 --> 00:04:23,570
Once we have completed it.

62
00:04:24,590 --> 00:04:26,720
So this takes an input argument or self.

63
00:04:29,210 --> 00:04:38,690
And we simply iterate over our graph by accessing is key value fear by writing self-talk graph dot items.

64
00:04:39,050 --> 00:04:42,680
This function provides us the key value iteratively over all the graph.

65
00:04:43,790 --> 00:04:51,500
So now we simply print it out by writing key placeholder for that key has value.

66
00:04:55,630 --> 00:05:02,820
Blissful their gainful value and then formate providing it the key and value.

67
00:05:03,700 --> 00:05:08,140
So this completes the display graph function and the graph class has been completed.

68
00:05:08,440 --> 00:05:14,290
So this graph graphs can now successfully be used to store the interest points and the respective connection.

69
00:05:14,860 --> 00:05:19,900
So let's move on to storing the interest points and making the connection between them by creating grow

70
00:05:20,500 --> 00:05:20,980
the scope.
