Breadth-First Search option for Node.find_child() #6131
Replies: 2 comments 9 replies
-
Can you describe your use case for using |
Beta Was this translation helpful? Give feedback.
-
BFS has a cost, in that it requires keeping the "wavefront" in memory while searching. In real time software, memory allocations need to be kept to a minimum, because allocating memory is an operation that could take any amount of time, based on the amount of allocations made so far. In other words, without adding skip-links to the nodes (which would be its own additional layer of complexity), BFS would simply be far too costly relative to DFS, and not practical for use in a game engine. |
Beta Was this translation helpful? Give feedback.
-
Reading the docs, found that Node.find_child() function (old: Node.find_node) performs a Deep-First Search. I thought it could be great having an optional parameter to choose between deep and breadth search. Of course, depending on each project or use case, one of the two options will be more convenient but this way we give the user more control over what it's happening.
Beta Was this translation helpful? Give feedback.
All reactions