# reverseBreadthFirstSearch -- runs a reverse breadth first search on the digraph and returns a list of the vertexSet in the order they were discovered

## Synopsis

• Usage:
bfs = reverseBreadthFirstSearch(D,v)
• Inputs:
• D, an instance of the type Digraph
• Outputs:
• bfs, a list, A list of the vertexSet of D in order discovered by the breadth first search

## Description

A reverse breadth first search first searches the specified of a digraph, followed by that vertex's parents, followed by their parents, etc, until all the ancestors are exhausted, and returns a list, with the index of the item of the list signifying the depth level of the result, of the vertexSet in order searched.

 i1 : D = digraph ({{0,1},{0,2},{2,3},{3,4},{4,2}},EntryMode=>"edges") o1 = Digraph{0 => {1, 2}} 1 => {} 2 => {3} 3 => {4} 4 => {2} o1 : Digraph i2 : bfs = reverseBreadthFirstSearch(D,2) o2 = {{2}, {4, 0}, {3}} o2 : List

## See also

• breadthFirstSearch -- runs a breadth first search on the digraph starting at a specified node and returns a list of the vertices in the order they were discovered
• depthFirstSearch -- runs a depth first search on the digraph or digraph and returns the discovery time and finishing time for each vertex in the digraph
• topologicalSort -- outputs a list of vertices in a topologically sorted order of a DAG.

## Ways to use reverseBreadthFirstSearch :

• "reverseBreadthFirstSearch(Digraph,Thing)"

## For the programmer

The object reverseBreadthFirstSearch is .