Graph DFS
Depth-first traversal of a graph, exploring as far as possible along each branch before backtracking.
Interactive Visualization
Loading visualization…
Usage
import { Graph, graphDfs } from 'athro';
const graph = new Graph<string>();
graph.addEdge('A', 'B');
graph.addEdge('A', 'C');
graph.addEdge('B', 'D');
graphDfs(graph, 'A'); // ['A', 'B', 'D', 'C']
Time Complexity
O(V + E) where V is vertices and E is edges.