Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph data structures. It starts at the tree root (or some arbitrary node of a graph, sometimes referred to as a 'search key'[1]), and explores all of the neighbour nodes at the present depth prior to moving on to the nodes at the next depth level.
Breadth-first search can be used to solve many problems in graph theory, for example:
Copying garbage collection, Cheney's algorithm
Finding the shortest path between two nodes u and v, with path length measured by number of edges (an advantage over depth-first search)[10]
(Reverse) Cuthill–McKee mesh numbering
Ford–Fulkerson method for computing the maximum flow in a flow network
Serialization/Deserialization of a binary tree vs serialization in sorted order, allows the tree to be re-constructed in an efficient manner.
Construction of the failure function of the Aho-Corasick pattern matcher.
Testing bipartiteness of a graph.
0 Comments