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 |
The object reverseBreadthFirstSearch is a method function.