Skip to content

@graphty/algorithms / index / depthFirstSearch

Function: depthFirstSearch() ​

depthFirstSearch(graph, startNode, options): TraversalResult

Defined in: algorithms/traversal/dfs.ts:26

Perform depth-first search starting from a given node

Parameters ​

graph ​

Graph

The input graph to traverse

startNode ​

NodeId

The node to start the DFS from

options ​

DFSOptions = {}

DFS options (recursive mode, pre/post order, etc.)

Returns ​

TraversalResult

Traversal result with visited nodes, order, and tree structure