Open adamjanicki2 opened 7 months ago
I don't think #26 is a blocker. But if this function ends up walking, it should definitely set parent pointers as it goes!
One issue is: you'd expect this function to stop once it finds the requested node. But currently, we assume that if a node has a parent pointer, its descendants also have parent pointers.
One issue is: you'd expect this function to stop once it finds the requested node. But currently, we assume that if a node has a parent pointer, its descendants also have parent pointers.
Yeah, maybe we should wait on setting parent pointers here
Not sure. When we really care we do tend to use force
. Maybe we should invert force
and make it be the default behavior of updateParents()
.
I am unclear on the usage of this function so can't assess the design
On Mar 25, 2024, 8:42 PM, at 8:42 PM, Lea Verou @.***> wrote:
Not sure. When we really care we do tend to use
force
. Maybe we should invertforce
and make it be the default behavior ofupdateParents()
.-- Reply to this email directly or view it on GitHub: https://github.com/mavoweb/treecle/issues/27#issuecomment-2019183805 You are receiving this because you are subscribed to this thread.
Message ID: @.***>
One of our use cases is a general
findPath
function, so I wanted to make an issue to discuss design before diving into implementing it. My thoughts are it should be a function like followswhich returns a path of type
Array<string | number>
to get from start to end. The function should attempt to use parent pointers to climb from end to start, but do a BFS/DFS if no parents are set. Before implementing this, we will need to resolve #26 because in a situation like this where parents aren't necessary but helpful, it would be nice to do a console.warn about it (see end of #26)