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

Dijkstra

Dijkstra's single-pair shortest path over non-negative edge weights.

Example

result := Dijkstra->FindPath(graph, 0, 5);
if(result->Found()) {
  result->GetCost()->PrintLine();
};

Operations

FindPath # function

Finds the minimum-cost path between two nodes.

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

Parameters

NameTypeDescription
graphGraphgraph to search
startIntstart node id
goalIntgoal node id

Return

TypeDescription
SearchResultsearch result