kotlin
kotlin copied to clipboard
KT-18629 Add BFS File walking.
https://youtrack.jetbrains.com/issue/KT-18629
Also, it would be nice if the merge commits would be removed from this PR for more convenient commit-wise review.
I wonder what are the use cases for bottom-up breadth first search?
I wonder what are the use cases for bottom-up breadth first search?
This is a good question.
Also, it would be nice if the merge commits would be removed from this PR for more convenient commit-wise review.
Done.
I propose making BFS top-down visiting order just another entry in FileWalkDirection enum. This way it will require much less changes in the public API surface.
As to bottom-up BFS visitor — it could be postponed until its use cases are clear.
@ihdadi3 please use English.
I propose making BFS top-down visiting order just another entry in
FileWalkDirectionenum. This way it will require much less changes in the public API surface.As to bottom-up BFS visitor — it could be postponed until its use cases are clear.
I'm agree with you.
I wonder what are the use cases for bottom-up breadth first search?
See e.g. the discussion at https://github.com/heremaps/oss-review-toolkit/pull/1903#discussion_r341245108 for a use-case.
@sschuberth I've skimmed through the discussion, but haven't got an idea how the described use case is different from the regular BFS. And I wondered originally about the bottom-up BFS.
In DFS, the bottom-up and top-down walk orders differ only in a way how directory entries are visited compared to their nested file entries. In the referenced case the author filters the visited directory entries out with .filter { it.isFile }, so it doesn't matter in which order they were visited.
Sorry, you're right @ilya-g. I didn't get that the emphasis was on bottom-up, not on BFS in general. The discussion I referred to only explains the use-case for BFS vs. DFS.