-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed as not planned
Description
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
Metadata
Metadata
Assignees
Labels
No labels