Closed Smoren closed 1 year ago
This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Totals | |
---|---|
Change from base Build 3864324454: | 0.1% |
Covered Lines: | 237 |
Relevant Lines: | 238 |
Hi @Smoren,
Thank you again for your continued interest in IterTools. I appreciate the continued suggestions and implementations of new functionality and the thorough unit testing and documentation in the existing style of the library.
For this tree-like traversal functionality, I think it might be better suited if you released it as an independent utility library, rather than as functionality in IterTools. The reason for this is that the functionality you are proposing here is really about tree data structures and the various ways to interpret them and traverse the values. This is very useful functionality. However, it may not be a good fit for this IterTools library.
Most of the functions in IterTools take simple lists, or scalar values to produce new useful functionality. I'd like to keep the inputs simple like this. That means the library may not do everything, but what it does do is simple to use and understand from an API input standpoint.
Also, if you focus on a tree data structure library, it may allow you to add additional tree functionality such as pre/post/in-order traversals on binary-tree data structures, as well as searching for an element in the tree, using either breadth-first or depth-first search, for example. I also think it will help people more easily find this functionality if it is in a tree traversal library rather than IterTools.
FYI, what you are calling traverseDeep
might be better expressed as traverseDepthFirst
(Depth-First Search), and what you are calling traverseWide
might be better expressed as traverseBreadthFirst
or traverseLevelOrder
(Breadth-First Search).
You did a great job on the PR and the testing looks very good and thorough. I apologize that I don't think I will merge this into the library. But I think you can use what you have already written to start your own tree traversal library and that will result in a more focused and discoverable tool for users looking for tree data structure traversal functionality.
Thanks, Mark
Hi @markrogoyski
Thanks for the feedback!
OK, I'll think about a separate repository for this functionality.
Hi @markrogoyski
FYI: I've created a separate repository for working with tree structures: https://github.com/Smoren/tree-tools-php
@markrogoyski
Hi Mark!
What do you think about new namespace
Tree
for traversing tree structures like flat collections?I've implemented 2 methods:
Tree:traverseDeep()
for deep traversal;Tree:traverseWide()
for wide traversal.Hope this functionality is suitable for your repository and will be useful.