Skip to content

five-on-it / packages/ai/src/pathfinding / SearchGraph

Interface: SearchGraph ​

Defined in: packages/ai/src/pathfinding.ts:30

What A* needs of a graph: nodes numbered from 0, their neighbours with costs, and a heuristic.

Properties ​

size ​

size: number

Defined in: packages/ai/src/pathfinding.ts:32

Number of nodes.

Methods ​

heuristic() ​

heuristic(from, to): number

Defined in: packages/ai/src/pathfinding.ts:36

A lower bound of the cost from from to to.

Parameters ​

from ​

number

to ​

number

Returns ​

number


neighbors() ​

neighbors(node, visit): void

Defined in: packages/ai/src/pathfinding.ts:34

Calls visit for every neighbour of node with the cost of the step, always in the same order.

Parameters ​

node ​

number

visit ​

(to, cost) => void

Returns ​

void