00:01
Hello student here the completed code implement the flood fill algorithm using breadth first search bfs to identify and modify marked pixel in an image represented as a 2d array.
00:14
So here some part of the code is written and some part i have added.
00:18
So create a node first is create the node the data points within the graph class node.
00:23
So here i have taken the constructor with the help of this i have initialized the data self .x is equal to x self .y is equal to y and self .neighbors is a list of empty at the starting.
00:36
So start function act as a starting point for the flood fill algorithm.
00:41
So here i have defined the start function.
00:44
So here sample images represented as a 2d array of the number are these images are i have taken into the array in 1010 form.
00:52
So this is given to us and it is a 2d array.
00:55
Now i have taken the graph class and for this i have created the object for this and now print the graph .flood fill.
01:07
So here object is calling the flood fill algorithm and here i we are passing image and its parameter.
01:17
So call the flood fill algorithm here.
01:20
So call flood fill algorithm here and after this return the graph.
01:26
So the flood fill algorithm using bfs.
01:29
So here i have written the class its name is graph and the number of the non unique edges equal to 0 and visited is the set.
01:38
So set of the function.
01:39
So here i have defined the function flood fill.
01:42
Here i am sending x y pixels x y and pixels.
01:47
So start equal to node of x and y.
01:49
So we have to start from a node with the coordinates x and y and q at the starting is empty and we can append the q by the start with the nodes.
02:00
So here i am using the while loop.
02:04
So while q it means there is something in the queue.
02:07
So current node for the current node pop from the queue.
02:11
So first data in the queue will be the current node.
02:14
Now current x and current y i have to calculate.
02:17
So for this value i have assigned current node dot x in current x and in current y current dot node dot y it is assigned to current y.
02:27
Now check if the current pixel is blank.
02:30
So blank means the current pixel is 0 or not...