Skip to content
FutureBlitz

    Install

    Import std.algo.search

    DfsOrder

    std.algo.search

    function

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

    The nodes start reaches, itself first, in the order depth-first search meets them: a successor, and all it reaches, before the next successor.

    Examples

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

    std/algo/search.fb, line 205

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