You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you start DFS with a node that doesn't exist in the graph, it will lead to an error when trying to access this.connections[currNode].
Expected Behavior
When the method is called with a valid node that exists in the graph, it should perform a depth-first search (DFS) starting from that node. It will explore all connected nodes and return true if it finds a node that matches the targetValue.
Actual Behavior
If the method was called with a node that doesn't exist in the graph:
It would attempt to access this.connections[currNode] in the while loop, leading to an error.
This would crash the method and potentially halt the program, resulting in a poor user experience.
Steps to reproduce (if applicable)
No response
Additional information
No response
The text was updated successfully, but these errors were encountered:
Not a bug. If the precondition is violated, the function is allowed to crash, and this is to be expected. We could add some more error handling to throw a more useful error in this case, but I don't consider this necessary, and it would further clutter the implementation.
Description
If you start DFS with a node that doesn't exist in the graph, it will lead to an error when trying to access this.connections[currNode].
Expected Behavior
When the method is called with a valid node that exists in the graph, it should perform a depth-first search (DFS) starting from that node. It will explore all connected nodes and return true if it finds a node that matches the targetValue.
Actual Behavior
If the method was called with a node that doesn't exist in the graph:
It would attempt to access this.connections[currNode] in the while loop, leading to an error.
This would crash the method and potentially halt the program, resulting in a poor user experience.
Steps to reproduce (if applicable)
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: