next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Graphs :: reverseBreadthFirstSearch

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

Synopsis

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

Ways to use reverseBreadthFirstSearch :

For the programmer

The object reverseBreadthFirstSearch is a method function.