Breadth-First Search

This algorithm starts from the root node and then, after exploring all the neighboring nodes first, it moves toward the next level of neighbors, which returns the shortest path to our solution. It uses the FIFO queue data structure.

The disadvantage of this algorithm is that it consumes a lot of memory because each level of nodes is saved in order to create the next one.

Read more at: https://en.wikipedia.org/wiki/Breadth-first_search.

Get Learning Android Game Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.