Static findFinds a path between two nodes using DFS
adjacency list representation of the graph
starting node
ending node
array representing a path, or null if no path exists
Static findFinds a path between two nodes using DFS (recursive)
adjacency list representation of the graph
starting node
ending node
array representing a path, or null if no path exists
Static hasStatic hasStatic traverseStatic traverseGenerated using TypeDoc
Depth-First Search (DFS) algorithm DFS is an algorithm for traversing or searching tree or graph data structures. It starts at a chosen node and explores as far as possible along each branch before backtracking.
Time Complexity: O(V + E) where V is vertices and E is edges Space Complexity: O(V)
Example