Traversals

Depth-first and breadth-first traversals of any tree

Functions

Link copied to clipboard
inline fun <T : Any> breadthFirstTraversal(t: T, crossinline childrenFactory: T.() -> List<T>): Sequence<T>

Generates a breadth-first traversal sequence for a given tree or graph structure.

Link copied to clipboard
inline fun <T : Any> depthFirstTraversal(t: T, crossinline childrenFactory: T.() -> List<T>): Sequence<T>

Generates a depth-first traversal sequence for a given tree or graph structure.