graphs only some paths in game tree lead to successful conclusion for examplesome lead to win by your opponent when you reach such an endingyou must back upor backtrackto previous node and try different path in this way you explore the tree until you find path with successful conclusion then you make the first move along this path breadth-first search as we saw in the depth-first searchthe algorithm acts as though it wants to get as far away from the starting point as quickly as possible in the breadth-first searchon the other handthe algorithm likes to stay as close as possible to the starting point it visits all the vertices adjacent to the starting vertexand only then goes further afield this kind of search is implemented using queue instead of stack an example figure shows the same graph as figure but here the breadth-first search is used againthe numbers indicate the order in which the vertices are visited figure breadth-first search is the starting vertexso you visit it and make it the current vertex then you follow these rulesrule visit the next unvisited vertex (if there is onethat' adjacent to the current vertexmark itand insert it into the queue rule if you can' carry out rule because there are no more unvisited verticesremove vertex from the queue (if possibleand make it the current vertex