v2026.6.1
All Bundles
Bundle Classic AI algorithms: graph search, adversarial game search, optimization and tabular reinforcement learning (-lib ai)

DepthFirst

Depth-first search: finds A path (not necessarily shortest), useful for reachability. The result cost is the hop count of the found path.

Operations

FindPath # function

Finds a path between two nodes by iterative depth-first search.

function : FindPath(graph:Graph, start:Int, goal:Int) ~ SearchResult

Parameters

NameTypeDescription
graphGraphgraph to search
startIntstart node id
goalIntgoal node id

Return

TypeDescription
SearchResultsearch result