Exploring MoreLINQ Part 25 - Traverse
So we're finally at the end of this exploring MoreLINQ series, and today we're looking at TraverseBreadthFirst
and TraverseDepthFirst
. These are well-known algorithms for traversing a nested structure in different ways. You simply provide the starting object, and then a function which returns the "children" of that object.
These methods can be used to traverse an existing in-memory tree structure like I show in the video, but you can also put them to creative use to do things like maze solving, where the "children" of a position in the maze are new positions you can reach from your current position that you haven't already visited.
The example I use for today's video is traversing the royal family tree.
I hope you've enjoyed the series. I certainly was amazed at how much cool stuff is in MoreLINQ. I have covered over 60 methods in this series, but there are still plenty more for you to explore. A huge thanks to Atif Aziz and the rest of the contributors for all the work that has gone into this library.
You can find all videos in this series here.