Breadth-first search: Difference between revisions

Content deleted Content added
 
Line 52:
The ''parent'' attribute of each node is useful for accessing the nodes in a shortest path, for example by backtracking from the destination node up to the starting node, once the BFS has been run, and the predecessors nodes have been set.
 
Breadth-first search produces a so-called ''breadth-first tree'' which is shown in the example below.
 
=== Example ===