Bundle Classic AI algorithms: graph search, adversarial game search, optimization and tabular reinforcement learning (-lib ai)
Graph
Weighted directed graph over integer node ids 0..n-1, stored as compact per-node adjacency lists that grow automatically. For an undirected edge add both directions.
Example
graph := Graph->New(4);
graph->AddEdge(0, 1, 2.5);
graph->AddEdge(1, 3, 1.0);
result := Dijkstra->FindPath(graph, 0, 3);Operations
AddEdge #
Adds a directed weighted edge.
method : public : AddEdge(src:Int, to:Int, weight:Float) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| src | Int | source node id |
| to | Int | destination node id |
| weight | Float | edge weight (>= 0 for the shortest-path searches) |
Return
| Type | Description |
|---|---|
| Bool | true if the edge was added, false on an invalid node id |
GetNumEdges #
Gets the number of edges.
method : public : GetNumEdges() ~ IntReturn
| Type | Description |
|---|---|
| Int | edge count |