Skip to content
FutureBlitz

    Install

    Import std.algo.search

    BfsOrder

    std.algo.search

    function

    Public Function BfsOrder<N: Hashable>(start: N, successors: Func(N): N[]): N[]

    The nodes start reaches, itself first, in the order breadth-first search meets them: those fewer steps away first.

    Examples

    Local next = Function(n: Int): Int[] => n < 4 ? [n * 2, n * 2 + 1] : []
    Expect(BfsOrder(1, next) == [1, 2, 3, 4, 5, 6, 7])

    std/algo/search.fb, line 138

    Report an issue with this page or with FutureBlitz on GitHub.