public static IEnumerable<T> TraverseBreadthFirst<T>(
T root,
Func<T, IEnumerable<T>> childrenSelector
)
Public Shared Function TraverseBreadthFirst(Of T) (
root As T,
childrenSelector As Func(Of T, IEnumerable(Of T))
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ TraverseBreadthFirst(
T root,
Func<T, IEnumerable<T>^>^ childrenSelector
)
static member TraverseBreadthFirst :
root : 'T *
childrenSelector : Func<'T, IEnumerable<'T>> -> IEnumerable<'T>
The tree is not checked for loops. If the resulting sequence needs to be finite then it is the responsibility of childrenSelector to ensure that loops are not produced.
This function defers traversal until needed and streams the results.