Breadth first search is a graph search algorithm that starts at one node and visits neighboring nodes as widely as possible before going further down any other path. This algorithm requires the use of a queue to keep track of which nodes to visit, so it might be worth your time to brush up on that data structure before watching this lesson.
If you're not using the code in the code sandbox and don't want to import the queue data structure from the previous lesson you can also just use an array to store the nodes. Also, the transcript has some discrepancies with the usage of visited and visitedHash for the name of the aforementioned queue.
In the transcript, in the second example, an object named visited
is created. In later examples, it is referenced as visitedHash
. This is corrected in the full source code above.
Thanks for this Rob and Christopher! I got the transcripts updated.